Select to view content in your preferred language

Replace string by symbol with multilines in pop up

70
0
Thursday
KARIMLABIDI
Frequent Contributor

Hello everybody,

I have lines and sometimes multilines in my layer with the name of the transport line, the end stop and the time of passage (ex: Lianes 5 vers Pessacc à 12h25). I search to replace the name of the lines by a symbol stored on my Arcgis Portal. It could be like that.

KARIMLABIDI_0-1761835049226.png

If necessary I can split the string and put the 3 values (line, end stop, time) in 3 fields.

I don't know what's the better: arcade or html with expression called.

I asked to Chatgpt who replied this code but it doesn't work (in french sorry).

// === TABLEAU DE CORRESPONDANCE LIGNE → ICÔNE ===
var icons = {
"A": ############################

"B": #################

.....
};

// === EXEMPLE : VARIABLES DU FLUX ===
// suppose que ta couche a des champs : Ligne, Terminus, Heure
var ligne = $feature.Ligne;
var terminus = $feature.Terminus;
var heure = $feature.Heure;

// === RÉCUPÉRER L’URL DE L’ICÔNE ===
var icon = DefaultValue(icons[ligne], "");

// === FORMATTER LE TEXTE HTML ===
var html = "";

if (icon != "") {
html += "<img src='" + icon + "' style='height:22px;vertical-align:middle;margin-right:6px;'>";
} else {
html += "<b>" + ligne + "</b> ";
}

html += terminus + " – " + heure;

return html;

 

If someone has an idea, I take it 🙂

Thank you!

 

0 Kudos
0 Replies