Export Data ArcGIS Online

676
5
07-04-2022 03:13 AM
JosephHilliard94
New Contributor III

Hi there,

I am having issues with exporting large feature layers from ArcGIS Online to a geodatabase (there are ALOT of attachements). When I export from the export data button on ArcGIS Online it gives up and corrupts the geodatabase locally or when I try and export using the ArcGIS API for Python it gets stuck. Does anyone have a better solution of exporting their hosted feature layer data to a local drive so they can re-publish?

Thanks!

Joe

5 Replies
Clubdebambos
Occasional Contributor III

Hi @JosephHilliard94 

I have had similar issues in the past and used a combination of ArcPy and ArcGIS API for Python. Do you have access to ArcGIS Pro with a Standard/Advanced licence?

The workflow goes like this....

  • Use ArcPy to create a file geodatabase (or have this already created)
  • Use ArcPy to export layers from AGOL to a feature class; maintain globalid, do not maintain attachments. This will export the attributes and geometry only. The feature class to feature class tool requires the layer url as input. You can also perform this step manually in ArcGIS Pro.
  • Use ArcPy/ArcGIS Pro to Enable Attachments
  • Use ArcGIS API for Python to download attachments from AGOL and create a CSV match table as it does. This is the only part of the workflow that cannot be done manually.
  • Use ArcPy/manually use Add Attachments tool to add photos back to features.

You have now reassembled an attachment laden feature layer as a feature class in a file geodatabase.

If you have the means to do the above I have code lurking around somewhere Ill dig out and share with you.

~ learn.finaldraftmapping.com
Katie_Clark
MVP Regular Contributor

I always use this workflow when downloading feature layers, the export button has never worked for large file geodatabases for me.

https://support.esri.com/en/technical-article/000014156 

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
RhettZufelt
MVP Frequent Contributor

I often use arcpy.management.Append with preserve GlobalID's to append to local FGDB and/or SDE data.

Not the fastest, but seems to always finish, and the attachments come along with it.

Normally, I am appending to the same FC that I used to create the empty hosted layer, so all the fields, attachment table, etc. match.

R_

 

Clubdebambos
Occasional Contributor III

I have often used this solution too but found on many occasions it timed out and only a subset appended. I found running this tool in chunks of a couple of thousand records each with around 5 1MB attachments worked great without any timeouts 

~ learn.finaldraftmapping.com
RhettZufelt
MVP Frequent Contributor

Thanks, guess I haven't hit the limit yet, but will keep this in mind if/when I do.

R_