handle kml and nvg strings as inputs
This commit is contained in:
parent
0f4edcb95d
commit
a7b78986b3
@ -1,5 +1,6 @@
|
||||
### Change Log for Node-RED Worldmap
|
||||
|
||||
- v2.5.6 - Let node accept plain text payload kml or nvg input
|
||||
- v2.5.5 - Fix NVG import to handle symbols for points
|
||||
- v2.5.4 - Fix delete of hulls
|
||||
- v2.5.3 - Swap default satellite layer
|
||||
|
@ -11,6 +11,7 @@ map web page for plotting "things" on.
|
||||
|
||||
### Updates
|
||||
|
||||
- v2.5.6 - Let node accept plain text payload kml or nvg input
|
||||
- v2.5.5 - Fix NVG import to handle symbols for points
|
||||
- v2.5.4 - Fix delete of hulls
|
||||
- v2.5.3 - Swap default satellite layer
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-contrib-web-worldmap",
|
||||
"version": "2.5.5",
|
||||
"version": "2.5.6",
|
||||
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
||||
"dependencies": {
|
||||
"cgi": "0.3.1",
|
||||
@ -8,6 +8,9 @@
|
||||
"express": "^4.16.4",
|
||||
"sockjs": "~0.3.21"
|
||||
},
|
||||
"bundledDependencies": [
|
||||
"cgi","compression","express","sockjs"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dceejay/RedMap"
|
||||
|
@ -471,6 +471,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
RED.nodes.registerType("worldmap-hull",WorldMapHull);
|
||||
|
||||
|
||||
RED.httpNode.get("/.ui-worldmap", function(req, res) {
|
||||
res.send(ui ? "true": "false");
|
||||
});
|
||||
|
@ -93,7 +93,7 @@ var connect = function() {
|
||||
};
|
||||
ws.onmessage = function(e) {
|
||||
var data = JSON.parse(e.data);
|
||||
//console.log("DATA" typeof data,data);
|
||||
// console.log("DATA",typeof data,data);
|
||||
if (data) {
|
||||
if (Array.isArray(data)) {
|
||||
//console.log("ARRAY");
|
||||
@ -110,6 +110,14 @@ var connect = function() {
|
||||
// map.fitBounds(bnds.pad(0.25));
|
||||
}
|
||||
else {
|
||||
if (typeof data === "string" && data.indexOf("<?xml") == 0) {
|
||||
if (data.indexOf("<nvg") != -1) {
|
||||
data = {command:{map:{overlay:"NVG", nvg:data}}};
|
||||
}
|
||||
else if (data.indexOf("<kml") != -1) {
|
||||
data = {command:{map:{overlay:"KML", kml:data}}};
|
||||
}
|
||||
}
|
||||
if (data.command) { doCommand(data.command); delete data.command; }
|
||||
if (data.hasOwnProperty("name")) { setMarker(data); }
|
||||
else if (data.hasOwnProperty("type")) { doGeojson("geojson",data); }
|
||||
|
Loading…
Reference in New Issue
Block a user