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

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.

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.

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.

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

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

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

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

return msg;
1 Like

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