1

Im trying to use the ArcGIS Python API to query a few results and gather the extent, I can query the results fine but as soon as I try to extract the extent I retrieve empty results.

Using one of the samples servers, heres my code:

import arcgis.gis
gis = GIS()

t = 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0'
layer = FeatureLayer(t, gis)

results = layer.query(where='1=1', return_extent_only=True) 

After I print results I get the following

{"features": [], "fields": []}  

Am I missing something? Seems all to easy up until this point.

2 Answers 2

1

The following code works for me:

from arcgis.gis import GIS
from arcgis.features import FeatureLayer
gis = GIS()

t = 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0'
layer = FeatureLayer(t, gis)

results = layer.query(where='1=1', return_extent_only=True)
print(results)

The only differences between our code are the import statements - maybe adjust those and retry?

0

Updating to 1.5.2 API Resolved the issue, must have been a bug

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.