Created
January 11, 2015 00:04
-
-
Save DenisCarriere/9fadaaf8f4b34a853741 to your computer and use it in GitHub Desktop.
City of Ottawa Geocode
This file contains 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
import requests | |
url = 'http://maps.ottawa.ca/ArcGIS/rest/services/compositeLocator/GeocodeServer/findAddressCandidates' | |
params = { | |
'SingleLine': '190 Forward Avenue', | |
'f': 'json', | |
'outSR': 4326, | |
} | |
r = requests.get(url, params=params) | |
results = r.json().get('candidates') | |
if results: | |
results = results[0] | |
score = results.get('score') | |
address = results.get('address') | |
x = results.get('location').get('x') | |
y = results.get('location').get('y') | |
print results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment