improved courses kml download
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user