I was hoping to find a sample that uses arcgis.extract_data
This post is similar, but looks like the op ended up using ArcPy.
Have tried a few things:
from arcgis.gis import GIS
from arcgis.features.manage_data import extract_data
gis = GIS("https://mydevplan.maps.arcgis.com/","un","pw")
waze_hfs_item = gis.content.get('5c80a03f09154b2bb845f986dce325cd')
waze_alerts_layer = waze_hfs_item.layers[0] # REST Endpoint for layer returned
# outputGDB = arcgis.extract_data(['Alerts']) # Exception: Job failed.
# outputGDB = arcgis.extract_data(waze_hfs_item) # Exception: Job failed.
outputGDB = arcgis.extract_data(waze_alerts_layer) # TypeError: 'FeatureLayer' object is not iterable
I believe all I really need to supply to extract_data is :
input_layers :Required list of strings
Was wondering if someone could point me to a working sample that leverages extract_data. I am sure this is a simple one.
outputFGDB = extract_data(waze_hfs_item.layers, output_name="Waze_Extract", data_format="FILEGEODATABASE")
outputFGDB.download('C:\\Workings\\waze_analysis')
The above works in downloading all of the layers from the hosted feature service to a shapefile.
If I refer to the credits page:
What does not require service credits?
- Exporting data stored in ArcGIS Online.
However, I can confirm that using extract_data does indeed use credits. Is this a bug?
As we are doing this on a daily basis, using credits for exporting our data is not going to be feasible. Was hoping to take the Extract path over using SYNC/CreateReplica.
Using createreplica gets around the credits issue, but the service needs SYNC enabled (which has more overhead for publisher when compared to Extract).
replica = waze_flc.replicas.create(replica_name = 'Waze_Download',
layers = '0',
data_format = 'filegdb',
out_path = './download')