Getting exifInfo with arcade

310
1
Jump to solution
11-28-2023 08:51 AM
Labels (1)
mikAMD
by
Occasional Contributor II

I wish to extract exif metadata (lat and long) from pictures taken and uploaded to a feature service on AGOL from a Survey123 form. I know I can do this directly in the XLSForm by using the pulldata("@exif") function, but I would prefer not adding more columns to my table (plus, the number of pictures that a user can take is multiple so I don't know how I would deal with the ensuing unknown multiple coordinates).

So I was thinking more of extracting the exif metadata with arcade (either in map viewer or dashboard), with attachments(value).exifInfo in a loop. I'm able to retrieve other metadata (name, id, contentType, and so on), but exifInfo seems to always be empty.

Searching a bit, I stumbled upon this thread which is based on HEIC format pictures. I thought this could be my case too, because workers on the field use iPads. However, I just tried sending out a form with a picture taken on an Android device and I have the same problem.

When I download the pictures (either taken from Android or iPad/iOS) from AGOL to my computer, the location is indeed present in the metadata. So my guess is i'm not using the attachments() function correctly.

For other metadata I do:

 

var features = [];
var att = attachments(e); //where e is $feature or is another var from a loop in a layer/table
if (count(att) > 0) {
    for (var a in att) {
        push(features, att[a].name) //works
        //push(features, att[a].exifInfo) >> always empty
        //also tried looping through att[a].exifInfo or manually att[a].exifInfo[0], att[a].exifInfo[1] and so on...
   }
return features;

 

Any idea what i'm doing wrong?

Thanks for your help!

0 Kudos
1 Solution

Accepted Solutions
mikAMD
by
Occasional Contributor II

Ended up contacting support and they provided the answer I was looking for.

I had to use parameter "metadata""metadata (Optional): Boolean - Indicates whether to include attachment metadata in the function return. Only Exif metadata for images is currently supported"

 

var att = attachments(e, {metadata: True});

 

Then I had to loop through a couple of dictionaries inside exifInfo but with trial and error I got the GPS coordinates.

View solution in original post

0 Kudos
1 Reply
mikAMD
by
Occasional Contributor II

Ended up contacting support and they provided the answer I was looking for.

I had to use parameter "metadata""metadata (Optional): Boolean - Indicates whether to include attachment metadata in the function return. Only Exif metadata for images is currently supported"

 

var att = attachments(e, {metadata: True});

 

Then I had to loop through a couple of dictionaries inside exifInfo but with trial and error I got the GPS coordinates.
0 Kudos