Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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