-
-
Save sjg/a70aa77a4ca7a1d94123 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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