I would like to construct a python script to obtain JSON vector data from the following ArcGIS Rest Server:


For a WFSServer output for an ArcGIS Rest Server hosted by a different organisation, I am able to open the layer and view information about the data using the following Python code:

import ogr

url = 'WFS:http://idpgis.ncep.noaa.gov/arcgis/services/NWS_Observations/ahps_riv_gauges/MapServer/WFSServer'
ds = ogr.Open(url)
lyr = ds.GetLayer(1)
name = lyr.GetName()
print (name)

Is it possible to "open" the url of the JSON output of an ArcGIS Rest Server in the same way? For the NSW six maps ArcGIS Rest Server the following python code returns a "OSError: Could not open " error:

import ogr

url = 'http://maps.six.nsw.gov.au/arcgis/rest/services/sixmaps/LPIMap/MapServer/69/JSON'

ds = ogr.Open(url)

The following variations of the url also return a "OSError: Could not open " error:

url = 'JSON:http://maps.six.nsw.gov.au/arcgis/rest/services/sixmaps/LPIMap/MapServer/69/JSONServer'
url = 'http://maps.six.nsw.gov.au/arcgis/rest/services/sixmaps/LPIMap/MapServer/JSONServer'
url = 'JSON:http://maps.six.nsw.gov.au/arcgis/rest/services/sixmaps/LPIMap/MapServer/JSONServer'

1 Answer 1


I got OGR to open the dataset using the syntax from an example in the GeoJSON driver help:

from osgeo import ogr
url = "http://maps.six.nsw.gov.au/arcgis/rest/services/sixmaps/LPIMap/MapServer/69/query?where=objectid+%3D+objectid&outfields=*&f=json"
ds = ogr.Open(url)


ogrinfo -ro "http://maps.six.nsw.gov.au/arcgis/rest/services/sixmaps/LPIMap/MapServer/69/query?where=objectid+%3D+objectid&outfields=*&f=json"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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