Skip to content

Instantly share code, notes, and snippets.

@sjg
Forked from robcowie/gla_boundary.py
Created July 15, 2015 11:38
Show Gist options
  • Save sjg/a70aa77a4ca7a1d94123 to your computer and use it in GitHub Desktop.
Save sjg/a70aa77a4ca7a1d94123 to your computer and use it in GitHub Desktop.
"""
Pull Greater London Authority boundary definition (geojson) and derive the outer bounding box
"""
from operator import itemgetter
import json
import requests
r = requests.get('http://mapit.mysociety.org/area/2247.geojson')
coords = r.json()['coordinates'][0]
longitude = itemgetter(0)
latitude = itemgetter(1)
west = min([longitude(i) for i in coords])
north = max([latitude(i) for i in coords])
east = max([longitude(i) for i in coords])
south = min([latitude(i) for i in coords])
print(u'(({0}, {1}), ({2}, {3}))'.format(south, west, north, east))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment