Commit 52be9f5f authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Add time data to KML output

parent cb9feea8
......@@ -98,30 +98,30 @@ def buildGPX(data):
def buildKML(data):
output = """<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<ExtendedData>
<Data name="styleUrl"><value>#style</value></Data>
<Data name="styleHash"><value>1a1ac94e</value></Data>
<Data name="stroke"><value>#ffff00</value></Data>
<Data name="stroke-opacity"><value>0.4980392156862745</value></Data>
<Data name="stroke-width"><value>4</value></Data>
<Data name="fill"><value>#00ff00</value></Data>
<Data name="fill-opacity"><value>0.4980392156862745</value></Data>
</ExtendedData>
<LineString>
<coordinates>
"""
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document>
<Placemark>
<ExtendedData>
<Data name="styleUrl"><value>#style</value></Data>
<Data name="styleHash"><value>1a1ac94e</value></Data>
<Data name="stroke"><value>#ffff00</value></Data>
<Data name="stroke-opacity"><value>0.4980392156862745</value></Data>
<Data name="stroke-width"><value>4</value></Data>
<Data name="fill"><value>#00ff00</value></Data>
<Data name="fill-opacity"><value>0.4980392156862745</value></Data>
</ExtendedData>
<gx:Track>"""
for row in data:
output += "%s,%s,%s " % (row["lon"], row["lat"], row["alt"] or "0")
output += """
<when>%s</when>
<gx:coord>%s %s %s</gx:coord>""" % (row["ts"].isoformat(), row["lon"], row["lat"], row["alt"] or "0")
output += """
</coordinates>
</LineString>
</Placemark>
</Document>
</gx:Track>
</Placemark>
</Document>
</kml>
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment