Node-red-contrib-worldmap

#1

I was wondering if someone could embarrass me and just post a simple inject->worldmap node example that draws a circle around a location as I can't get it do do that :frowning:

0 Likes

#2

doesn't the example in the readme work for you ?

1 Like

#3

I found this example in my node-RED projects. Probably is the same one from the flows page or perhaps with some modification. Anyway, it is quite simple.

[{"id":"8118e0cc.d91e5","type":"tab","label":"Flow 5","disabled":false,"info":""},{"id":"e6ac1fc6.e3157","type":"worldmap","z":"8118e0cc.d91e5","name":"","x":670,"y":200,"wires":[]},{"id":"70f8c8be.5478e8","type":"function","z":"8118e0cc.d91e5","name":"30  meters circle","func":"msg.payload = { lat:51.05, lon:-1.35, name:\"A3090\", radius:30 }\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":200,"wires":[["e6ac1fc6.e3157"]]},{"id":"f5cebbf1.137988","type":"inject","z":"8118e0cc.d91e5","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":290,"y":200,"wires":[["70f8c8be.5478e8"]]}]
0 Likes

#4

I tried this

coverting ths

msg.payload = { name:"Joe", lat:51.05, lon:-1.35 }

to this

I get very confused with JSON but tried sticking quotes around stuff and still doesn't seem to do anything

I know its me but I've not been lucky with what I've tried :frowning:

0 Likes

#5

@Andrei
I can import your flow but nothing appears in my broswer :frowning:

0 Likes

#6

The map will not open in the dashboard. As per the worldmap help it is necessary to key ctr+shift+m (in windows)

Shortcut -  `⌘⇧m`  - ctrl-shift-m to jump to Map.
0 Likes

#7

i know that bit :slight_smile:

What I mean is - I can copy and paste your flow into my editor( via normal menu-import-paste from clipboard) tab but nothing appears in the editor

Very stange - not had it happen before

Really not being lucky with one

0 Likes

#8

There is a specific example in the readme about circles...

[{"id":"c0e71a8c.e22e48","type":"inject","z":"dfe4ec36.0a5a5","name":"","topic":"","payload":"{ \"lat\":51.05, \"lon\":-1.35, \"name\":\"A3090\", \"radius\":3000 }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":1180,"wires":[["f22e5b4f.f7bf28"]]},{"id":"f22e5b4f.f7bf28","type":"worldmap","z":"dfe4ec36.0a5a5","name":"","lat":"","lon":"","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","x":370,"y":1180,"wires":[]}]
0 Likes

#9

Really strange. The flow TAB name is Flow 5. I tested by importing and it shows up in the editor.

Here is the configuration in the function node. Nothing configured in the worldmap node.

msg.payload = { lat:51.05, lon:-1.35, name:"A3090", radius:30 }
return msg;

0 Likes

#10

I see now... this sems to be the issue. Comparing with Dave´s flow you can see how the JSON is supposed to be . Missing quotes in your inject node. Also missing the radius property on your flow.

{
    "lat": 51.05,
    "lon": -1.35,
    "name": "A3090",
    "radius": 3000
}
0 Likes

#11

Tried that - no errors in JSON this time but I think this is where that lat/lon should be but I can't see anything - something must be broken at my end

0 Likes

#12

missing the radius property ?

0 Likes

#13

have you hit inject AFTER the map has connected to the server ? (plus zoom out a little)

image

top tip the label bottom left is green for connected, red for disconnected/error
image

0 Likes

#14

I do think I see it, u r hitting the ball,,,yes,,,hole-in-one

0 Likes

#15

#shame

It (of course) works now - thank you

I think I was getting in such a knot with my json syntax original problem and then I forgot that i should PRESS THE BUTTON! was my last error :slight_smile:

0 Likes

#16

the worldmap-in node does provide an event when someone connects (and other things) that you could of course use to trigger that automatically if required.

1 Like

#17

Any hints for using worldmap behind a reverse proxy? I'm struggling with apache and the websockets…

Edit: I did it:

<Location /red/worldmap>

    RewriteEngine on
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
    RewriteRule /socket/(.*) ws://127.0.0.1:1880/red/worldmap/socket/$1 [P]

</Location>
0 Likes