Created
September 18, 2015 17:13
-
-
Save MarieAshley/657ac27e91665c235c03 to your computer and use it in GitHub Desktop.
ArcGIS Online Geocode Service
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
from agol import AGOL | |
class geocodeService(AGOL): | |
"""Geocode Service object, that inherits properties from the AGOL object.""" | |
def geocodeAddresses(self): | |
""" | |
The geocodeAddresses operation is performed on a Geocode Service resource. \ | |
The result of this operation is a resource representing the list of geocoded addresses. \ | |
This resource provides information about the addresses including the address, location, score, and other geocode service-specific attributes. | |
http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000s6000000 | |
""" | |
url = "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/geocodeAddresses" | |
data = {'token': self.token, | |
'f': 'json', | |
'sourceCountry': 'US', | |
'addresses': {'records': | |
[{'attributes': {'OBJECTID': 1, | |
'SingleLine': '380 New York St., Redlands, CA, 92373'}}, | |
{'attributes': {'OBJECTID': 2, | |
'SingleLine': '1 World Way, Los Angeles, CA, 90045'}}]}} | |
jsonResponse = self.sendRequest(url, data) | |
return jsonResponse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
geocodeService.py needs agol.py, also found in this gist. Example usage: