# Link a view to a map component marker

**URL:** <https://forum.inductiveautomation.com/t/link-a-view-to-a-map-component-marker/89217>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [April 22, 2024, 3:36pm UTC](https://forum.inductiveautomation.com/t/link-a-view-to-a-map-component-marker/89217 "2024-04-22T15:36:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnau\_Pinyol\_Salva](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@Arnau\_Pinyol\_Salva](https://forum.inductiveautomation.com/u/Arnau_Pinyol_Salva)\
**Post date:** [April 22, 2024, 3:36pm UTC](https://forum.inductiveautomation.com/t/link-a-view-to-a-map-component-marker/89217/1 "2024-04-22T15:36:35Z")

</div>

I am making a view with the map component and I have added some markers on the map, when I link them so that when I click on them they each go to a different page, they all go to the same page. I have used a script inside the configure events in the component map. Does anyone know how I can do it?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 22, 2024, 4:37pm UTC](https://forum.inductiveautomation.com/t/link-a-view-to-a-map-component-marker/89217/2 "2024-04-22T16:37:00Z")

</div>

You'll need to share your script, as well as provide some clarification on what Event the script is attached to.

---

<div class="post-metadata">

**Author:** ![Arnau\_Pinyol\_Salva](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@Arnau\_Pinyol\_Salva](https://forum.inductiveautomation.com/u/Arnau_Pinyol_Salva)\
**Post date:** [April 23, 2024, 3:32pm UTC](https://forum.inductiveautomation.com/t/link-a-view-to-a-map-component-marker/89217/3 "2024-04-23T15:32:48Z")

</div>

This is the script:  
def runAction(self, event):  
system.perspective.navigate(view="Pantallas/Planta\_1")

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 23, 2024, 4:22pm UTC](https://forum.inductiveautomation.com/t/link-a-view-to-a-map-component-marker/89217/4 "2024-04-23T16:22:16Z")

</div>

You're mixing terms here, and you'll need to provide some clarification before we can help you any further.

What exactly do you want to happen when you click a marker?

I ask because you mention

> [@Arnau\_Pinyol\_Salva](#):
>
> so that when I click on them they each go to a different page

yet you've supplied a script which does View navigation. View navigation will not change your URL - it will only swap out the primary View in use for whatever you supply for the `view` kwarg.

Your original request also requested help in getting your marks to go to different pages (or Views), but your supplied script is hard-coded to go to the `Pantallas/Planta_1` View. Do you need to go to different Views, or do you need to go to that View while passing it parameters _based on the marker that was clicked_?

> [@cmallonee](#):
>
> what Event the script is attached to

You didn't answer this question. I'm going to assume this is in the `onMekerClick` Event. To make deterministic changes based on the clicked marker you'll need to reference `event.name`

```python
if event.name == "SomeMarkerName":
    # do something

```

or

```python
system.perspective.navigate(view="Pantallas/Planta_1", params={"name": event.name}

```

---

<div class="post-metadata">

**Author:** ![Arnau\_Pinyol\_Salva](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@Arnau\_Pinyol\_Salva](https://forum.inductiveautomation.com/u/Arnau_Pinyol_Salva)\
**Post date:** [April 24, 2024, 3:41pm UTC](https://forum.inductiveautomation.com/t/link-a-view-to-a-map-component-marker/89217/5 "2024-04-24T15:41:25Z")

</div>

I have solved the problem I had with your solution, thank you!

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 24, 2024, 9:30pm UTC](https://forum.inductiveautomation.com/t/link-a-view-to-a-map-component-marker/89217/6 "2024-04-24T21:30:41Z")

</div>

That's great! So what was the problem? Part of being a user on these forums is sharing solutions _and why that solution worked_.

---

<div class="post-metadata">

**Author:** ![Arnau\_Pinyol\_Salva](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@Arnau\_Pinyol\_Salva](https://forum.inductiveautomation.com/u/Arnau_Pinyol_Salva)\
**Post date:** [April 25, 2024, 12:33pm UTC](https://forum.inductiveautomation.com/t/link-a-view-to-a-map-component-marker/89217/7 "2024-04-25T12:33:11Z")

</div>

The problem I had is that I have a map with five markers, all 5 went to the same page when I clicked on them, but with the script provided:  
if event.name == "name.marker" :  
I have already made each marler go to one different view when you press it
