Private
Public Access
1
0

list courses v0.1

This commit is contained in:
Sander Roosendaal
2018-02-19 09:33:03 +01:00
parent a2628c1860
commit 8a81a63c87
5 changed files with 161 additions and 0 deletions

View File

@@ -105,6 +105,10 @@ def kmltocourse(f):
return polygons
from geopy.geocoders import Nominatim
geolocator = Nominatim()
def createcourse(manager,name,polygons):
c = GeoCourse(manager=manager,name=name)
c.save()
@@ -115,6 +119,11 @@ def createcourse(manager,name,polygons):
pp.save()
j = 0
for point in p['points']:
if i==0 and j==0:
loc = geolocator.reverse((point['latitude'],point['longitude']))
country = loc.raw['address']['country']
c.country = country
c.save()
obj = GeoPoint(
latitude = point['latitude'],
longitude = point['longitude'],