allow loading overlays hidden
to also not trigger addlayer event to close #108
This commit is contained in:
parent
09dfaa052f
commit
5a99aaf57d
@ -1,5 +1,6 @@
|
|||||||
### Change Log for Node-RED Worldmap
|
### Change Log for Node-RED Worldmap
|
||||||
|
|
||||||
|
- v2.0.21 - allow adding overlays without making them visible (visible:false) - Issue #108
|
||||||
- v2.0.20 - ensure `fit` option is boolean, Issue #109. Fix track layers, Issue #110.
|
- v2.0.20 - ensure `fit` option is boolean, Issue #109. Fix track layers, Issue #110.
|
||||||
- v2.0.18 - Stop map contextmenu bleedthrough to marker. Add compress middleware.
|
- v2.0.18 - Stop map contextmenu bleedthrough to marker. Add compress middleware.
|
||||||
- v2.0.17 - Let clear command also clear tracks from tracks node
|
- v2.0.17 - Let clear command also clear tracks from tracks node
|
||||||
|
@ -9,6 +9,7 @@ map web page for plotting "things" on.
|
|||||||
|
|
||||||
### Updates
|
### Updates
|
||||||
|
|
||||||
|
- v2.0.21 - allow adding overlays without making them visible (visible:false) - Issue #108
|
||||||
- v2.0.20 - ensure `fit` option is boolean, Issue #109. Fix track layers, Issue #110.
|
- v2.0.20 - ensure `fit` option is boolean, Issue #109. Fix track layers, Issue #110.
|
||||||
- v2.0.18 - Stop map contextmenu bleedthrough to marker. Add compress middleware.
|
- v2.0.18 - Stop map contextmenu bleedthrough to marker. Add compress middleware.
|
||||||
- v2.0.17 - Let clear command also clear tracks from tracks node
|
- v2.0.17 - Let clear command also clear tracks from tracks node
|
||||||
@ -399,6 +400,8 @@ To add an overlay instead of a base layer - specify the `overlay` property inste
|
|||||||
"wms": true
|
"wms": true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
By default the overlay will be instantly visible. To load it hidden add a property to the command.map - `visible:false`
|
||||||
|
|
||||||
#### To add a new geoJSON overlay
|
#### To add a new geoJSON overlay
|
||||||
|
|
||||||
msg.payload.command.map = {
|
msg.payload.command.map = {
|
||||||
@ -431,7 +434,7 @@ As per the geojson overlay you can also inject a KML layer, GPX layer or TOPOJSO
|
|||||||
- **icon** : <a href="https://fontawesome.com/v4.7.0/icons/" target="mapinfo">font awesome</a> icon name.
|
- **icon** : <a href="https://fontawesome.com/v4.7.0/icons/" target="mapinfo">font awesome</a> icon name.
|
||||||
- **iconColor** : Standard CSS colour name or #rrggbb hex value.
|
- **iconColor** : Standard CSS colour name or #rrggbb hex value.
|
||||||
|
|
||||||
Again the boolean `fit` property can be added to make the map zoom to the relevant area.
|
Again the boolean `fit` property can be added to make the map zoom to the relevant area, and the `visible` property can be set false to not immediately show the layer.
|
||||||
|
|
||||||
#### To add a Velocity Grid Overlay
|
#### To add a Velocity Grid Overlay
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-contrib-web-worldmap",
|
"name": "node-red-contrib-web-worldmap",
|
||||||
"version": "2.0.20",
|
"version": "2.0.21",
|
||||||
"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": {
|
||||||
"cgi": "0.3.1",
|
"cgi": "0.3.1",
|
||||||
|
@ -1677,7 +1677,9 @@ function doCommand(cmd) {
|
|||||||
if (!existsalready) {
|
if (!existsalready) {
|
||||||
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
||||||
}
|
}
|
||||||
|
if (!cmd.map.hasOwnProperty("visible") || (cmd.map.visible != false)) {
|
||||||
map.addLayer(overlays[cmd.map.overlay]);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
|
}
|
||||||
if (cmd.map.hasOwnProperty("fit") && (cmd.map.fit === true)) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
if (cmd.map.hasOwnProperty("fit") && (cmd.map.fit === true)) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
||||||
}
|
}
|
||||||
// Add a new NVG XML overlay layer
|
// Add a new NVG XML overlay layer
|
||||||
@ -1716,7 +1718,9 @@ function doCommand(cmd) {
|
|||||||
if (!existsalready) {
|
if (!existsalready) {
|
||||||
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
||||||
}
|
}
|
||||||
|
if (!cmd.map.hasOwnProperty("visible") || (cmd.map.visible != false)) {
|
||||||
map.addLayer(overlays[cmd.map.overlay]);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
|
}
|
||||||
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
||||||
}
|
}
|
||||||
var custIco = function() {
|
var custIco = function() {
|
||||||
@ -1747,7 +1751,9 @@ function doCommand(cmd) {
|
|||||||
if (!existsalready) {
|
if (!existsalready) {
|
||||||
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
||||||
}
|
}
|
||||||
|
if (!cmd.map.hasOwnProperty("visible") || (cmd.map.visible != false)) {
|
||||||
map.addLayer(overlays[cmd.map.overlay]);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
|
}
|
||||||
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
||||||
}
|
}
|
||||||
// Add a new TOPOJSON overlay layer
|
// Add a new TOPOJSON overlay layer
|
||||||
@ -1760,7 +1766,9 @@ function doCommand(cmd) {
|
|||||||
if (!existsalready) {
|
if (!existsalready) {
|
||||||
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
||||||
}
|
}
|
||||||
|
if (!cmd.map.hasOwnProperty("visible") || (cmd.map.visible != false)) {
|
||||||
map.addLayer(overlays[cmd.map.overlay]);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
|
}
|
||||||
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
||||||
}
|
}
|
||||||
// Add a new GPX overlay layer
|
// Add a new GPX overlay layer
|
||||||
@ -1774,7 +1782,9 @@ function doCommand(cmd) {
|
|||||||
if (!existsalready) {
|
if (!existsalready) {
|
||||||
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
||||||
}
|
}
|
||||||
|
if (!cmd.map.hasOwnProperty("visible") || (cmd.map.visible != false)) {
|
||||||
map.addLayer(overlays[cmd.map.overlay]);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
|
}
|
||||||
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
||||||
}
|
}
|
||||||
// Add a new velocity overlay layer
|
// Add a new velocity overlay layer
|
||||||
@ -1787,7 +1797,9 @@ function doCommand(cmd) {
|
|||||||
if (!existsalready) {
|
if (!existsalready) {
|
||||||
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
||||||
}
|
}
|
||||||
|
if (!cmd.map.hasOwnProperty("visible") || (cmd.map.visible != false)) {
|
||||||
map.addLayer(overlays[cmd.map.overlay]);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
|
}
|
||||||
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
if (cmd.map.hasOwnProperty("fit")) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
||||||
}
|
}
|
||||||
// Add a new overlay layer
|
// Add a new overlay layer
|
||||||
@ -1814,8 +1826,10 @@ function doCommand(cmd) {
|
|||||||
if (!existsalready) {
|
if (!existsalready) {
|
||||||
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
||||||
}
|
}
|
||||||
|
if (!cmd.map.hasOwnProperty("visible") || (cmd.map.visible != false)) {
|
||||||
map.addLayer(overlays[cmd.map.overlay]);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Swap a base layer
|
// Swap a base layer
|
||||||
if (cmd.layer && basemaps.hasOwnProperty(cmd.layer)) {
|
if (cmd.layer && basemaps.hasOwnProperty(cmd.layer)) {
|
||||||
map.removeLayer(basemaps[baselayername]);
|
map.removeLayer(basemaps[baselayername]);
|
||||||
|
Loading…
Reference in New Issue
Block a user