1

I have a map series layout that displays all the photo attachments associated with each feature in a line feature class, housed in a file geodatabase. This line feature class is the index layer of the map series based on Route IDs. A line feature can have as little as 1 photo attachment or as much as 8 or 9. I also have a point feature class that represents each photo taken along each linear feature. So for example, Route N974 will have 3 point features with a field titled [pt_number] that represents photo 1 along the route, photo 2 along the route, and photo 3 along that route.

Currently, I have all the potential photo attachments in the layout manually labeled as 'Photo 1', 'Photo 2', etc., but I then have to manually add/remove photo labels in the layout for each map series page due to the variable number of photos attached to each feature. So to fix this, I am trying to write an Arcade expression that will dynamically label the photos so, for example, if there isn't a 4th photo attachment, that label just doesn't show up in the export and I can iterate through all features in one go without needing to make changes between map series pages. Currently, if there isn't a 4th attachment to fill that slot in the layout, no photo or anything appears in the export, which is also what I want the photo labels to do.

I am using a table attribute dynamic text element to do this, with the source table being that photo point feature class. But I cannot figure out the proper Arcade syntax to essentially select the nth element of the variable... And I probably am not stating/asking this correctly/accurately which is why I am having trouble finding a solution. Right now, I have this:

enter image description here

Where it is labeling all three photo points (result on the left), but I want to be able to tell it to just select the first element and just get 'Photo 1' for the first label, and so on. I feel like I should be able to write something like this (similar to how R works):

'Photo ' + $feature.pt_number[1]

Don't know if I am barking up the wrong tree here/if this is possible. Any other suggestions on how to solve this problem? Using ArcGIS Pro, version 3.1.0

1 Answer 1

1

If you are following the steps in Spatial map series and dynamic elements, then this lets a user add a picture and later access that. On the same page it explains how to use figure using the url (location of your file on the disk):

"https://" + $feature.DomainName + TextFormatting.BackwardSlash + $feature.URLFileName + ".jpg"

There should be a field on your data table where the url is stored, basically. Maybe you are already trying that, but it is hard to follow your question as it is not very well posed.

If you want to grab only the first photo you can use First():

First($feature.URLFileName) + ".jpg"

If you want to loop through them you need a function:

var photoname = 'test'
    for (var x in $feature.FID){
      photoname = photoname + TEXT(x) + '.jpg'
    }
return photoname
5
  • Ah sorry, I tried to pose the question clearly. The photo attachments are displaying correctly/as intended. It is the label I am trying to create for them that I also want to be dynamic and change with the photos. In this case I am using a field (pt_number) from another layer (point feature class) to try and populate labels for the photos in the layout.
    – keenwild
    Commented Mar 13, 2023 at 21:40
  • I'd create a text field in the point feature class with the labels and just use that as the photo label e.g. $feature.label. That way it will be tightly coupled.
    – ZZZ
    Commented Mar 14, 2023 at 18:51
  • This was my thought too and what I currently have set up ($feature.pt_number in the screen shot above). However the output of this includes all the numbers associated with the Route ID (the index layer for the map series), but I want to be able to define the number in the first position, the second position, etc.
    – keenwild
    Commented Mar 14, 2023 at 19:45
  • How about creating the index layer based on the points instead of the line feature? The issue is that your route ids are same for points on the same line feature. Maybe you can generate another field combining the route id and the point number and use that? e.g. RN974_1, RN974_2 etc
    – ZZZ
    Commented Mar 16, 2023 at 5:20
  • 1
    I unfortunately have to have the index layer based on the line feature. Only way to keep the entire line in the map frame. However, you are right that my issue is that the route IDs are the same for points on the same line feature. I ended up creating additional fields within the line layer to populate labels for the points dynamically. So thank you! Talking this out with you definitely helped.
    – keenwild
    Commented Mar 17, 2023 at 16:43

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.