Select to view content in your preferred language

Download Zipped File Geodatabase on ArcGIS Online through API

2333
1
04-19-2018 11:40 AM
deleted-user-iWc3EQwf6ke7
Deactivated User

Hi folks,

I was trying to download a hosted feature layer by using the ArcGIS Python API.

The workflow I followed is to export the layer as a file geodatabase first, then search for its itemID by using 'content.search()' and finally using the 'get_data()' to download the FGB to the temp file path.

However, the problem is that the script is not stable (I think it may be a bug) because with the exact code, sometime it would download the exported FGB with only 1 KB in size, while the rest of time it would download FGB with the correct size. I cannot find the problem because everything seems work perfectly when I test the code out in Jupyter Notebook, until the very last step where I try to download the exported FGB.

Any help would be appreciated! 

The followings are a subset of my script:

anno_gis = GIS(url, user_name, password)
wildlife = anno_gis.content.get(item_id)
tod_date = datetime.date.today()
date = tod_date.strftime('%Y%m%d')
title = "Wildlife_FGB_" + date
wildlife.export(title,'File Geodatabase', parameters=None, wait='True')
search_fgb = anno_gis.content.search(query = "title:{}*".format("Wildlife_FGB_" + date))
search_fgb[0]

fgb_item_id = search_fgb[0].id 
fgb = anno_gis.content.get(fgb_item_id)
temp_fgb= fgb.get_data() 

fgb.delete()
1 Reply
by Anonymous User
Not applicable

Even though the user account of the person who posted this question is deactivated, an answer can be found from this post https://community.esri.com/thread/208467-download-feature-service-as-file-geodatabase 

0 Kudos