Worldmap issue

170 views
Skip to first unread message

Adrian Brown

unread,
May 7, 2018, 1:50:19 AM5/7/18
to Node-RED
Hi folks,

Either I am having trouble grasping the msg.payload.command or it's broken.

if I inject 

 msg.payload.command =  {
        name:"circle",
        lat:-37.814,
        lon:144.96332,
        radius:1000,
        zoom:18,
        layer:"test",
        iconColor:'#464646',
        stroke:false,
        fillOpacity:0.8,
        clickable:true
    };
return msg;

Nothing happens e.g  I don't get get an error by I also don't get a circle drawn around  the co-ordinates.

Any pointers would be appreciated


Dave C-J

unread,
May 7, 2018, 4:38:29 AM5/7/18
to node...@googlegroups.com
Just try

msg.payload = {
    name:"circle",
    lat:-37.814,
    lon:144.96332,
    radius:1000,
    layer:"test",
    iconColor:'#464646'
};
return msg;

Adrian Brown

unread,
May 7, 2018, 4:43:03 AM5/7/18
to node...@googlegroups.com
Thanks Dave that does work :-) might save you having to respond to these questions if the example reflected that :-)

Another question does world map support geojson 3D

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CACXWFw%2Bm2hHBDvf-9OSDUPSjP%3D2PVvXH9jxhRHatmCMgjWc84w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Regards
Adrian Brown

Dave C-J

unread,
May 7, 2018, 5:23:05 AM5/7/18
to node...@googlegroups.com
Which example ?
Geojson3d ? Probably not. 
--
Sent from phone.

Adrian Brown

unread,
May 8, 2018, 4:08:43 AM5/8/18
to node-red
Hi Dave 3D geojson was probably a bad choice of words, but the GeoJson RFC supposedly supports altitude

{"type": "Point", "coordinates": [lon, lat, alt]}

https://tools.ietf.org/html/rfc7946



The demos of was referring to the coding examples at https://flows.nodered.org/node/node-red-contrib-web-worldmap 

We are using node red to do a quick proof of concept for the Metro Fire Brigade in Melbourne (for quite a few things) http://mfb.vic.gov.au/

One of the things we are looking at is grabbing building data for the PSMA  https://developer.psma.com.au/api/Buildings useful data on 15 Million plus buildings in Australia. 

Node Red Enabled us to do that in like 10 minutes  ( power to Noded Red :-) ) 

So now looking to throw the basic ploygon data onto worldmap (see sample data below)

[[[[145.005257659,-37.829368184],[145.005290581,-37.82917729],[145.005766051,-37.8292288759999],[145.005763391,-37.8292443029999],[145.005842063,-37.8292528389999],[145.005844464,-37.8292389169999],[145.005995508,-37.829255304],[145.005991611,-37.8292779],[145.006038435,-37.82928298],[145.006042145,-37.829261467],[145.006117144,-37.8292696039999],[145.006114199,-37.829286683],[145.006161022,-37.829291763],[145.006162278,-37.8292844769999],[145.006263239,-37.8292954309999],[145.006254764,-37.8293445749999],[145.006291571,-37.8293485679999],[145.006269262,-37.829477934],[145.005257659,-37.829368184]]]]

Another way the data comes is as a  GeoJSON Polygon of the building, including elevation on points. ( see sample data below)

[[[[145.005257659,-37.829368184,11.682799999995],[145.005290581,-37.82917729,11.6919000000053],[145.005766051,-37.8292288759999,11.797900000005],[145.005763391,-37.8292443029999,11.7443999999959],[145.005842063,-37.8292528389999,11.7165999999997],[145.005844464,-37.8292389169999,11.7854999999981],[145.005995508,-37.829255304,11.8200999999972],[145.005991611,-37.8292779,11.8073000000004],[145.006038435,-37.82928298,11.7856999999931],[145.006042145,-37.829261467,11.8034000000043],[145.006117144,-37.8292696039999,11.8313000000053],[145.006114199,-37.829286683,11.7997999999934],[145.006161022,-37.829291763,11.8283999999985],[145.006162278,-37.8292844769999,11.8435000000027],[145.006263239,-37.8292954309999,11.9474999999948],[145.006254764,-37.8293445749999,11.8968000000023],[145.006291571,-37.8293485679999,11.8898999999947],[145.006269262,-37.829477934,11.6892999999982],[145.005257659,-37.829368184,11.682799999995]]]]





Regards
Adrian Brown


--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Dave C-J

unread,
May 8, 2018, 4:40:09 AM5/8/18
to node...@googlegroups.com
Well there is already a buildings layer in there already... using osmbuildings.js
not sure how you could add to that...happy to entertain the idea of doing so - but would have to be input from you as I'm busy for the next few weeks.


The map does support geojson overlays as per readme

msg.payload.command.map = {
            overlay:"myGeoJSON",
            geojson:{ geojson feature as an object },
            (opt:{ optional geojson options, style, filter, onEach, Feature, etc })
        };

but I don't think it will render altitude being a 2d map...


Dave C-J

unread,
May 8, 2018, 4:42:46 AM5/8/18
to node...@googlegroups.com


--
regards

Dave Conway-Jones

Adrian Brown

unread,
May 8, 2018, 5:07:37 AM5/8/18
to node-red
Happy to do that Dave :-)

We have a concept that, addresses a problem that all Emergency Services (police, ambulance & fire) deal with every day, so probably best to take it of the chat forum.

my email is adrb...@mfb.vic.gov.au

Cheers
Adrian

Regards
Adrian Brown


--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Adrian Brown

unread,
May 17, 2018, 1:33:45 AM5/17/18
to node-red
Thanks Dave 

How would one go about deleting or updating the geojson?

Regards
Adrian Brown

Dave C-J

unread,
May 18, 2018, 4:18:19 AM5/18/18
to node...@googlegroups.com
Hi

I think you just need

msg.payload.command.clear = "name of your layer/overlay to clear";


Adrian Brown

unread,
May 28, 2018, 1:50:31 AM5/28/18
to node-red
Hi Dave,

I have been playing with worldmap. OSM buildings & geojson.

Osmbuildings at https://www.npmjs.com/package/osmbuildings supports the rendering of buildings in 3D

var geoJSON = {
  "type": "FeatureCollection",
  "features": [{
    "type": "Feature",
    "id": 134,
    "geometry": {
      "type": "Polygon",
      "coordinates": [[
        [13.37356, 52.52064],
        [13.37350, 52.51971],
        [13.37664, 52.51973],
        [13.37594, 52.52062],
        [13.37356, 52.52064]
      ]]
    },
    "properties": {
      "wallColor": "rgb(255,0,0)",
      "roofColor": "rgb(255,128,0)",
      "height": 500,
      "minHeight": 0
    }
  }]
};

You basically just pass the building height etc in the properties as above.

If I pass this to world map

var duress_style = {
    "color": "green",
    "weight": 1,
    "opacity": 1
};
var coordinates = msg.payload.footprint2d.coordinates[0];
 msg.payload = {};
 msg.payload.command = {};
 msg.payload.command.map = {
       overlay:"Duress Location",    
       geojson:{  "type": "FeatureCollection",
       "features": [ { "type": "Feature", 
       "geometry": {"type": "MultiPolygon",
       "coordinates":[coordinates],
       "properties": {"wallColor": "rgb(255,0,0)",
       "roofColor": "rgb(255,128,0)",
       "height": 17,
       "minHeight": 0}
  }}]},
     opt:{ duress_style:style  }
 };
return msg;

The properties ( in relation to building roof & wall is ignored as are the height proprieties

Not sure how hard it would be for you to add support for this to world map?

or Alternatively add support for the WebGL version of OSMbuildings ( All variants of OSM Buildings will eventually land in this spot).

The new WebGL version is located here: https://github.com/OSMBuildings/OSMBuildings 

Regards
Adrian








Regards
Adrian Brown


--
http://nodered.org
 
** We're moving this mailing list over to the new Node-RED Forum: https://discourse.nodered.org **

 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Dave C-J

unread,
May 28, 2018, 5:30:11 AM5/28/18
to node...@googlegroups.com
This looks useful
(but is public holiday here - so not going to look at it for a while)

Feel free to offer up a Pull Request in the meantime !

Adrian Brown

unread,
May 28, 2018, 5:34:14 AM5/28/18
to node-red
WorldMap Need help

Hi Guys,

I can add a geojson overlay with

var style = {
    "color": "green",
    "weight": 1,
    "opacity": 1
};
var coordinates = msg.payload.footprint2d.coordinates[0];
 msg.payload = {};
 msg.payload.command = {};
 msg.payload.command.map = {
       overlay:"Duress Location",    
       geojson:{  "type": "FeatureCollection",
       "features": [ { "type": "Feature", 
       "geometry": {"type": "MultiPolygon",
       "coordinates":[coordinates],
       "properties": {}
  }}]},
     opt:{ style:style  }
 };
return msg;

no probs it happly draws the polygon

but to clear it i try

msg.payload = {};
msg.payload.command = {};
msg.payload.command.clear = "Duress Location";
return msg;

no errors but nothing but it not cleared either?


any insight would be appreciated.







Regards
Adrian Brown


On 18 May 2018 at 18:18, Dave C-J <dce...@gmail.com> wrote:
--
http://nodered.org
 
** We're moving this mailing list over to the new Node-RED Forum: https://discourse.nodered.org **

Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Adrian Brown

unread,
May 28, 2018, 5:34:47 AM5/28/18
to node-red
Thanks Dave will have a look

Enjoy your holiday :-)

Regards
Adrian Brown


--
http://nodered.org
 
** We're moving this mailing list over to the new Node-RED Forum: https://discourse.nodered.org **
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Dave C-J

unread,
May 28, 2018, 4:16:07 PM5/28/18
to node...@googlegroups.com
Hi,
so looking at OSMbuildings - it seems to create a buildings layer... (good).. but if you then "set" a geoJSON object on, then it seems to wipe out anything on that layer (ie replaces everything)... I can't see how to set it to add to a different layer - or to allow multiple adds.. so as long as one building is OK for you (or rather one lump of geoJSON with all your building in) - then we should be good. - but it doesn't seem ideal.

Adrian Brown

unread,
May 29, 2018, 3:22:30 AM5/29/18
to node-red
Hi Dave,

Thought It was a pubic holiday in UK :-)

I wrote back from my work email to  dce...@gmail.com

Cheers
Adrian

Regards
Adrian Brown


On 29 May 2018 at 06:16, Dave C-J <dce...@gmail.com> wrote:
Hi,
so looking at OSMbuildings - it seems to create a buildings layer... (good).. but if you then "set" a geoJSON object on, then it seems to wipe out anything on that layer (ie replaces everything)... I can't see how to set it to add to a different layer - or to allow multiple adds.. so as long as one building is OK for you (or rather one lump of geoJSON with all your building in) - then we should be good. - but it doesn't seem ideal.

--
http://nodered.org
 
** We're moving this mailing list over to the new Node-RED Forum: https://discourse.nodered.org **
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Dave C-J

unread,
May 29, 2018, 4:10:58 AM5/29/18
to node...@googlegroups.com
Hi - will reply longer form there.

I have meanwhile pushed out version 1.1.13 - that can let you push a building in OSMbuilding format onto the map - It does seem that it replaces the whole of the buildings layer so you can only set one building at a time (or indeed you have to manage sending them all...)

To set it - set a payload like   {name:"My Tower", building:{...GeoJSON Featureset...}}
to clear it - just send same but make the building property a blank string.
Reply all
Reply to author
Forward
0 new messages