Skip to content

Instantly share code, notes, and snippets.

@robcowie
Created September 25, 2012 21:30
Show Gist options
  • Save robcowie/3784581 to your computer and use it in GitHub Desktop.
Save robcowie/3784581 to your computer and use it in GitHub Desktop.
Boundary of the Greater London Authority
"""
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