Hi there,
I have been using a script to extract attachments (photos) from a geodatabase and place them into folders named based on a field. However, these data "begin their lives" as attachments on a hosted feature layer on AGOL. Is there a script to automate the conversion of a hosted feature layer to FGDB and download it from AGOL? This would allow me to schedule and automate the entire process (which would be simply smashing!). Can anyone help me out?
Thanks,
Kevin Knight
Hi Kevin, this Esri Support KB article should provide a good start: How To: Back up hosted content by looping through and downloading hosted feature services in FGDB fo...
Hope this helps,
-Peter
Hi Peter,
I ran into this article and tried it out on my end, but I am having issues with the layers downloading onto my machine. I got it to at least export the data and commented out the delete line to make sure they export, but I can't figure out what I'm doing wrong to have it download locally. Do you have any guidance?
Hi @AFackler_NAPSG - what is the error message returned?
I would use a print statement on your path to make sure it's going to an actual location on your machine - additionally, are you running this locally in an ArcGIS Pro Python environment?
Thanks,
-Peter
Peter-
I was running it on PyCharm, but after running it on the Acrpy environment in Pro I was able to download the data locally. Thanks!
Hi Peter, I am running into this same issue. My folder path is correct, but the content does not download to my folder location. I am running this on ArcGIS Notebook within our ArcGIS Online Organization. I am assuming the Notebook can't access or understand my local machine folder path. Any advice to make this work?
Thanks,
Henry
Is there a chance for you to try it in a Jupyter notebook? As you stated, I think that ArcGIS Online Notebooks don't have access to overwriting local files. The code posted here works on Jupyter https://support.esri.com/en/technical-article/000022524, kindly let me know if it works.
Hi Peter,
I came across this Esri Support KB article and was wondering if there would be a way to modify it to download hosted feature services that are part of an Organization?
Thoughts?
Thanks,
Chuck
Hi @ChuckWerstak1 - absolutely. You will just need to modify the search query to create a list of items in your organization. This will just look like items = gis.content.search(query='') as the search is limited to only your organization by default. This great article by my colleague goes over the different options for searching for content with the API for Python.