fixup convex hull drawing and example
This commit is contained in:
parent
1a4951594d
commit
cd2576b16d
@ -1,5 +1,6 @@
|
|||||||
### Change Log for Node-RED Worldmap
|
### Change Log for Node-RED Worldmap
|
||||||
|
|
||||||
|
- v2.23.2 - Add convex-hull example
|
||||||
- v2.23.1 - Fix saving of custom map layer
|
- v2.23.1 - Fix saving of custom map layer
|
||||||
- v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
|
- v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
|
||||||
- v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
|
- v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
|
||||||
|
@ -11,6 +11,7 @@ map web page for plotting "things" on.
|
|||||||
|
|
||||||
### Updates
|
### Updates
|
||||||
|
|
||||||
|
- v2.23.2 - Add convex-hull example
|
||||||
- v2.23.1 - Fix saving of custom map layer
|
- v2.23.1 - Fix saving of custom map layer
|
||||||
- v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
|
- v2.23.0 - Give logo and id so it can be overridden by toplogo command. PR #188.
|
||||||
- v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
|
- v2.22.3 - Don't show empty popup for geojson object. Issue #186. Add wobble to null island.
|
||||||
|
1
examples/Convex Hull around points.json
Normal file
1
examples/Convex Hull around points.json
Normal file
File diff suppressed because one or more lines are too long
@ -1,112 +1 @@
|
|||||||
[
|
[{"id":"2e9ce367.acdb9c","type":"worldmap","z":"e956b3364e3ffca6","name":"","lat":"","lon":"","zoom":"8","layer":"OSMG","cluster":"0","maxage":"","usermenu":"show","layers":"show","panit":"false","hiderightclick":"false","coords":"none","path":"/worldmap","overlist":"CO","maplist":"OSMG,OSMC,OSMH,EsriC,EsriS,EsriT,EsriO","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":570,"y":600,"wires":[]},{"id":"8d0f8d4c.3cd21","type":"function","z":"e956b3364e3ffca6","name":"remove split","func":"msg.payload = {command:{side:\"none\"}};\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":660,"wires":[["2e9ce367.acdb9c"]]},{"id":"311acf75.93ff8","type":"function","z":"e956b3364e3ffca6","name":"Satellite","func":"msg.payload = {\n command:{\n side: \"Esri Satellite\", \n split: 66,\n showlayer: \"roads\"\n }\n};\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":600,"wires":[["2e9ce367.acdb9c"]]},{"id":"eaea1a90.f27b98","type":"worldmap in","z":"e956b3364e3ffca6","name":"","path":"/worldmap","events":"connect","x":90,"y":600,"wires":[["4540d879.244f88"]]},{"id":"4540d879.244f88","type":"switch","z":"e956b3364e3ffca6","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":240,"y":600,"wires":[["311acf75.93ff8"]]},{"id":"f77366dc.818138","type":"inject","z":"e956b3364e3ffca6","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":100,"y":660,"wires":[["8d0f8d4c.3cd21"]]}]
|
||||||
{
|
|
||||||
"id": "2e9ce367.acdb9c",
|
|
||||||
"type": "worldmap",
|
|
||||||
"z": "82738787.0e0338",
|
|
||||||
"name": "",
|
|
||||||
"lat": "",
|
|
||||||
"lon": "",
|
|
||||||
"zoom": "8",
|
|
||||||
"layer": "OSM",
|
|
||||||
"cluster": "0",
|
|
||||||
"maxage": "",
|
|
||||||
"usermenu": "show",
|
|
||||||
"layers": "show",
|
|
||||||
"panit": "false",
|
|
||||||
"path": "/worldmap",
|
|
||||||
"x": 580,
|
|
||||||
"y": 920,
|
|
||||||
"wires": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "8d0f8d4c.3cd21",
|
|
||||||
"type": "function",
|
|
||||||
"z": "82738787.0e0338",
|
|
||||||
"name": "remove split",
|
|
||||||
"func": "msg.payload = {command:{side:\"none\"}};\nreturn msg;",
|
|
||||||
"outputs": 1,
|
|
||||||
"noerr": 0,
|
|
||||||
"x": 390,
|
|
||||||
"y": 980,
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"2e9ce367.acdb9c"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "311acf75.93ff8",
|
|
||||||
"type": "function",
|
|
||||||
"z": "82738787.0e0338",
|
|
||||||
"name": "Satellite",
|
|
||||||
"func": "msg.payload = {\n command:{\n side: \"Esri Satellite\", \n split: 66,\n showlayer: \"roads\"\n }\n};\nreturn msg;",
|
|
||||||
"outputs": 1,
|
|
||||||
"noerr": 0,
|
|
||||||
"x": 400,
|
|
||||||
"y": 920,
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"2e9ce367.acdb9c"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "eaea1a90.f27b98",
|
|
||||||
"type": "worldmap in",
|
|
||||||
"z": "82738787.0e0338",
|
|
||||||
"name": "",
|
|
||||||
"path": "/worldmap",
|
|
||||||
"x": 100,
|
|
||||||
"y": 920,
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"4540d879.244f88"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "4540d879.244f88",
|
|
||||||
"type": "switch",
|
|
||||||
"z": "82738787.0e0338",
|
|
||||||
"name": "",
|
|
||||||
"property": "payload.action",
|
|
||||||
"propertyType": "msg",
|
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"t": "eq",
|
|
||||||
"v": "connected",
|
|
||||||
"vt": "str"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"checkall": "true",
|
|
||||||
"repair": false,
|
|
||||||
"outputs": 1,
|
|
||||||
"x": 250,
|
|
||||||
"y": 920,
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"311acf75.93ff8"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "f77366dc.818138",
|
|
||||||
"type": "inject",
|
|
||||||
"z": "82738787.0e0338",
|
|
||||||
"name": "",
|
|
||||||
"topic": "",
|
|
||||||
"payload": "",
|
|
||||||
"payloadType": "str",
|
|
||||||
"repeat": "",
|
|
||||||
"crontab": "",
|
|
||||||
"once": false,
|
|
||||||
"onceDelay": 0.1,
|
|
||||||
"x": 110,
|
|
||||||
"y": 980,
|
|
||||||
"wires": [
|
|
||||||
[
|
|
||||||
"8d0f8d4c.3cd21"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
@ -1 +1 @@
|
|||||||
[{"id":"62ae3b3c.8de704","type":"worldmap in","z":"f86be7c2.1183b8","name":"","path":"/worldmap","x":140,"y":660,"wires":[["2eadb3d5.d063ec","c47cdeab.f4911","259809c4.43edf6"]]},{"id":"2eadb3d5.d063ec","type":"debug","z":"f86be7c2.1183b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":310,"y":620,"wires":[]},{"id":"259809c4.43edf6","type":"switch","z":"f86be7c2.1183b8","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":660,"wires":[[]]},{"id":"13a00ba8.dcc8e4","type":"comment","z":"f86be7c2.1183b8","name":"Reload trigger","info":"The output from the switch will fire whenever a browser connects (or reconnects).\n\nThis can be used to retrieve stored datapoints and resend them to the map, as by default the main does not retain any sata between refreshes.\n\nThe debug node will show other properties that may be useful to trigger other actions.\n","x":150,"y":620,"wires":[]}]
|
[{"id":"62ae3b3c.8de704","type":"worldmap in","z":"e956b3364e3ffca6","name":"","path":"/worldmap","events":"connect","x":165,"y":630,"wires":[["2eadb3d5.d063ec","259809c4.43edf6"]]},{"id":"2eadb3d5.d063ec","type":"debug","z":"e956b3364e3ffca6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":335,"y":590,"wires":[]},{"id":"259809c4.43edf6","type":"switch","z":"e956b3364e3ffca6","name":"","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":335,"y":630,"wires":[[]]},{"id":"13a00ba8.dcc8e4","type":"comment","z":"e956b3364e3ffca6","name":"Reload trigger","info":"The output from the switch will fire whenever a browser connects (or reconnects).\n\nThis can be used to retrieve stored datapoints and resend them to the map, as by default the main does not retain any sata between refreshes.\n\nThe debug node will show other properties that may be useful to trigger other actions.\n","x":175,"y":590,"wires":[]}]
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-contrib-web-worldmap",
|
"name": "node-red-contrib-web-worldmap",
|
||||||
"version": "2.23.1",
|
"version": "2.23.2",
|
||||||
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@turf/bezier-spline": "~6.5.0",
|
"@turf/bezier-spline": "~6.5.0",
|
||||||
@ -27,6 +27,7 @@
|
|||||||
"world"
|
"world"
|
||||||
],
|
],
|
||||||
"node-red": {
|
"node-red": {
|
||||||
|
"version": ">=1.0.0",
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"worldmap": "worldmap.js"
|
"worldmap": "worldmap.js"
|
||||||
}
|
}
|
||||||
@ -38,5 +39,8 @@
|
|||||||
},
|
},
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"@HiroyasuNishiyama"
|
"@HiroyasuNishiyama"
|
||||||
]
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
12
worldmap.js
12
worldmap.js
@ -486,16 +486,16 @@ module.exports = function(RED) {
|
|||||||
node.send(newmsg);
|
node.send(newmsg);
|
||||||
}
|
}
|
||||||
if (leafletHull.length === 2 && (oldl === 1 || oldl === 3)) {
|
if (leafletHull.length === 2 && (oldl === 1 || oldl === 3)) {
|
||||||
newmsg.payload.deleted = true;
|
var newmsg2 = RED.util.cloneMessage(newmsg);
|
||||||
node.send(newmsg);
|
newmsg2.payload.deleted = true;
|
||||||
delete newmsg.payload.deleted;
|
node.send(newmsg2);
|
||||||
newmsg.payload.line = leafletHull;
|
newmsg.payload.line = leafletHull;
|
||||||
node.send(newmsg);
|
node.send(newmsg);
|
||||||
}
|
}
|
||||||
if (leafletHull.length === 3 && oldl === 2) {
|
if (leafletHull.length === 3 && oldl === 2) {
|
||||||
newmsg.payload.deleted = true;
|
var newmsg3 = RED.util.cloneMessage(newmsg);
|
||||||
node.send(newmsg);
|
newmsg3.payload.deleted = true;
|
||||||
delete newmsg.payload.deleted;
|
node.send(newmsg3);
|
||||||
}
|
}
|
||||||
if (leafletHull.length >= 3) {
|
if (leafletHull.length >= 3) {
|
||||||
newmsg.payload.area = leafletHull;
|
newmsg.payload.area = leafletHull;
|
||||||
|
Loading…
Reference in New Issue
Block a user