4

I need to consume data from a REST endpoint that returns features in geojson format within a model in ArcGIS 10.2. Is there a way to access a URL instead of opening a file?

If there is no way to access a URL directly, would this require a custom python script to access the URL and save it to a local file, or is there a better way?

2

I ended up using a simple python script converted into a Tool:

import urllib2, arcpy

url = arcpy.GetParameterAsText(0)
path = arcpy.GetParameterAsText(1)

response = urllib2.urlopen(url)
localFile = open(path, 'w')
localFile.write(response.read())
localFile.close()

There may be a more elegant solution but this works for now. It would be easy enough to have the script convert the geojson to a featureset but with this generic download tool any data type can be retrieved in a model then converted as needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.