To add and remove a user defined button,as?

In the help document for node-red-contrib-web-worldmap 2.37.4, in its section: "Controlling the map" and following all the options it offers, I see that some do not work, or I don't know how to apply them very well in my " Function Node". Now I'm checking:"To add and remove a user defined button", and I just copied the example; which is this:"msg.payload.command = { "button": { "name":"My Fancy Button", "icon": "fa-star", "position":"bottomright" } };" , saying that it will add a button in the upper right corner of the map. When applying it, it does not appear.
I don't have much knowledge in JSON but little by little I get things. I am currently making a map with LoRa sensor locations and I am exploiting all available resources.
Thank you all for your attention and help.

Here is that example as a flow

[{"id":"59a42f2604899c31","type":"worldmap","z":"abdd6f69c1e320b7","name":"","lat":"","lon":"","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"false","showgrid":"false","showruler":"false","allowFileDrop":"false","path":"/worldmap","overlist":"DR,CO,RA,DN,HM","maplist":"OSMG,OSMC,EsriC,EsriS,EsriT,EsriDG,UKOS","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":540,"y":280,"wires":[]},{"id":"514483be921ae289","type":"inject","z":"abdd6f69c1e320b7","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":150,"y":280,"wires":[["23d995c352e9cba1"]]},{"id":"23d995c352e9cba1","type":"function","z":"abdd6f69c1e320b7","name":"function 1","func":"\nmsg.payload = {};\nmsg.payload.command = { \n    button: { \n        name: \"My Fancy Button\", \n        icon: \"fa-star\", \n        position: \"bottomright\" \n        } \n    };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":280,"wires":[["59a42f2604899c31","b20dee3570ed95ee"]]}]

Note it places the button bottom right... (not upper right)

Thank you very much "dceejay" for your help. I don't want to abuse, but I have the following problem: when I copy your example and paste it into a libreoffice(writer) document and then import it into a new Node-red flow; This one in its debugger answers me: "Error: Input not a JSON Array". The truth is that I don't know how to develop it better, maybe I have to break it down in the document, could it be like that?
If you could explain it to me, I would be very grateful.

I suspect that when you cut paste it into libreoffice it is changing the quotes slightly. Can you paste direct into node-red. ? Or use notepad etc

Hi "dceejay", yes you are right, I have copied and pasted directly into the insert JSON window and it has created the nodes and the button on the map.
Thank you so much.

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