Hello,
I am looking to create a spatially enabled dataframe from a FeatureSet with the ArcGIS API for Python.
I have always:
- Created a FeatureLayer object
- Used .query(where="whatever") to return a feature set,
- Used the .sdf property to create the dataframe.
Today the sdf property doesn't work, .query() is returning a plain dictionary instead of a FeatureSet. Passing as_df=True also returns a dict.
Right now, I am still able to create a SEDF by feeding that same dict to FeatureSet.from_dict().sdf. So it seems like .query() just isn't routing through it.
Pro 3.7.2, stock conda env. The layer is a MapServer sublayer (capabilities: Map,Query,Data) and type() confirms it's a FeatureLayer.
Has anyone seen this, do MapServer sublayers behave differently here?
from arcgis.features import FeatureLayer, FeatureSet
url = r"https://gis.example.com/arcgis/rest/services/Parcels/MapServer/0"
lyr = FeatureLayer(url)
result = lyr.query(where="CITY_NAME='EXAMPLE CITY'")
print(type(result)) # <class 'dict'>
result_df = lyr.query(where="CITY_NAME='EXAMPLE CITY'", as_df=True)
print(type(result_df)) # <class 'dict'>
sdf = FeatureSet.from_dict(result).sdf
print(type(sdf), sdf.shape) # <class 'pandas.DataFrame'> (100, 10)