AnsweredAssumed Answered

FeatureSet() .load Cannot open table for Load

Question asked by jamesfreddyc Champion on Jul 17, 2019
Latest reply on Jul 19, 2019 by jamesfreddyc

I've got the results of a map service query urlib2.Request setup as 

 

jsonResult = json.load(response)

 

From this I am attempting to setup an in_memory FeatureSet() but it is failing when fs.load(jsronResult) with "RuntimeError: RecordSetObject: Cannot open table for Load".

 

The odd thing is this works if I write the jsonResult to a local .json file and then issue arcpy.JSONToFeatures_conversion() with the same exact contents as the jsonResult payload.

 

Anyone have similar scenario?  Must be something simple I'm missing here.


Thanks!

 

 

qryLandUseURL = 'https://SomeAGSurl/MapServer/0/query'

qryLandUseParams = urllib.urlencode({'f': 'pjson','geometryType': 'esriGeometryPolygon','geometry': inGeometry,'spatialRel': 'esriSpatialRelIntersects','outFields': flds,'returnGeometry': 'true'})

qryLandUseReq = urllib2.Request(qryLandUseURL, qryLandUseParams)

response = urllib2.urlopen(qryLandUseReq)
jsonResult = json.load(response)

fs = arcpy.FeatureSet()
fs.load(jsonResult)

 

Edit: my original implementation works when I set the fs.load() to the url of the map service like this:

 

rquery = "?where={}&outFields={}&returnGeometry=true&f=json".format(rwhere, rflds)
rqueryfsURL = rtaburl + rquery
rfs = arcpy.FeatureSet()
rfs.load(rqueryfsURL)

 

But I need it to have an input geometry and spatialRel type instead of a simple WHERE clause.

Attachments

Outcomes