Issue?: Form Calculation and Attachments Exif Metadata - GPS Img Direction

638
2
10-11-2022 11:26 PM
AdminGIS2
New Contributor III

Hi,

I am trying to store the GPS Img Direction Exif tag of the first attachment of a feature in a field using a Form Calculation in Field Maps. I can test my Arcade expression successfully in the expression builder, but it does not seem to work in the Field Maps app. It evaluates to an error or to no value (--). I tried several approaches but the following (see below) works as a Field Calculation and (slightly adjusted) as a pop-up element. Just not as a Form Calculation.

if (Count(Attachments($feature)) > 0) {
var first_attachment = Attachments($feature, {"types":["image/jpeg", "image/jpg"], "metadata": true})[0]

for(var index in first_attachment["exifInfo"]) {
if (first_attachment["exifInfo"][index]["name"] == "GPS") {
    for (var index2 in first_attachment["exifInfo"][index]["tags"]) {
        if (first_attachment["exifInfo"][index]["tags"][index2]["name"] == "GPS Img Direction") {
            return first_attachment["exifInfo"][index]["tags"][index2]["value"]
        }
    }
}
}
} else {
    return 0
}

 I also tried using a different first if statement like so:

if($editcontext.editType == "UPDATE")

The problem might be that at creation of the feature there are no attachments added yet. I would assume (/hope) that after adding an attachment the statement would reevaluate, but this seems not the case. So one would think that at least an update of a feature might work as attachments are there after the initial insert with attachments (see above if statement). But to no avail.

Is this a bug? Am I missing something?

2 Replies
RyanMikulovsky
New Contributor II

In ArcGIS Pro 3.1, I think it is a bug. After successfully fetching the attachment array, I returned Text(some_attachment) and the array lacks the exifInfo property despite my options dictionary including "metadata":true

I confirmed the attachment photos have exif data by saving it to disk and interogating exif using image software.

0 Kudos
DanLissick
New Contributor III

Have you had luck solving this?

0 Kudos