# Linking perspective map icons to pages?

**URL:** <https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 7, 2022, 4:34am UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605 "2022-07-07T04:34:17Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Gott](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@Benjamin\_Gott](https://forum.inductiveautomation.com/u/Benjamin_Gott)\
**Post date:** [July 7, 2022, 4:34am UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/1 "2022-07-07T04:34:17Z")

</div>

Hi all, I need to know how to make map icons link users to another page on mouseclick. Is this doable?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 7, 2022, 5:14am UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/2 "2022-07-07T05:14:15Z")

</div>

I assume by “map icon” you mean a marker?

Use the `onMarkerClick` map event handler to do the stuff you want

---

<div class="post-metadata">

**Author:** ![Benjamin\_Gott](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@Benjamin\_Gott](https://forum.inductiveautomation.com/u/Benjamin_Gott)\
**Post date:** [July 7, 2022, 5:27am UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/3 "2022-07-07T05:27:08Z")

</div>

I did see that in the literature when I was learning about maps, but I’m very green and I don’t know how to implement it. I don’t see that listed in the marker parameters.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 7, 2022, 5:32am UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/4 "2022-07-07T05:32:20Z")

</div>

This is what you get from the onMarkerClick `event` object:

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

```auto
{
  "lng": -121.156711578,
  "name": "bob",
  "properties": {},
  "lat": 38.658169172
}

```

So then you can do whatever you want to do with that info, e.g.

```auto
system.perspective.navigate(page=event.name)

```

---

<div class="post-metadata">

**Author:** ![Benjamin\_Gott](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@Benjamin\_Gott](https://forum.inductiveautomation.com/u/Benjamin_Gott)\
**Post date:** [July 7, 2022, 5:33am UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/5 "2022-07-07T05:33:19Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![Benjamin\_Gott](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@Benjamin\_Gott](https://forum.inductiveautomation.com/u/Benjamin_Gott)\
**Post date:** [July 7, 2022, 4:55pm UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/6 "2022-07-07T16:55:58Z")

</div>

Still having a hard time with this. I don’t have my marker defined under CUSTOM, but under Props/Layers/UI/Marker. I’ve got the name of the marker set as the path I want to navigate to, and the first line in my script as

`self.props.layers.ui.marker = event`

and the second as  
`system.perspective.navigate(page=event.name)`  
When I click on a map marker it does navigate, but to a page that can’t be displayed. “View Not Found  
No view configured for this page”

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [July 7, 2022, 8:43pm UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/7 "2022-07-07T20:43:44Z")

</div>

@Benjamin_Gott did you configure the script as show in @nminchin picture’s?

---

<div class="post-metadata">

**Author:** ![Benjamin\_Gott](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@Benjamin\_Gott](https://forum.inductiveautomation.com/u/Benjamin_Gott)\
**Post date:** [July 7, 2022, 9:03pm UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/8 "2022-07-07T21:03:30Z")

</div>

Yes, I think so, but like I mentioned, since I’m using the marker element from the map tree under props, I have line 2 done a little differently. I’m not sure what to do with the code in curly brackets in @nminchin’s second post.

![Capture](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/8/f84e677e9ec00a758437ac837b032216f41a3b66.png)

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [July 7, 2022, 9:32pm UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/9 "2022-07-07T21:32:07Z")

</div>

@nminchin’s code `self.custom.marker = event` just assigns the event value to a property where you can see what is in the event that you have available in the runAction script. You don’t actually want to assign the event to the marker. In other words; delete that line from your action.

For navigation line, see [system.perspective.navigate - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.perspective.navigate). To work as written, the marker’s name needs to be an exact match to the page URL you have setup for the view. See [Pages in Perspective - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Pages+in+Perspective#PagesinPerspective-PageURLs). If you haven’t setup a page URL for the view, you won’t be able to navigate to it.

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [July 7, 2022, 9:33pm UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/10 "2022-07-07T21:33:19Z")

</div>

So its not exactly what you should type. He is just trying to show a method to do what you want.

I’m not super familiar with perspective and can often be wrong lol, but I will try.

One thing I’m not a fan of is you defining a variable inside where you are declaring a param to pass.

I would declare it outside and just past the variable into the ()  
so instead of `system.perspective.naviagte(page=event.name) it would be page = event.name system.perspective.navigate(page)` not sure that it makes a difference Listen to @witman above.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Gott](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@Benjamin\_Gott](https://forum.inductiveautomation.com/u/Benjamin_Gott)\
**Post date:** [July 7, 2022, 9:49pm UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/12 "2022-07-07T21:49:39Z")

</div>

Thanks for your attention to this. I have copied the path from the project browser to the name of the marker and changed the script as you described but still no success. I even tried [http://google.ca/](http://google.ca/) as a marker name and still no dice. See attached:

 ![1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/6/26d1eb6c99de4fcae87587b2904863f2e17f697e.png)  
 ![2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/f/6ff4538905107070d2567d653f50e82331008320.png)

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [July 7, 2022, 9:54pm UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/13 "2022-07-07T21:54:08Z")

</div>

> [@Benjamin\_Gott](#):
>
> I have copied the path from the project browser

You need to setup a page URL per [Pages in Perspective - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Pages+in+Perspective#PagesinPerspective-PageConfiguration).

Also note per documentation linked [above](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/9) you need to use this function differently for the web URL you're testing (note "url =" rather than "page ="):  
`system.perspective.navigate(url = "http://www.google.ca")`

---

<div class="post-metadata">

**Author:** ![Benjamin\_Gott](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@Benjamin\_Gott](https://forum.inductiveautomation.com/u/Benjamin_Gott)\
**Post date:** [July 7, 2022, 9:58pm UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/14 "2022-07-07T21:58:07Z")

</div>

No, I wasn’t using the URL I was using the path because I saw that its best to label your markers according to path in another doc.

After setting the marker name to the URL `/charts` instead of the path `Page/Charts` things are now working.

You have my sincerest thanks, have a great rest of your day.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 7, 2022, 10:28pm UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/15 "2022-07-07T22:28:38Z")

</div>

> [@andrews](#):
>
> I would declare it outside and just past the variable into the ()  
> so instead of `system.perspective.naviagte(page=event.name) it would be page = event.name system.perspective.navigate(page)`

I definitely agree with this and I do this myself mainly to keep the function call as short as possible, but my example was just trying to keep it as _simple_ as possible 😅

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [July 8, 2022, 12:27am UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/16 "2022-07-08T00:27:20Z")

</div>

There actually is an important difference, which isn’t related to perspective.

The first example would be using a keyword argument, which (arguably 🤔) wouldn’t matter in this case. It isn’t actually assigning a value to a variable but is telling the function to use the value for the page argument.

```auto
system.perspective.navigate(page=event.name)

```

The second example does actually do a variable assignment

```auto
page=event.name
system.perspective.navigate(page)

```

A third way to do this would be to just pass `event. name`

```auto
system.perspective.navigate(event.name)

```

All three are functionally equivalent, with the exception that in the second example you now also have a page variable that could be used later on in the script.

Keyword arguments are an important concept in python (and some other languages). An example of where you would use one is setting the `getKey` argument in `system.db.runPrepUpdate()` without also providing other arguments, such as the transaction argument.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 8, 2022, 4:58am UTC](https://forum.inductiveautomation.com/t/linking-perspective-map-icons-to-pages/61605/17 "2022-07-08T04:58:44Z")

</div>

Derp, yes, I would use:

```auto
page = 'path/.../...'
system.perspective.navigate(page=page)

```

Lazy replying gets me in trouble!
