2

I am seeking some ArcPy/Python help. I use the mobile app GIS Pro to collect data in the field, which allows me to export shapefiles containing a field called Photos, containing a list of names of photos associated with each feature. The list appears like this:

enter image description here

I am trying to create a tool that will

  1. Import the shapefile into a project geodatabase
  2. Add the features from the shapefile to a "master feature class"
  3. Update an attachment match table to include the photos associated with the new features
  4. Add the new attachments

I am struggling with step 3. There needs to be a new entry in the match table for each photograph. The match table contains the fields REL_OBJECTID & ATT_NAME. The REL_OBJECTID needs to coincide with the OID assigned to the feature after it has been merged into the "master feature class".

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked May 31, 2015 at 22:37

1 Answer 1

1

Forget about fields in attachment table, Arcgis add attachments tool will populate them for you. Based on field names I assume you are using arcgis. Create new table with 2 fields: name - text long enough to store "observatin 1" etc, path - text long enough to store folder name where you saved your pictures + photo name.

InsC=arcpy.da.InserCursor (abovetable, ("name","path"))

with da.searchcursor (shapefile, ("name","photos")) as cursor:

for name, alist in cursor:

 alist = alist.split (",")
 for photo in alist:
 R = (name, os.path.join (folderWpictures,photo))
 InsC.insertRow(R)

Use table as match table in add attacments tool to your fgdb feature class.

Caution: fix rotation of your pictures, before attaching them. I use infraview batch convert. It understands rotation of pictures taken by mobile device

answered Jun 1, 2015 at 1:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.