Hello!
I am using ArcGIS for Python to save some sub layers in a hosted feature service to a feature geodatabase.
My code is as follows:
feature_layer_item = gis.content.get("xyz")
layer = feature_layer_item.layers[0]
featureSet = layer.query()
featureSet.save(arcpy.env.workspace, "MyLayer")
This works perfectly except when there are no features in the layer. If that's the case then the save function creates a table in the fgdb instead of an empty polygon feature class. If I add a bogus record to the layer and execute the same tool, a polygon feature class is created.
Has anyone encountered this? I assume it's because the query returns an empty feature set. I have tried setting the spatial_reference and geometry_type on the feature set, which looks like it should be possible but no luck.
Anybody have a workaround?
Thanks!
Jill