X-Git-Url: http://www.average.org/gitweb/?p=loctrkd.git;a=blobdiff_plain;f=gps303%2Fmkgpx.py;h=f694b7ee80cd5c69de49805be79d1e18f2cf061b;hp=40588a0885791b347d5f3fc2ddb0f43a1b560cb6;hb=8bf5efdf4f5d069b108e6fd8140f5ebd930b538e;hpb=2cc29ee67b6432e1cd74a21b3c9181b8b5b557f9 diff --git a/gps303/mkgpx.py b/gps303/mkgpx.py index 40588a0..f694b7e 100644 --- a/gps303/mkgpx.py +++ b/gps303/mkgpx.py @@ -7,10 +7,24 @@ from .opencellid import qry_cell db = connect(sys.argv[1]) c = db.cursor() -c.execute("select tstamp, packet from events where proto in ({})" - .format(", ".join([str(n) for n in (WIFI_POSITIONING.PROTO, WIFI_OFFLINE_POSITIONING.PROTO, GPS_POSITIONING.PROTO, GPS_OFFLINE_POSITIONING.PROTO)]))) +c.execute( + "select tstamp, packet from events where proto in ({})".format( + ", ".join( + [ + str(n) + for n in ( + WIFI_POSITIONING.PROTO, + WIFI_OFFLINE_POSITIONING.PROTO, + GPS_POSITIONING.PROTO, + GPS_OFFLINE_POSITIONING.PROTO, + ) + ] + ) + ) +) -print(""" +print( + """ @@ -18,7 +32,8 @@ xmlns="http://www.topografix.com/GPX/1/1"> Location Data -""") +""" +) for tstamp, packet in c: msg = parse_message(packet) @@ -30,11 +45,15 @@ for tstamp, packet in c: lat, lon = msg.latitude, msg.longitude else: continue - isotime = datetime.fromtimestamp(tstamp).astimezone(tz=timezone.utc).isoformat() - isotime = isotime[:isotime.rfind(".")] + "Z" + isotime = ( + datetime.fromtimestamp(tstamp).astimezone(tz=timezone.utc).isoformat() + ) + isotime = isotime[: isotime.rfind(".")] + "Z" trkpt = """ - """.format(lat, lon, isotime) + """.format( + lat, lon, isotime + ) print(trkpt) if False: print( @@ -43,6 +62,8 @@ for tstamp, packet in c: .isoformat(), msg, ) -print(""" +print( + """ -""") +""" +)