# Map Marker and Popup

**URL:** <https://forum.inductiveautomation.com/t/map-marker-and-popup/96017>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [September 16, 2024, 2:04pm UTC](https://forum.inductiveautomation.com/t/map-marker-and-popup/96017 "2024-09-16T14:04:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_MUSSO](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@Thomas\_MUSSO](https://forum.inductiveautomation.com/u/Thomas_MUSSO)\
**Post date:** [September 16, 2024, 2:04pm UTC](https://forum.inductiveautomation.com/t/map-marker-and-popup/96017/1 "2024-09-16T14:04:25Z")

</div>

Hello everyone,

I would like to display a popup when I click on a marker in my map. (no problem on that)

However, depending on the marker clicked, the title of my popup should be different.

Example:

```python
click on marker 1 -> popup title = marker 1 name
click on marker 2 -> popup title = marker 2 name

```

Since I can't configure events but only bindings on markers, I don't know how to do it.

I'm thinking of putting a script directly on the “map” object, but I don't know how to go about it.

Thanks in advance for your help. Have a nice day!

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [September 16, 2024, 2:17pm UTC](https://forum.inductiveautomation.com/t/map-marker-and-popup/96017/2 "2024-09-16T14:17:25Z")

</div>

I was working on a map a while ago with the help of @Transistor

In my understanding once you generate the markers dinamically with a binding the popups are also dinamic

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/a/fa22286ce2440c4fd956b151ca3334d2580b0d8b.png)

---

<div class="post-metadata">

**Author:** ![Thomas\_MUSSO](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@Thomas\_MUSSO](https://forum.inductiveautomation.com/u/Thomas_MUSSO)\
**Post date:** [September 16, 2024, 2:45pm UTC](https://forum.inductiveautomation.com/t/map-marker-and-popup/96017/3 "2024-09-16T14:45:11Z")

</div>

Hm, when i click on one of this marker:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/3/1353de6afd1e7d2f5afc565be3f7e3239afbf28a.png)

I want the name of the popup here:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/6/e630636e2a92b0034cdc9bed0eaae0da0dfc22d8.png)

Did you understand my problem?

So i try to it like that on my map event:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/2/724d1bf1fe65c4877d3ff9d5bee04fbe8309f467.png)

But I need “DO” to be dynamic depending on the marker I click on.

Any ideas ? Maybe by scripting insteagd of using the "popup" option ?

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [September 16, 2024, 2:57pm UTC](https://forum.inductiveautomation.com/t/map-marker-and-popup/96017/4 "2024-09-16T14:57:25Z")

</div>

Maybe you can adapt this script to your needs

```python
markers = []

for item in value:
    protoMarker = recursiveCopy(self.custom.sampleMarker)
    protoMarker['lat'] = item['latitude']
    protoMarker['lng'] = item['longitude']
    s = getStatus(item['name'])
    tecnico = getTecnico(item['name'])
    alert = getAlert(item['name']) # Get alert status

    protoMarker['tooltip']['content']['text'] = (
        item['name'] + ': ' + statusMessages[int(s)] + ' - Tecnico: ' + tecnico
    )
    

    protoMarker['popup'] = {
        'content': {
            'text': f"<b>Name:</b> {item['name']}<br>{statusMessages[int(s)]}<br><b>Tecnico:</b> {tecnico}"
        }
    }
    
    markers.append(protoMarker)

return markers

```
