summaryrefslogtreecommitdiff
path: root/app/locations/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/locations/models.py')
-rw-r--r--app/locations/models.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/app/locations/models.py b/app/locations/models.py
index 1ac48cb..a56299e 100644
--- a/app/locations/models.py
+++ b/app/locations/models.py
@@ -7,6 +7,7 @@ from django.utils.safestring import mark_safe
"http://staticmap.openstreetmap.de/staticmap.php?center=object.location.geometry.centroid.y,object.location.geometry.centroid.x&zoom=14&size=1140x300&maptype=osmarenderer&markers=40.702147,-74.015794,lightblue1"
+
class Region(models.Model):
"""Model to define arbitrary regions based on where I've been"""
name = models.CharField(max_length=50)
@@ -181,14 +182,14 @@ def get_bounds(lat, lon):
state = adr.get('state')
country = adr.get('country')
r = requests.get('http://nominatim.openstreetmap.org/search',
- params={
- 'city': city,
- 'state': state,
- 'country': country,
- 'polygon_text': 1,
- 'format': 'json',
- 'featuretype': 'neighborhood'
- })
+ params={
+ 'city': city,
+ 'state': state,
+ 'country': country,
+ 'polygon_text': 1,
+ 'format': 'json',
+ 'featuretype': 'neighborhood'
+ })
r.raise_for_status()
data = json.loads(r.text)
poly = GEOSGeometry(data[0]['geotext'])