Select to view content in your preferred language

Slow Attachment Downloads from AGOL Feature Layer (photos collected with Field Maps)

672
3
11-15-2022 04:25 PM
Silas_Mathes
New Contributor

Hello,

We've been using Field Maps (Collector) since 2019 to document our fieldwork with points and photo attachments. The field data are stored/hosted in ArcGIS Online Feature Layers. Our workflow is to collect the data to AGOL and then use an arcpy script to download the photos locally. Starting around August, the download time for each photo attachment (typically either 200KB or 900KB, depending on the Field Maps photo resolution setting) slowed to around 30 seconds.  Previously the download time was around 2-3 seconds per attachment.  We can collect several hundred photos for large sites, and downloading our photos now takes hours of time. 

Has anyone else experienced slow attachment downloads from AGOL Feature Layers?  If so are you just living with the delay, or did you find a work around?

We've tested various internet connections at home and in the office and double-checked our scripts, which utilize the following code snippet:

from arcgis.gis import GIS
gis = GIS("URL", "username","password")
search_result = gis.content.search("AGOL LAYER", "Feature Layer")

feature_layer_collection = search_result[1]
feature_layer = feature_layer_collection.layers[0]

feature_layer.attachments.download(oid=XXXXXX, attachment_id=XXXXX)

 

Thanks for any help!

 

Silas Mathes

Davey Resource Group, Nashville, TN   

0 Kudos
3 Replies
ArcDevelopment
Emerging Contributor

Did you ever get an answer to this? Im finding that a single 1.7MB png takes around 12 seconds to download which is really slowing our software.

0 Kudos
SilasMathes
New Contributor

We haven't experienced the slowdown since we started with fresh, empty AGOL hosted feature layers to collect our data/photos around January of this year. Our hosted layers are building back up in size (biggest currently has around 500 attachments) as we collect field data, so I'll update you if we experience slow downloads again.  How many records/attachments are already in your hosted layers?    

0 Kudos
sakurai
New Contributor

The attachment download method is very time consuming. (ArcGIS API for Python 2.3.0)
So I implemented attachment download using REST API.

for feature in features:
    attachments = fLayer.attachments.get_list(oid=feature.attributes[oidField])
    for attachment in attachments:
        attachmentUrl = "{0}/{1}/attachments/{2}".format(inputRecordSet["url"], feature.attributes[oidField], attachment["id"])    
        response = requests.get(attachmentUrl, params={
            "token": gis._con.token
        })
        attachement_path = os.path.join(attachement_dir, attachment["name"])
        with open(attachement_path, 'wb') as saveFile:
            saveFile.write(response.content)
0 Kudos