# How to change the default marker icon in the node-red worldmap node from a function node?

**URL:** https://discourse.nodered.org/t/how-to-change-the-default-marker-icon-in-the-node-red-worldmap-node-from-a-function-node/59812
**Category:** General
**Created:** [13 March 2022 19:37 UTC](https://discourse.nodered.org/t/how-to-change-the-default-marker-icon-in-the-node-red-worldmap-node-from-a-function-node/59812 "2022-03-13T19:37:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![oliver](https://avatars.discourse-cdn.com/v4/letter/o/85f322/32.png) [@oliver](https://discourse.nodered.org/u/oliver)
#### Post date: [13 March 2022 19:37 UTC](https://discourse.nodered.org/t/how-to-change-the-default-marker-icon-in-the-node-red-worldmap-node-from-a-function-node/59812/1 "2022-03-13T19:37:03Z")

</div>

Hi the default red marker is very large, I wonder if there is a way to change it. I did not find a property in the worldmap node settings.

I know it is possible to add it in every record but that is not the way I prefer, because then all records become bigger.  
So the list with records [{"name":1, "lat":51, "lon":-4.05}, {"name":2, "lat":52, "lon":-4.05}.... should remain the same but shown on the map with another icon, preferable the default icon should be programmable with a function node in the flow. Thanks in advance.

---

<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: [15 March 2022 09:34 UTC](https://discourse.nodered.org/t/how-to-change-the-default-marker-icon-in-the-node-red-worldmap-node-from-a-function-node/59812/2 "2022-03-15T09:34:17Z")

</div>

can you add a function node just before the worldmap node that adds msg.payload.icon set to which ever you wish to use as default instead ? (as you are sending an array I guess you would need to use an array.map function to add to every element - or you could use a split node to create individual objects and then a change node to add the icon to each.

---

<div class="post-metadata">

### Author: ![oliver](https://avatars.discourse-cdn.com/v4/letter/o/85f322/32.png) [@oliver](https://discourse.nodered.org/u/oliver)
#### Post date: [15 March 2022 10:19 UTC](https://discourse.nodered.org/t/how-to-change-the-default-marker-icon-in-the-node-red-worldmap-node-from-a-function-node/59812/3 "2022-03-15T10:19:35Z")

</div>

I tried the msg.payload.icon in an extra function node, that did not work unfortunately.  
I will try your other suggestions! Thanks for y help.

---

<div class="post-metadata">

### Author: ![oliver](https://avatars.discourse-cdn.com/v4/letter/o/85f322/32.png) [@oliver](https://discourse.nodered.org/u/oliver)
#### Post date: [15 March 2022 10:25 UTC](https://discourse.nodered.org/t/how-to-change-the-default-marker-icon-in-the-node-red-worldmap-node-from-a-function-node/59812/4 "2022-03-15T10:25:48Z")

</div>

Below map function as you suggested works! Thanks a lot! (I don't know how to show screenshots here )

```auto
msg.payload.icon = "fa-car";

msg.payload = msg.payload.map(myFunction);

function myFunction(obj1){
    
    obj1.icon = "fa-car";
    
    return obj1;
}

return msg;

```

---

<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: [14 May 2022 10:25 UTC](https://discourse.nodered.org/t/how-to-change-the-default-marker-icon-in-the-node-red-worldmap-node-from-a-function-node/59812/5 "2022-05-14T10:25:49Z")

</div>

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