Skip to content

Instantly share code, notes, and snippets.

@DenisCarriere
Created January 11, 2015 00:04
Show Gist options
  • Save DenisCarriere/9fadaaf8f4b34a853741 to your computer and use it in GitHub Desktop.
Save DenisCarriere/9fadaaf8f4b34a853741 to your computer and use it in GitHub Desktop.
City of Ottawa Geocode
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