Hey everybody, I have been using ArcGIS Pro for a bit and am finally in the process of getting everything on AGOL and utilizing collaboration efforts from different locations. I have a few questions, I appreciate all feedback.
1.) Once all my web layers are published from my file geodatabase, is there any use of still using a geodatabase? I know everything between using Collector and AGOL will save within the web layers and not touch the geodatabase right?
2.) What's the best SOP to backup AGOL layers in case something bad happens? Is there any automatic way to set this to download the web layers to a local source? Do you all prefer exporting data into GEOJSON's or does simply hitting the download button for AGOL map easier/better? (Source: How To: Back up content in ArcGIS Online )
Thank you all!
-Adam
Hi Adam Bourque,
1. You're right, everything is managed at the Web Layer level.
2. Per our documentation, you can download backups or used distributed collaboration to copy Hosted Feature Services to Enterprise: FAQ—ArcGIS Online Help | Documentation
I also recently published this Knowledge Base Article that shows how to automate FGDB downloads of Hosted Feature Services using the ArcGIS API for Python: How To: Back up hosted content by looping through and downloading hosted feature services in FGDB fo...
Hope this helps,
-Peter
Greetings Peter!
Adam and I work together in multiple AGOL environments. Great to see he reached out.
I have followed your guidance for the ArcGIS API for Python to back up hosted feature services and it worked great, except I don't want all of my entire contents to download.
I am struggling with the script to make it perform that exact workflow but only with features services in a particular AGOL folder and/or group.
I tried;
items = gis.content.search(query="type:Feature Service, owner:Username, group:Group Name", max_items=1000,) display(items) & items = gis.content.search(query="type:Feature Service, owner:Username, folder:Folder Name", max_items=1000,) display(items) Both run but return no results. I know it is something simple. Where can i find the correct naming conventions to have it query just a folder or group. Or do i need a new line of code in conjunction will yours? All are owned by me. Thanks,
Hey Ronald,
A good reference for constructing your search queries can be found here: Search reference—ArcGIS REST API: Users, groups, and content | ArcGIS for Developers
From that reference you will note that if we're we searching for items and want to return items form a particular group, we need to specify that group by it's ID instead of the group name or title. You could grab the group ID by browsing to the group in the browser and copy id parameter from the address bar of your web browser. Alternatively - if we wanted to do it all through code we could search for the group by title, and utilise the id property of the matching group object in our query that's searching the content.
group_name = "My Group Name"
group = gis.groups.search(query="title: {}".format(group_name))[0]
items = gis.content.search(query='type:"Feature Service", group:{}'.format(group.id))
Going back to that link I provided, you will also note that we don't have the option to restrict a search to a particular folder. We do however have an ownerFolder property on items that are returned from a search which specifies the folder an item resides in by its Id. So another we could approach this would be to firstly work out the ID of the folder we're interested in - again this could be done through the web browser, or via code - then get a list of all the Feature Service items that belong to a user and filter on that list using each items ownerFolder property.
username = "" # user that owns the Feature Services we're interested in
target_folder = "" # The name of the folder that contains Feature Services we're interested in
# Use a search to locate our user
user = gis.users.search(query=username)[0]
# Go through the user's folders and return the ID of the folder with a name/title that matches the target_flder we're looking for
folder_id = [folder['id'] for folder in user.folders if folder['title']==target_folder][0]
# Peform a search to return all feature services owned by our user
user_items = gis.content.search(query='type:"Feature Service", owner:{}'.format(username))
# Filter this down to only include items that have an ownerFolder that matches the folder_id determined above
items = [item for item in user_items if item.ownerFolder == folder_id]
Hope this helps!
Awesome response James!
I will give it a whirl. And thank you for the link and especially, the prompt response. If i run into any issues I will post again.
Is there a particular group in GeoNet that I should be following for guidance using Notebooks?
Hi Ronald,
If you are trying out ArcGIS Notebooks (beta) I would check out this community: ArcGIS Notebooks Beta - Online
For ArcGIS API for Python questions I would recommend this group: ArcGIS API for Python
Thanks,
-Peter