Extracting feature service attachments to image files, and retaining the order per feature

09-10-2019 09:45 AM
New Contributor II

I'm wondering if anyone has a process or a script they use, that is capable of not just extracting the attachments from the attachments table blob field, but also retaining the respective order the photos were taken for each feature, and populating those image names into their correct fields for the feature class (ie: feature photo, defect 1, defect 2, etc.).  

Currently, my process involves a python script that strictly just exports the attachments to JPG files, and builds the image name from the attachment table data.  From there I do a series of joins between the feature class table, and the attachment table, and through the process of elimination, and rejoining, populate the newly extracted image names into a number of image name fields in the feature class table until I run out of un-matched values in my attachments table.  

My issue with this process though, is that the process of joining my feature class to the attachments table to populate the image names in my image name fields, loses the original order the attachments were taken in the web app.  Each time I join, it gives me the first match the software finds, which appears to be completely random.  So say if you had a feature picture as the first photo taken, and the following two photos were defect 1, and defect 2, this may or may not get all jumbled up in the process of populating my photo names into a feature class field.

I'm hoping its simply a matter of sorting my attachments table by a certain field to get them in the correct order prior to joining to the featureclass?

Any insight or suggestions would be much appreciated.

0 Kudos
0 Replies