# Perspective Map - How to show View layer based on zoom?

**URL:** <https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [June 8, 2021, 12:57pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554 "2021-06-08T12:57:52Z")\
**Posts on this page:** 11\
**Page:** 1

<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:** [June 8, 2021, 12:57pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/1 "2021-06-08T12:57:52Z")

</div>

Can I show/hide a View layer (`props.layers.ui.view`) based on zoom? (Other that passing the zoom as a param to the view and hiding it in the view itself)

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [August 31, 2021, 1:33pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/2 "2021-08-31T13:33:02Z")

</div>

hell @nminchin I am trying to do something similar. Could you do it?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [August 31, 2021, 1:49pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/3 "2021-08-31T13:49:43Z")

</div>

not sure what he ment with zoom but you can create styleclass mediaquery. when the view exceeds a certain width (so zoom?) it will activate

ive used something like this before for a label. Unfortunalty there is no `display` style in the designer , so i just turned it invisible.  
if thats not enough you will have to use theme.css in addition to this to also do display:none  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/4/f442bf31e493a874fcf4681cdaec2c669023d048.png)

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [August 31, 2021, 1:52pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/4 "2021-08-31T13:52:09Z")

</div>

what are you trying to do exactly?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [August 31, 2021, 1:53pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/5 "2021-08-31T13:53:18Z")

</div>

me? helping you? xd

---

<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:** [August 31, 2021, 1:54pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/6 "2021-08-31T13:54:12Z")

</div>

Zoom as in the map’s zoom level. This isn’t exposed as a property as such, but you can expose it as a property by using an on change script to write the current zoom level into a custom prop (a bit vague, but I don’t have it in front of me). Media queries won’t help you/me here

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [August 31, 2021, 1:55pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/7 "2021-08-31T13:55:53Z")

</div>

oh persective MAP i see ups xD

---

<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:** [August 31, 2021, 1:57pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/8 "2021-08-31T13:57:23Z")

</div>

I think from memory I just ended up passing in the map’s zoom level into the template and I handled it in the template View… it’s not ideal but it works

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [August 31, 2021, 2:06pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/9 "2021-08-31T14:06:31Z")

</div>

I have this solution:

1-I have created a custom property ‘cuurentZoom’ on the map.

2-in the ‘onZoom’ event of the map put:

self.custom.currentZoom = event.zoom  
self.refreshBinding (“props.layers.ui.view”)

3-finally in UI view put a view based on currentZoom  
if zoom\<13:  
view 1  
else:  
view 2

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [August 31, 2021, 2:10pm UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/10 "2021-08-31T14:10:03Z")

</div>

thanks you

---

<div class="post-metadata">

**Author:** ![Abdelhak\_Sidi\_Ali\_Me](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/abdelhak_sidi_ali_me/32/72447_2.png) [@Abdelhak\_Sidi\_Ali\_Me](https://forum.inductiveautomation.com/u/Abdelhak_Sidi_Ali_Me)\
**Post date:** [February 8, 2025, 8:38am UTC](https://forum.inductiveautomation.com/t/perspective-map-how-to-show-view-layer-based-on-zoom/47554/11 "2025-02-08T08:38:19Z")

</div>

Another solution is to use a binding on the path that would refer to an empty view (coordinate container with height and width set at 0) when the view is supposed to be hidden. I guess that's not ideal either since it would mean the view gets re-rendered everytime the zoom changes.
