Customizing Individual Pop Ups

188
2
02-23-2024 07:55 AM
Labels (1)
ecasto17
New Contributor

I'm trying to customize pop ups and insert different URL's for different location pins on the map. I figured out how to insert the link, but it keeps showing up for all of the locations' pop ups, not just that particular location. Does anyone know if it's possible to customize each pop up and how I could do that?

0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor

You can create a url using the attributes from the feature. In this example, I'm creating a link using the feature's Site_ID field for an Arcade element. Since some of the features don't have an associated video, I have to check another field (VideoExists).

var output
var url = 'https://www.sample.com/'
if ($feature.VideoExists == "Yes") {
  output = `<a href="${url}${$feature.Site_ID}.mp4">Site ${$feature.Site_ID}</a> video`
}

return { 
	type : 'text', 
	text : output
}

Note that the code is building the url link with template literals, enclosed in backticks instead of the regular quotes

0 Kudos
BernSzukalski
Esri Frequent Contributor

Arcade is a good solution, but if you have unique URLs for the features, you could also store those as feature attributes and use them in the pop-up that way.

0 Kudos