# Zoom to Location on ui-Worldmap

**URL:** <https://discourse.nodered.org/t/zoom-to-location-on-ui-worldmap/55417>\
**Category:** Dashboard\
**Tags:** node-red-dashboard\
**Created:** [19 December 2021 03:44 UTC](https://discourse.nodered.org/t/zoom-to-location-on-ui-worldmap/55417 "2021-12-19T03:44:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zane](https://avatars.discourse-cdn.com/v4/letter/z/c4cdca/32.png) [@zane](https://discourse.nodered.org/u/zane)\
**Post date:** [19 December 2021 03:44 UTC](https://discourse.nodered.org/t/zoom-to-location-on-ui-worldmap/55417/1 "2021-12-19T03:44:20Z")

</div>

I am trying to map my family phones on a ui-worldmap.

I have them mapping ok. But I would like to change the zoom and location so they all fit in the screen.

I cant work out if this is possible.

I thought this would do it, but it seems to have no affect.

msg.payload.command = {};  
msg.payload.command = {map: {

```
"fit": true,
"clickable": false

```

}  
};

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 December 2021 13:34 UTC](https://discourse.nodered.org/t/zoom-to-location-on-ui-worldmap/55417/2 "2021-12-21T13:34:14Z")

</div>

Not quite that simple but it can be done... you need to use a convex-hull node - this creates a shape that would hold all the points - and then make the shape itself invisible - and then fit the map to that.  
(You will also need worldmap version 2.23.4 🙂

```auto
[{"id":"4b5f6be5.96c1f4","type":"worldmap-hull","z":"846d7832.3348c8","name":"","prop":"layer","x":520,"y":270,"wires":[["889b0e44.4fc8b","bc417f3349e3925a"]]},{"id":"bc417f3349e3925a","type":"function","z":"846d7832.3348c8","name":"","func":"msg.payload.fit = true;\nmsg.payload.fillOpacity = 0;\nmsg.payload.opacity = 0;\ndelete msg.payload.clickable;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":270,"wires":[["fd654fbf.7e7db"]]}]

```

---

<div class="post-metadata">

**Author:** ![zane](https://avatars.discourse-cdn.com/v4/letter/z/c4cdca/32.png) [@zane](https://discourse.nodered.org/u/zane)\
**Post date:** [22 December 2021 02:34 UTC](https://discourse.nodered.org/t/zoom-to-location-on-ui-worldmap/55417/3 "2021-12-22T02:34:36Z")

</div>

that was perfect.. thank you!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 January 2022 02:34 UTC](https://discourse.nodered.org/t/zoom-to-location-on-ui-worldmap/55417/4 "2022-01-05T02:34:43Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
