def write_gpx(gpx,name,act_type): # You can add routes and waypoints, too... tzname=None npoints=None # polyline encoder default values numLevels = 18; zoomFactor = 2; epsilon = 0.0; forceEndpoints = True; ##print('Created GPX:', gpx.to_xml()) ts = int(time.time()) filename = "%s/%i.gpx" % (filebase,ts) a = open(filename, 'w') a.write(gpx.to_xml()) a.close() gpx.simplify() #gpx.reduce_points(1000) trk = pl.read_gpx_trk(gpx.to_xml(),tzname,npoints,2,None) try: polyline=pl.print_gpx_google_polyline(trk,numLevels,zoomFactor,epsilon,forceEndpoints) except UnboundLocalError as er: print(er) print("Not enough points to create a polyline") polyline="" #polyline="polyline" add_run(gpx,name,act_type,filename,polyline)
def write_gpx(gpx, name, act_type): # You can add routes and waypoints, too... tzname = None npoints = None # polyline encoder default values numLevels = 18 zoomFactor = 2 epsilon = 0.0 forceEndpoints = True ##print('Created GPX:', gpx.to_xml()) ts = int(time.time()) filename = "%s/%i.gpx" % (filebase, ts) a = open(filename, "w") a.write(gpx.to_xml()) a.close() gpx.simplify() # gpx.reduce_points(1000) trk = pl.read_gpx_trk(gpx.to_xml(), tzname, npoints, 2, None) try: polyline = pl.print_gpx_google_polyline(trk, numLevels, zoomFactor, epsilon, forceEndpoints) except UnboundLocalError as er: print(er) print("Not enough points to create a polyline") polyline = "" # polyline="polyline" add_run(gpx, name, act_type, filename, polyline)