Bulk export photos from Collector

4052
5
08-28-2017 12:12 PM
Status: Open
ErinSnook
New Contributor II

We collect scientific data at remote sites and just started using Collector to take multiple photos for each site.  It's nice that we can use our field device to see the photos when we go back for re-visits, but we need to be able to bulk download all of the photos we collect for each site, with unique site IDs, to save and use them on our computers. Currently, the only option available to us is to save photos one by one to our device (iPad) photos app, then move them to the computer via USB connection. It would be ideal if ESRI could provide functionality with ArcGIS Online hosted feature services to export photo attachments.

5 Comments
TiffanyTuro

Hi Erin,

I have a script that will do this.  I export the fgdb to arcmap, then perform a join and rename the attachments from the joined table, then export the attachments using the script.  It is definitely easier than one by one, and keeps the naming convention you choose.  For multiple photos at same site, it names them the same but adds a sequential number at the end.  Let me know if you want more info, as this is kind of an old post, you likely have a solution already.

by Anonymous User

Can you post more information on how I can access your script to bulk export of photos from Collector AGOL?

ScottDorsey

I was just working with support and was provided the attached python script for bulk download of attachments. 

1. Download the hosted service to a FGDB

2. Open FGDB in ArcMap

3. Create a toolbox item

4. Copy script into the toolbox

import arcpy
from arcpy import da
import os

inTable = arcpy.GetParameterAsText(0)
fileLocation = arcpy.GetParameterAsText(1)

with da.SearchCursor(inTable, ['DATA', 'ATT_NAME', 'ATTACHMENTID']) as cursor:
      for item in cursor:
            attachment = item[0]
            filenum = "ATT" + str(item[2]) + "_"
            filename = filenum + str(item[1])
            open(fileLocation + os.sep + filename, 'wb').write(attachment.tobytes())
            del item
            del filenum
            del filename
            del attachment

by Anonymous User

The following articles include a sample script to export attachments in bulk from ArcMap and ArcGIS Pro via Python

How To: Batch export attachments from a feature class in ArcMap 

How To: Batch export attachments from a feature class in ArcGIS Pro 

WöselThoresen1

TiffanyTuro, I'd be very interested in your script for renaming the attachments!