better check of type property before assuming geojson

to close #153
This commit is contained in:
Dave Conway-Jones 2021-02-21 12:41:22 +00:00
parent 79cf724701
commit 5c065627c2
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
4 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap
- v2.8.6 - Better checking of type property before guessing it's geojson. Issue #153
- v2.8.4 - Add addToForm(n,v) option and $form - to make contextmenu form submission easier.
- v2.8.3 - Let feedback include lat lon for context menu on general map.
- v2.8.2 - Improve direction handling of 3d objects.

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates
- v2.8.6 - Better checking of type property before guessing it's geojson. Issue #153
- v2.8.4 - Add addToForm(n,v) option and $form - to make contextmenu form submission easier.
- v2.8.3 - Let feedback include lat lon for context menu on general map.
- v2.8.2 - Improve direction handling of 3d objects.
@ -618,15 +619,15 @@ You can then add a new WMS Base layer by injecting a message like
"name": "Local WMS",
"url": "/cgi-bin/mapserv", // we will serve the tiles from this node locally.
"opt": {
"layers": "gb", // specifies a layer in your map file
"layers": "gb", // specifies a layer in your map file
"format": "image/png",
"transparent": true,
"attribution": "© Ordnance Survey, UK"
},
"wms": true // set to true for WMS type mapserver
"wms": true // set to true for WMS type mapserver
}}}
Optionally set `"wms":"grey"` to make the layer to greyscale which may make your markers more visible.
Optionally set `"wms":"grey"` to set the layer to greyscale which may make your markers more visible.
## Examples and Demo Flow

View File

@ -1,6 +1,6 @@
{
"name": "node-red-contrib-web-worldmap",
"version": "2.8.5",
"version": "2.8.6",
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": {
"cgi": "0.3.1",

View File

@ -129,7 +129,7 @@ var handleData = function(data) {
}
}
if (data.command) { doCommand(data.command); delete data.command; }
if (data.hasOwnProperty("type")) { doGeojson("geojson",data); }
if (data.hasOwnProperty("type") && data.type.indexOf("Feature") === 0) { doGeojson("geojson",data); }
else if (data.hasOwnProperty("name")) { setMarker(data); }
else {
console.log("SKIP",data);