How to do that the Worldmap and marker of this stays indefinitely, and the Worldmap can sees in other devices

Hello!

How can i do in Worldmap node to see this in Other devices?

And the second one, How can i make that Marker of this Stays Indefinitely and can looks in other devices?

My function node to make the marker is this:

msg.battery_voltage = (msg.battery / 100) * 0.1 + 4.0;
msg.battery = ((msg.battery_voltage - 4.0) / 0.1) * 100;


msg.payload = {
    name: "Estacion",
    lat: msg.latitude, // Latitud recibida del webhook
    lon: msg.longitude, // Longitud recibida del webhook
    icon: "weather", // Icono de la estación meteorológica
    layer: "Estaciones Meteorológicas", // Capa a la que pertenece el marcador
    color: "blue", // Color del marcador
    popup: "<img src='https://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Stevenson_screen_exterior.JPG/800px-Stevenson_screen_exterior.JPG' width='200px'><br>Batería: " + msg.battery.toFixed(2) + "%" // Texto que aparecerá cuando se haga clic en el marcador
};

return msg;

And after that, go direct to Worldmap node.

and it looks something like this:

Thank you for your time!

Hi, I'm not quite sure what you mean. As long as you don't restart Node-RED then any late joining browser should still receive the markers. You can set the time to live using msg.payload.ttl, or the default can be set in the worldmap node config


The default is 600 seconds (10 minutes) - setting to 0 will mean infinite.

Ohhh, thank you. What i tried to mean is in another post:

Is this, here i explain everything that i need.

That is this post !... so indeed I still don't understand :slight_smile:

Ohh Sorry.
I don´t know why i saw in Another post, sorry.

I´m going to explain like this:

1 - I have a Weather Station, And the Station give me the data in JSON format. (Here isn´t the problem)
2 - I have a Dashboard in Node red, And i have the Worldmap node
3- I already have the Specific Function to show The Station Marker in the Worldmap node, look at this:

.

(In the Post above, I show what is the Code that i have in the Function node)

What is what i want?

1- I want that the Worldmap be visible in other devices... Because if i entry to the dashboard in another device the dashboard don´t show the Station Marker. Look at this:


(another device, show in another place without the Station marker:)

2- I want that the Station marker stay indefinitely, Because if i reload the page (F5) in a few seconds the marker desappear, this is joined with the point 1. Look at this:

Any questions do not hesitate to ask me.

Thank you for your time. I hope that you can help me

@dceejay I dont know why not reply you LMAO.

It's weekend and beer time in Europe

1 Like

Ok, I know that, but when somebody can there is the text.

Do you can help some way??

As I don't have your data feed I just use a simple inject eg -

[{"id":"ca5cdad36e09b9a8","type":"function","z":"fe51cb720c42b6e9","name":"function 1","func":"\nmsg.battery = 50;\n\nmsg.payload = {\n    name: \"Estacion\",\n    lat: 6.086313, // Latitud recibida del webhook\n    lon: -75.166243, // Longitud recibida del webhook\n    icon: \"weather\", // Icono de la estación meteorológica\n    layer: \"Estaciones Meteorológicas\", // Capa a la que pertenece el marcador\n    color: \"blue\", // Color del marcador\n    popup: \"<img src='https://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Stevenson_screen_exterior.JPG/800px-Stevenson_screen_exterior.JPG' width='200px'><br>Batería: \" + msg.battery.toFixed(2) + \"%\" // Texto que aparecerá cuando se haga clic en el marcador\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":345,"y":360,"wires":[["f814d8e3686e709f"]]},{"id":"2c1e6793c88fd407","type":"inject","z":"fe51cb720c42b6e9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":360,"wires":[["ca5cdad36e09b9a8"]]},{"id":"f814d8e3686e709f","type":"ui_worldmap","z":"fe51cb720c42b6e9","group":"af5277d70040e5ca","order":0,"width":0,"height":0,"name":"","lat":"6.086313","lon":"-75.166243","zoom":"8","layer":"OSMG","cluster":"","maxage":"0","usermenu":"hide","layers":"hide","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"true","coords":"none","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":510,"y":360,"wires":[]},{"id":"0ca62bcac06f0554","type":"ui_gauge","z":"fe51cb720c42b6e9","name":"","group":"6c19d4c5043bbab9","order":1,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":325,"y":435,"wires":[]},{"id":"9016e8a0a707902f","type":"ui_slider","z":"fe51cb720c42b6e9","name":"","label":"slider","tooltip":"","group":"6c19d4c5043bbab9","order":0,"width":0,"height":0,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":10,"step":1,"className":"","x":170,"y":435,"wires":[["0ca62bcac06f0554"]]},{"id":"af5277d70040e5ca","type":"ui_group","name":"Default","tab":"a2b6427012c81b5f","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"6c19d4c5043bbab9","type":"ui_group","name":"Group 1","tab":"c21837390b31be61","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"a2b6427012c81b5f","type":"ui_tab","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"c21837390b31be61","type":"ui_tab","name":"Tab 2","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

If I do that then I get a point as you do. If I reload (f5) the point is still there. If I view in dashboard the point is still there. If I change dashboard tabs the point is still there. If I use a different browser to point to the same server the point is still there.

If I stop and restart (redeploy) the server (Node-RED) then yes the point will go away.

Which version of Node-RED and which version of the worldmap node are you using ?

Hello.

That didn´t work for me.

if you required, My inject code is this:

object
deviceName: "Weather Station"
deviceSerialNumber: "CM.S2B.1.1.0-N0000117"
measurements: array[6]
0: object
latitude: 6.071770000000001
longitude: -75.33387
name: "location"
1: object
data: 3
name: "air-quality"
2: object
data: 15.740000000000002
name: "temperature"
3: object
data: 97.48
name: "humidity"
4: object
data: 240
data2: 0.625
name: "wind-speed"
5: object
data: 4045
name: "battery"
timestamp: "2022-11-28T18:00:01Z"

My node red version is: V3.0.2
My worldma version is: V2.33.0

If i reload (F5) the marker disappear. I dont know why

That data could not be handled by the function you showed at the top as it contains an array of data pairs and your function doesn't access them at all. So your real data or function is not what you are showing us.

Meanwhile - what didn't work with the code I shared ? and which versions are you using ?

Yes, it works. How i can show you in the First post, The marker works perfectly.

How it works? i´ll show you.

This is full nodes, here the explanation:

1- The inject code is an array (The same that the last post) (inject by Webhook node)

2- The second node, is a JSON that convert in msg.payload:
image

3- The third node is a change, assign the body that we need:
image

4- The fourth node is again a JSON, This node finally gonna do the code change to JSON Code. Now is this:

object

deviceName: "Colwave Station"

deviceSerialNumber: "CM.S2B.1.1.0-N0000117"

measurements: array[6]

0: object

latitude: 6.071569999999994

longitude: -75.33388

name: "location"

1: object

data: 3

name: "air-quality"

2: object

data: 16.270000000000003

name: "temperature"

3: object

data: 87.51

name: "humidity"

4: object

data: 225

data2: 0.5390625

name: "wind-speed"

5: object

data: 4060

name: "battery"

timestamp: "2023-03-13T15:00:05Z"

5- the fifth node is a change, to assing the values of: Latitude, Longitude and battery:
image

6- Now with this, we already can the function node, that have the code:
image

And finally, The worldmap node:

What didn't work? When I used your nodes, when I injected the data, the marker is there. But when I reloaded the page. The marker disappears, When I used in another browser, it wasn´t there.

My node red version is: V3.0.2
My worldmap version is: V2.33.0

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