In AGOL you can export a layer to Shapefile, but I can't do it with the API for Python. I have only achieved it with some layer, passing through CSV, but it gives me many errors (text fields that pass to numeric, or layers that do not find the delimiter).
Can someone help me?
Thank you very much
An arcgis Item has an export method that will save to another format. For example:
from arcgis.gis import GIS gis = GIS(username='name', password='pass') item = gis.content.get('ITEM_ID') item_shp = item.export(title='item_shapefile', export_format='Shapefile') # item_shp is stored on AGOL, it can be downloaded locally if desired item_shp.download()
Yes, you can query the features you want, access the SpatialDataFrame, and export to a shapefile. For example:
layer = item.layers features = layer.query('created_date >= CURRENT_TIMESTAMP - 7') features.sdf.spatial.to_featureclass('./output.shp')
The output shapefile will be saved locally in this case.