Is it possible to show layer id in a popup's template ?
layer expression:
{name: "layer",title: "layer",expression: "$layer.id"}https://codepen.io/michaelk95/pen/NWwyxyE
Hi @MichaelK1 -
You could access the layer ID of the current selected feature by creating your content from a function like this:
layer.popupTemplate = { title: "{ObjectId} | {length}", expressionInfos: [{ name: "length", expression: "$feature.length" }], // Create content from function and refernece the feature's layer id content: ((event) => { return `{length} | ${event.graphic.layer.id}`; }) };
You can still reference expressions within the function as well. Here's an updated codepen: https://codepen.io/laurenb14/pen/gOzLExz?editors=1000
Hope this helps!
The global name "$layer" is misleading. It actually represents the FeatureSet of all features in the same layer as the Popup's feature:
ArcGIS Arcade > FeatureSet
I suggest adding a feature attribute for the id/title.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.