node-red-contrib-web-worldmap 3.1.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v4.0.0 - Breaking - Better context menu variable substitution and retention
4
+ Now uses ${name} syntax rather than $name so we can handle user defined variables in context menus.
5
+
6
+ - v3.2.0 - Sync up drawing sessions across browsers to same map
3
7
  - v3.1.0 - Add esri overlay layers, and let geojson overlay rendering be customised
4
8
  - v3.0.0 - Bump to Leaflet 1.9.4
5
9
  Move to geoman for drawing shapes.
package/README.md CHANGED
@@ -13,9 +13,12 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
13
13
 
14
14
  ### Updates
15
15
 
16
+ - v4.0.0 - Breaking - Better context menu variable substitution and retention
17
+ Now uses ${name} syntax rather than $name so we can handle user defined variables in context menus.
18
+ - v3.2.0 - Sync up drawing sessions across browsers to same map
16
19
  - v3.1.0 - Add esri overlay layers, and let geojson overlay rendering be customised
17
20
  - v3.0.0 - Bump to Leaflet 1.9.4
18
- Move to geoman for drawing shapes.
21
+ Breaking - Move to geoman for drawing shapes.
19
22
  Allow command.rotation to set rotation of map.
20
23
  Allow editing of multipoint geojson tracks.
21
24
  - v2.43.1 - Tweak drawing layer double click
@@ -26,16 +29,6 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
26
29
  - v2.41.0 - Bump leaflet libs to latest stable (1.9.4)
27
30
  - v2.40.1 - Fix missing countries overlay when starting disconnected.
28
31
  - v2.40.0 - Add handling for TAK event points from TAK ingest node.
29
- - v2.39.0 - Add client timezone to connect message. PR #245
30
- - v2.38.3 - Better fix for geojson multipoint icons.
31
- - v2.38.1 - Fix for geojson multipoint icons.
32
- - v2.38.0 - Return client headers as part of connect message.
33
- - v2.37.4 - Fix sessionid specific data not to be sent on reload/refresh
34
- - v2.37.3 - Fix hang on layer change
35
- - v2.37.2 - If custom layer is only layer then show it automatically. Issue #230
36
- - v2.37.1 - Warn (and drop) messages that are missing a payload. Issue #229
37
- - v2.37.0 - Allow fly instead of fit option when using command to move view window. (PR #225)
38
- - v2.36.0 - Add edge icons for SIDC markers just off the map.
39
32
 
40
33
  - see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
41
34
 
@@ -82,12 +75,11 @@ Optional properties for **msg.payload** include
82
75
  - **popup** : html to fill the popup if you don't want the automatic default of the properties list. Using this overrides photourl, videourl and weblink options.
83
76
  - **label** : displays the contents as a permanent label next to the marker, or
84
77
  - **tooltip** : displays the contents when you hover over the marker. (Mutually exclusive with label. Label has priority)
85
- - **contextmenu** : an html fragment to display on right click of marker - defaults to delete marker. You can specify `$name` to pass in the name of the marker. Set to `""` to disable just this instance.
78
+ - **contextmenu** : an html fragment to display on right click of marker - defaults to delete marker. You can specify `${name}` to substitute in the name of the marker. Set to `""` to disable just this instance.
86
79
 
87
80
  Any other `msg.payload` properties will be added to the icon popup text box. This can be
88
81
  overridden by using the **popup** property to supply your own html content. If you use the
89
- popup property it will completely replace the contents so photourl, videourl and weblink are
90
- meaningless in this mode.
82
+ popup property it will completely replace the contents so photourl, videourl and weblink are meaningless in this mode.
91
83
 
92
84
  ### Icons
93
85
 
@@ -107,6 +99,7 @@ There are also several special icons...
107
99
  - **bus** : a bus/coach icon that aligns with the heading of travel.
108
100
  - **uav** : a small uav like icon that aligns with the heading of travel.
109
101
  - **helicopter** : a small helicopter icon that aligns with the heading of travel.
102
+ - **sensor** : a camera icon that points to the heading angle.
110
103
  - **arrow** : a map GPS arrow type pointer that aligns with the heading of travel.
111
104
  - **wind** : a wind arrow that points in the direction the wind is coming FROM.
112
105
  - **satellite** : a small satellite icon.
@@ -161,7 +154,7 @@ following the great circle between the two co-ordinates is plotted.
161
154
 
162
155
  msg.payload = {name:"GC1", color:"#ff00ff", greatcircle:[ [51.464,0], [25.76,-80.18] ] }
163
156
 
164
- Shapes can also have a **popup** property containing html, but you MUST also set a property `clickable:true` in order to allow it to be seen.
157
+ Shapes can also have a **popup** property containing html, but you MUST also set a property `clickable:true` in order to allow it to be seen. You can also set **tooltip** to create a label that appears when you hover the mouse over the shape.
165
158
 
166
159
  There are extra optional properties you can specify - see Options below.
167
160
 
@@ -200,7 +193,7 @@ You can add supplemental arc(s) to a marker by adding an **arc** property as bel
200
193
  Supplemental means that you can also specify a line using a **bearing** and **length** property.
201
194
 
202
195
  ```
203
- msg.payload = { name:"Camera01", icon:"fa-camera", lat:51.05, lon:-1.35,
196
+ msg.payload = { name:"Camera01", icon:"sensor", lat:51.05, lon:-1.35,
204
197
  bearing: 235,
205
198
  length: 2200,
206
199
  arc: {
@@ -259,7 +252,7 @@ Often geojson may not have a `properties` or `style` property in which case you
259
252
 
260
253
  2) You can just send a msg.payload containing the geojson itself - but obviously you then can't style it, set the name, layer, etc.
261
254
 
262
- 3) You can also add the geojson as a specific overlay, in which case you can also have more control of styles, and per feature customisations. See the section on overlays [below](#to-add-a-new-geojson-overlay). This is the most complex but customisable.
255
+ 3) You can also add the geojson as a specific overlay, in which case you can also have more control of styles, and per feature customisations. See the section on overlays [below](#to-add-a-new-geojson-overlay). This is the most complex but also the most customisable.
263
256
 
264
257
 
265
258
  ### Options
@@ -275,6 +268,7 @@ Areas, Rectangles, Lines, Circles and Ellipses can also specify more optional pr
275
268
  - **clickable** : boolean - set to true to allow click to show popup.
276
269
  - **popup** : html string to display in popup (as well as name).
277
270
  - **editable** : boolean - set to true to allow simple edit/delete right click contextmenu.
271
+ - **tooltip** : Text string to display on mouse hover over the shape.
278
272
  - **contextmenu** : html string to display a more complex right click contextmenu.
279
273
  - **weight** : the width of the line or outline.
280
274
 
@@ -282,6 +276,7 @@ Other properties can be found in the leaflet documentation.
282
276
 
283
277
  Shapes can also have a **popup** property containing html, but you MUST also set a property `clickable:true` in order to allow it to be seen.
284
278
 
279
+
285
280
  ### Drawing
286
281
 
287
282
  A single *right click* will allow you to add a point to the map - you must specify the `name` and optionally the `icon` and `layer`.
@@ -289,7 +284,9 @@ A single *right click* will allow you to add a point to the map - you must speci
289
284
  Right-clicking on an icon will allow you to delete it.
290
285
 
291
286
  If you select the **drawing** layer you can also add and edit polylines, polygons, rectangles and circles.
292
- Once an item is drawn you can right click to edit or delete it. Double click the object to exit edit mode.
287
+ Once an item is drawn you can right click to edit or delete it.
288
+
289
+ Double click the object to exit edit mode.
293
290
 
294
291
 
295
292
  ### Buildings
@@ -382,7 +379,7 @@ The **worldmap in** node can be used to receive various events from the map. Exa
382
379
 
383
380
  { "action": "feedback", "name": "some name", "value": "some value", "lat":51, "lon":0, "layer":"unknown" } // when a user calls the feedback function - see below
384
381
 
385
- If File Drop is enabled - then the map can accept files of type gpx, kml, nvg, jpeg, png and geojson. The file content property will always be a binary buffer. The lat, lon of the cursor drop point will be included. Tracks will be locally rendered on the map. The node-red-node-exif node can be used to extract location information from a jpeg image and then geolocate it back on the map. Png images will be located where they are dropped but can then be dragged if required.
382
+ If File Drop is enabled - then the map can accept files of type gpx, kml, nvg, jpeg, png and geojson. The file content property will always be a binary buffer. The lat, lon of the cursor drop point will be included. Tracks will be locally rendered on the map. The `node-red-node-exif` node can be used to extract location information from a jpeg image and then geolocate it back on the map. Png images will be located where they are dropped but can then be dragged if required.
386
383
 
387
384
  All actions also include a:
388
385
  `msg._sessionid` property that indicates which client session they came from. Any msg sent out that includes this property will ONLY be sent to that session - so you can target map updates to specific sessions if required.
@@ -398,20 +395,22 @@ The "connected" action additionally includes a:
398
395
 
399
396
  There are some internal functions available to make interacting with Node-RED easier (e.g. from inside a user defined popup., these include:
400
397
 
401
- - **feedback()** : it takes 2, 3, or 4 parameters, name, value, and optionally an action name (defaults to "feedback"), and optional boolean to close the popup on calling this function, and can be used inside something like an input tag - `onchange='feedback(this.name,this.value,null,true)'`. Value can be a more complex object if required as long as it is serialisable. If used with a marker the name should be that of the marker - you can use `$name` to let it be substituted automatically.
398
+ - **feedback()** : it takes 2, 3, or 4 parameters, name, value, and optionally an action name (defaults to "feedback"), and optional boolean to close the popup on calling this function, and can be used inside something like an input tag - `onchange='feedback(this.name,this.value,null,true)'`. Value can be a more complex object if required as long as it is serialisable. If used with a marker the name should be that of the marker - you can use `${name}` to let it be substituted automatically.
399
+
400
+ - **addToForm()** : takes a property name value pair to add to a variable called `form`. When used with contextmenu feedback (above) you can set the feedback value to `"_form"` to substitute this accumulated value. This allows you to do things like `onBlur='addToForm(this.name,this.value)'` over several different fields in the menu and then use `feedback(this.name,"_form")` to submit them all at once. For example a simple multiple line form could be as per the example below:
402
401
 
403
- - **addToForm()** : takes a property name value pair to add to a variable called form. When used with contextmenu feedback (above) you can set the feedback value to `"$form"` to substitute this accumulated value. This allows you to do things like `onChange='addToForm(this.name,this.value)'` over several different fields in the menu and then use `feedback(this.name,"$form")` to submit them all at once. For example a simple multiple line form could be:
402
+ Also if you wish to retain the values between separate openings of this form you can assign property names to the value field in the form `value="${foo}`, etc. These will then appear as part of an **value** property on the worldmap-in node message.
404
403
 
405
404
  ```
406
- var menu = 'Add some data <input name="foo" onchange=\'addToForm(this.name,this.value)\'></input><br/>'
407
- menu += 'Add more data <input name="bar" onchange=\'addToForm(this.name,this.value)\'></input><br/>'
408
- menu += '<button name="my_form" onclick=\'feedback(this.name,"$form",null,true)\'>Submit</button>'
405
+ var menu = 'Add some data <input name="foo" value="${foo}" onchange=\'addToForm(this.name,this.value)\'></input><br/>'
406
+ menu += 'Add more data <input name="bar" value="${bar}" onchange=\'addToForm(this.name,this.value)\'></input><br/>'
407
+ menu += '<button name="my_form" onclick=\'feedback(this.name,"_form",null,true)\'>Submit</button>'
409
408
  msg.payload = { command: { "contextmenu":menu } }
410
409
  ```
411
410
 
412
- - **delMarker()** : takes the name of the marker as a parameter. In a popup this can be specified as `$name` for dynamic substitution.
411
+ - **delMarker()** : takes the name of the marker as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
413
412
 
414
- - **editPoly()** : takes the name of the shape or line as a parameter. In a popup this can be specified as `$name` for dynamic substitution.
413
+ - **editPoly()** : takes the name of the shape or line as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
415
414
 
416
415
 
417
416
  ## Controlling the map
@@ -422,15 +421,15 @@ Optional properties for **msg.payload.command** include
422
421
 
423
422
  - **lat** - move map to specified latitude.
424
423
  - **lon** - move map to specified longitude.
425
- - **rotation** - rotate the base map to the specified compass angle.
426
424
  - **zoom** - move map to specified zoom level (1 - world, 13 to 20 max zoom depending on map).
427
425
  - **bounds** - if set to an array `[ [ lat(S), lon(W) ], [lat(N), lon(E)] ]` - sets the overall map bounds.
426
+ - **rotation** - rotate the base map to the specified compass angle.
428
427
  - **layer** - set map to specified base layer name - `{"command":{"layer":"Esri"}}`
429
428
  - **search** - search markers on map for name containing `string`. If not found in existing markers, will then try geocoding looking using Nominatim. An empty string `""` clears the search results. - `{"command":{"search":"Winchester"}}`
430
429
  - **showlayer** - show the named overlay(s) - `{"command":{"showlayer":"foo"}}` or `{"command":{"showlayer":["foo","bar"]}}`
431
430
  - **hidelayer** - hide the named overlay(s) - `{"command":{"hidelayer":"bar"}}` or `{"command":{"hidelayer":["bar","another"]}}`
432
431
  - **side** - add a second map alongside with slide between them. Use the name of a *baselayer* to add - or "none" to remove the control. - `{"command":{"side":"Esri Satellite"}}`
433
- - **split** - once you have split the screen - the split value is the % across the screen of the split line. - `{"command":{"split":50}}`
432
+ - **split** - once you have split the screen with the *side* command - the split value is then the % across the screen of the split line. - `{"command":{"split":50}}`
434
433
  - **map** - Object containing details of a new map layer:
435
434
  - **name** - name of the map base layer OR **overlay** - name of overlay layer
436
435
  - **url** - url of the map layer
@@ -451,7 +450,7 @@ Optional properties for **msg.payload.command** include
451
450
  a msg `{"action":"button", "name":"the_button_name"}` to the worldmap in node. If supplied with a `name` property only, it will remove the button. Optional `position` property can be 'bottomright', 'bottomleft', 'topleft' or 'topright' (default). button can also be an array of button objects.
452
451
  - **contextmenu** - html string to define the right click menu when not on a marker. Defaults to the simple add marker input. Empty string `""` disables this right click.
453
452
  - **toptitle** - Words to replace title in title bar (if not in iframe)
454
- - **toplogo** - URL to logo image for top tile bar (if not in iframe) - ideally 60px by 24px.
453
+ - **toplogo** - URL to logo image for top title bar (if not in iframe) - ideally 60px by 24px.
455
454
  - **trackme** - Turns on/off the browser self locating. Boolean false = off, true = cyan circle showing accuracy error, or an object like `{"command":{"trackme":{"name":"Dave","icon":"car","iconColor":"blue","layer":"mytrack","accuracy":false}}}`. Usual marker options can be applied.
456
455
  - **showmenu** - Show or hide the display of the hamberger menu control in the top right . Values can be "show" or "hide". - `{"command":{"showmenu": "hide"}}`
457
456
  - **showlayers** - Show or hide the display of selectable layers. Does not control the display of an individual layer, rather a users ability to interact with them. Values can be "show" or "hide". - `{"command":{"showlayers": "hide"}}`
@@ -487,11 +486,11 @@ careful escaping quotes, and that they remain matched.
487
486
 
488
487
  For example a marker popup with a slider (note the \ escaping the internal ' )
489
488
 
490
- popup: '<input name="slide1" type="range" min="1" max="100" value="50" onchange=\'feedback($name,this.value,this.name)\' style="width:250px;">'
489
+ popup: '<input name="slide1" type="range" min="1" max="100" value="50" onchange=\'feedback(${name},this.value,this.name)\' style="width:250px;">'
491
490
 
492
491
  Or a marker contextmenu with an input box
493
492
 
494
- contextmenu: '<input name="channel" type="text" value="5" onchange=\'feedback($name,{"name":this.name,"value":this.value},"myFeedback")\' />'
493
+ contextmenu: '<input name="channel" type="text" value="5" onchange=\'feedback(${name},{"name":this.name,"value":this.value},"myFeedback")\' />'
495
494
 
496
495
  Or you can add a contextmenu to the map. Simple contextmenu with a button
497
496
 
@@ -511,7 +510,6 @@ Example simple form
511
510
  [{"id":"7351100bacb1f5fe","type":"function","z":"4aa2ed2fd1b11362","name":"","func":"msg.payload = { command: {\ncontextmenu: String.raw`\nText <input type=\"text\" id=\"sometext\" value=\"hello\"><br/>\nNumber <input type=\"number\" id=\"somenum\" value=\"5\"><br/>\n<input type=\"button\" value=\"Send\" onclick=\n'feedback(\"myform\",{\n \"st\":document.getElementById(\"sometext\").value,\n \"sn\":document.getElementById(\"somenum\").value,\n})'\n>\n`\n}}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":360,"wires":[["a6a82f2e8efc44fc"]]},{"id":"7b595f0c8f6ac710","type":"worldmap in","z":"4aa2ed2fd1b11362","name":"","path":"/worldmap","events":"connect","x":195,"y":360,"wires":[["7351100bacb1f5fe"]]}]
512
511
  ```
513
512
 
514
-
515
513
  See the section on **Utility Functions** for details of the feedback function.
516
514
 
517
515
  #### To add and remove a legend
@@ -607,7 +605,7 @@ The `fit` property is optional, and you can also use `fly` if you wish. If boole
607
605
 
608
606
  #### To add a new KML, GPX, or TOPOJSON overlay
609
607
 
610
- As per the geojson overlay you can also inject a KML layer, GPX layer or TOPOJSON layer. The syntax is the same but with either a `kml` property containing the KML string - a `gpx` property containing a GPX string - or a `topojson` property containing the topojson.
608
+ As with the geojson overlay, you can also inject a KML layer, GPX layer or TOPOJSON layer. The syntax is the same but with either a `kml` property containing the KML string - a `gpx` property containing a GPX string - or a `topojson` property containing the topojson.
611
609
 
612
610
  msg.payload.command.map = {
613
611
  "overlay": "myKML",
@@ -703,7 +701,7 @@ Feeding this into the tracks node will also remove the tracks stored for that la
703
701
 
704
702
  ### Using a local Map Server (WMS server)
705
703
 
706
- IMHO the easiest map server to make work is the <a href="http://www.mapserver.org/" target="mapinfo">mapserver</a> package in Ubuntu / Debian. Usually you will start with
704
+ IMHO the easiest WMS map server to make work is the <a href="http://www.mapserver.org/" target="mapinfo">mapserver</a> package in Ubuntu / Debian. Usually you will start with
707
705
 
708
706
  sudo apt-get install mapserver-bin cgi-mapserver gdal-bin
709
707
 
@@ -733,7 +731,6 @@ You can then add a new WMS Base layer by injecting a message like
733
731
  "wms": true // set to true for WMS type mapserver
734
732
  }}}
735
733
 
736
-
737
734
  #### Using a Docker Map Server
738
735
 
739
736
  You can use a docker container like https://hub.docker.com/r/camptocamp/mapserver, then assuming you have the mapfile 'my-app.map' in the current working directory, you could mount it as:
@@ -771,7 +768,7 @@ The following example gets recent earthquakes from USGS, parses the result,
771
768
  formats up the msg as per above and sends to the node to plot on the map.
772
769
  It also shows how to zoom and move the map or add a new layer.
773
770
 
774
- [{"id":"86457344.50e6b","type":"inject","z":"745a133b.dd6dec","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":190,"y":2420,"wires":[["9a142026.fa47f"]]},{"id":"9a142026.fa47f","type":"function","z":"745a133b.dd6dec","name":"add new layer","func":"msg.payload = {};\nmsg.payload.command = {};\n\nvar u = 'http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png';\nvar o = { maxZoom: 19, attribution: '&copy; OpenStreetMap'};\n\nmsg.payload.command.map = {name:\"OSMhot\", url:u, opt:o};\nmsg.payload.command.layer = \"OSMhot\";\n\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":2420,"wires":[["c643e022.1816c"]]},{"id":"c643e022.1816c","type":"worldmap","z":"745a133b.dd6dec","name":"","x":750,"y":2460,"wires":[]},{"id":"2998e233.4ba64e","type":"function","z":"745a133b.dd6dec","name":"USGS Quake monitor csv re-parse","func":"msg.payload.lat = msg.payload.latitude;\nmsg.payload.lon = msg.payload.longitude;\nmsg.payload.layer = \"earthquake\";\nmsg.payload.name = msg.payload.id;\nmsg.payload.icon = \"globe\";\nmsg.payload.iconColor = \"orange\";\n\ndelete msg.payload.latitude;\ndelete msg.payload.longitude;\t\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":2560,"wires":[["c643e022.1816c"]]},{"id":"e72c5732.9fa198","type":"function","z":"745a133b.dd6dec","name":"move and zoom","func":"msg.payload = { command:{layer:\"Esri Terrain\",lat:0,lon:0,zoom:3} };\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":2460,"wires":[["c643e022.1816c"]]},{"id":"12317723.589249","type":"csv","z":"745a133b.dd6dec","name":"","sep":",","hdrin":true,"hdrout":"","multi":"one","ret":"\\n","temp":"","x":390,"y":2500,"wires":[["2998e233.4ba64e"]]},{"id":"10e5e5f0.8daeaa","type":"inject","z":"745a133b.dd6dec","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":190,"y":2460,"wires":[["e72c5732.9fa198"]]},{"id":"b6917d83.d1bac","type":"http request","z":"745a133b.dd6dec","name":"","method":"GET","url":"http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.csv","x":270,"y":2560,"wires":[["12317723.589249"]]},{"id":"3842171.4d487e8","type":"inject","z":"745a133b.dd6dec","name":"Quakes","topic":"","payload":"","payloadType":"none","repeat":"900","crontab":"","once":false,"x":200,"y":2500,"wires":[["b6917d83.d1bac"]]}]
771
+ [{"id":"86457344.50e6b","type":"inject","z":"cb7b09e3354afd4c","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"none","x":170,"y":500,"wires":[["9a142026.fa47f"]]},{"id":"9a142026.fa47f","type":"function","z":"cb7b09e3354afd4c","name":"add new layer","func":"msg.payload = {};\nmsg.payload.command = {};\n\nvar u = 'http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png';\nvar o = { maxZoom: 19, attribution: '&copy; OpenStreetMap'};\n\nmsg.payload.command.map = {name:\"OSMhot\", url:u, opt:o};\nmsg.payload.command.layer = \"OSMhot\";\n\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":500,"wires":[["c643e022.1816c"]]},{"id":"c643e022.1816c","type":"worldmap","z":"cb7b09e3354afd4c","name":"","lat":"30","lon":"0","zoom":"3","layer":"OSMG","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"deg","showgrid":"false","showruler":"false","allowFileDrop":"false","path":"worldmap","overlist":"CO,RA,DN","maplist":"OSMG,OSMH,EsriS","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":640,"y":540,"wires":[]},{"id":"2998e233.4ba64e","type":"function","z":"cb7b09e3354afd4c","name":"USGS Quake monitor csv re-parse","func":"msg.payload.lat = msg.payload.latitude;\nmsg.payload.lon = msg.payload.longitude;\nmsg.payload.layer = \"earthquake\";\nmsg.payload.name = msg.payload.id;\nmsg.payload.icon = \"globe\";\nmsg.payload.iconColor = \"orange\";\n\ndelete msg.payload.latitude;\ndelete msg.payload.longitude;\t\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":640,"wires":[["c643e022.1816c"]]},{"id":"e72c5732.9fa198","type":"function","z":"cb7b09e3354afd4c","name":"move and zoom","func":"msg.payload = { command:{layer:\"Esri Terrain\",lat:0,lon:-90,zoom:2} };\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":540,"wires":[["c643e022.1816c"]]},{"id":"12317723.589249","type":"csv","z":"cb7b09e3354afd4c","name":"","sep":",","hdrin":true,"hdrout":"","multi":"one","ret":"\\n","temp":"","x":370,"y":580,"wires":[["2998e233.4ba64e"]]},{"id":"10e5e5f0.8daeaa","type":"inject","z":"cb7b09e3354afd4c","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"none","x":170,"y":540,"wires":[["e72c5732.9fa198"]]},{"id":"b6917d83.d1bac","type":"http request","z":"cb7b09e3354afd4c","name":"","method":"GET","url":"http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.csv","x":250,"y":640,"wires":[["12317723.589249"]]},{"id":"3842171.4d487e8","type":"inject","z":"cb7b09e3354afd4c","name":"Quakes","repeat":"900","crontab":"","once":false,"topic":"","payload":"","payloadType":"none","x":180,"y":580,"wires":[["b6917d83.d1bac"]]}]
775
772
 
776
773
  ---
777
774
 
@@ -0,0 +1 @@
1
+ [{"id":"573ef3eef64ca4c1","type":"worldmap","z":"70a15c4047f2ce55","name":"","lat":"34","lon":"-119","zoom":"10","layer":"OSMG","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"deg","showgrid":"false","showruler":"false","allowFileDrop":"false","path":"/worldmap","overlist":"CO","maplist":"OSMG,OSMH,EsriC,EsriS","mapname":"LocalOSM","mapurl":"http://localhost:1885/styles/light/{z}/{x}/{y}.png","mapopt":"","mapwms":false,"x":680,"y":560,"wires":[]},{"id":"db4b02196f09bc6f","type":"inject","z":"70a15c4047f2ce55","name":"trailheads","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":560,"wires":[["8dbe012b2a894e9b"]]},{"id":"8dbe012b2a894e9b","type":"function","z":"70a15c4047f2ce55","name":"function 2","func":"\nconst style = function () {\n return { color: \"#000091\", weight: 2 };\n};\n\nconst pointToLayer = function (geojson, latlng) {\n console.log(\"Point geo\", latlng, geojson);\n return L.circleMarker(latlng).bindPopup(geojson.properties.TRL_NAME);\n};\n\nconst onEachFeature = function (geojson, layer) {\n console.log(\"Feature\", layer, geojson);\n};\n\nmsg.payload = {\n command : {\n map : {\n overlay : \"Trailheads\",\n esri: \"https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads_Styled/FeatureServer/0\",\n opt: {\n style: style.toString(),\n pointToLayer: pointToLayer.toString(),\n onEachFeature: onEachFeature.toString()\n }\n }\n }\n}\nreturn msg;","outputs":1,"noerr":5,"initialize":"","finalize":"","libs":[],"x":400,"y":560,"wires":[["573ef3eef64ca4c1"]]},{"id":"310aa5b8f88c225c","type":"inject","z":"70a15c4047f2ce55","name":"trails","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":210,"y":600,"wires":[["ec8831289bfb117c"]]},{"id":"ec8831289bfb117c","type":"function","z":"70a15c4047f2ce55","name":"function 3","func":"\nconst style = function () {\n return { color: \"#009100\", weight: 3 };\n};\n\nconst onEachFeature = function (geojson, layer) {\n console.log(\"Feature\", layer, geojson);\n};\n\nmsg.payload = {\n command : {\n map : {\n overlay : \"Trails\",\n esri: \"https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails_Styled/FeatureServer/0\",\n opt: {\n style: style.toString(),\n onEachFeature: onEachFeature.toString()\n }\n }\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":600,"wires":[["573ef3eef64ca4c1"]]},{"id":"55fb1ea255465f0e","type":"inject","z":"70a15c4047f2ce55","name":"parks","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":210,"y":640,"wires":[["f23b7921618df33e"]]},{"id":"f23b7921618df33e","type":"function","z":"70a15c4047f2ce55","name":"function 4","func":"\nconst style = function () {\n return {\n color: \"#910000\", \n weight: 1,\n \"fillColor\": \"#808000\",\n \"fillOpacity\": 0.1 };\n};\n\nconst onEachFeature = function (feature, layer) {\n console.log(\"Feature\", feature);\n layer.bindPopup(feature.properties.PARK_NAME)\n};\n\nmsg.payload = {\n command : {\n map : {\n overlay : \"Parks\",\n esri: \"https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Parks_and_Open_Space_Styled/FeatureServer/0\",\n opt: {\n maxZoom: 13,\n minZoom: 9,\n style: style.toString(),\n onEachFeature: onEachFeature.toString()\n }\n }\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":640,"wires":[["573ef3eef64ca4c1"]]}]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
4
  "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
5
5
  "dependencies": {
6
6
  "@turf/bezier-spline": "~6.5.0",