I am trying to download feature service items from ArcGIS online to then clip to my project area, add specific fields using ArcPY and then upload to AGOL overwriting specified layers.
I'm following the instructions as per this tutorial:
https://support.esri.com/en-us/knowledge-base/how-to-download-feature-service-items-from-arcgis-onlin-000018909
# define the download format and the specified output path
# path = my_test_path ## changed for forum post
def downloadUserItems(owner, downloadFormat):
try:
# Search items by username
# items = gis.content.search('owner:{0}'.format(owner))
# print(items)
# search items by group
group = gis.groups.search("title:ArcGIS API Test", max_groups=15)[0]
items = group.content()
print(items)
# Loop through each item and if equal to Feature service then download it
for item in items:
print(item.type)
# if item.type in ['Feature Service', 'Vector Tile Service', 'Scene Service']:
result = item.export('sample {}'.format(item.title), downloadFormat, wait =True)
result.download(path)
# Delete the item after it downloads to save space (OPTIONAL)
# result.delete()
print("Exported item: {}".format(result))
except Exception as e:
print(e)
# Function takes in two parameters. Username and the type of download format
downloadUserItems('dsfgis', downloadFormat='Shapefile')
And getting this error.
[<Item title:"Storm_Feature" type:Feature Layer Collection owner:dsfgis>]
Feature Service
Could not export item.
I've gone through the
documentation on the Item class. Any ideas/help appreciated.