Private
Public Access
1
0

improved courses kml download

This commit is contained in:
Sander Roosendaal
2019-02-12 10:17:37 +01:00
parent 867070188c
commit f94dcec851
4 changed files with 179 additions and 0 deletions

View File

@@ -33,6 +33,11 @@ from rowers.utils import geo_distance
ns = {'opengis': 'http://www.opengis.net/kml/2.2'}
xmlns_uris_dict = {'gx': 'http://www.google.com/kml/ext/2.2',
'kml': 'http://www.google.com/kml/ext/2.2',
'atom': "http://www.w3.org/2005/Atom",
'': "http://www.opengis.net/kml/2.2"}
from rowers.models import (
Rower, Workout,
@@ -91,11 +96,18 @@ def get_polygons(polygonpms):
'points':points
})
return polygons
def coursetokml(course):
top = Element('kml')
for prefix, uri in xmlns_uris_dict.items():
if prefix != '':
top.attrib['xmlns:' + prefix] = uri
else:
top.attrib['xmlns'] = uri
document = SubElement(top,'Document')
name = SubElement(document, 'name')
name.text = 'Courses.kml'