def __init__(self, gpxFileName=None): GeoSectionDataList.__init__(self) gpxFile = open(gpxFileName, 'r') gpx = gpxpy.parse(gpxFile) self.extend(gpx.tracks[0].segments[0].points)
@property def endPoint(self): return self[len(self)-1]["name"] def __str__(self): str = "" for i, geoNameGpx in enumerate(self): str += "{0}.{1}\n\r".format(i, geoNameGpx["name"]) return str if __name__ == "__main__": _geoNamesAdapterCsvFile_geoNames = geoNamesAdapterCsvFile_geoNames("./PL.txt") _geoNamesAdapterCsvFile_geoPortal = geoNamesAdapterCsvFile_geoPortal("./obiekty_fizjograficzne.csv") gpx_file = open('../aa.gpx', 'r') gpx = gpxpy.parse(gpx_file) points = gpx.tracks[0].segments[0].points geoNamesGpx = geoNames(points, _geoNamesAdapterCsvFile_geoNames) for i, geoNameGpx in enumerate(geoNamesGpx): print(geoNameGpx) print(geoNamesGpx) print(geoNamesGpx.startPoint) print(geoNamesGpx.endPoint)
def __init__(self, gpxFileName=None): try: gpxFile = open(gpxFileName, 'r') geoSectionGpxDataSummary.__init__(self, gpxpy.parse(gpxFile)) except Exception as e: print("Error opening or parsing {0}: {1}.".format(gpxFileName, e))