diff --git a/CHANGELOG.md b/CHANGELOG.md index dc9a7ad..95f2b40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ### Change Log for Node-RED Worldmap - - v2.3.12 - Fix geoson feature properties fill color + - v2.3.13 - Fix geoson feature properties fill color, and better marker handling - v2.3.11 - Better editing of drawing layer, add OpenTopoMap, and better Esri satellite - v2.3.10 - Improve geojson layer and name handling. - v2.3.8 - Fix fa-marker offset to improve accuracy. diff --git a/README.md b/README.md index d8dbce4..b91dbf7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ map web page for plotting "things" on. ### Updates -- v2.3.12 - Fix geoson feature properties fill color +- v2.3.13 - Fix geoson feature properties fill color, and better marker handling - v2.3.11 - Better editing of drawing layer, add OpenTopoMap, and better Esri satellite - v2.3.10 - Improve geojson layer and name handling. - v2.3.8 - Fix fa-marker offset to improve accuracy. diff --git a/package.json b/package.json index 4b6cec2..7948192 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-web-worldmap", - "version": "2.3.12", + "version": "2.3.13", "description": "A Node-RED node to provide a web page of a world map for plotting things on.", "dependencies": { "cgi": "0.3.1", diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index 9cb6587..56388dc 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -2094,6 +2094,11 @@ function doGeojson(n,g,l,o) { st.weight = feature.properties["stroke-width"] || st.weight; st.fillColor = feature.properties["fill-color"] || feature.properties["fill"] || st.fillColor; st.fillOpacity = feature.properties["fill-opacity"] || st.fillOpacity; + delete feature.properties["stroke"]; + delete feature.properties["stroke-width"]; + delete feature.properties["fill-color"]; + delete feature.properties["fill"]; + delete feature.properties["fill-opacity"]; } if (feature.hasOwnProperty("style")) { //console.log("GSTYLE", feature.style) @@ -2107,6 +2112,21 @@ function doGeojson(n,g,l,o) { } return st; }} + opt.pointToLayer = function (feature, latlng) { + var myMarker = L.VectorMarkers.icon({ + icon: feature.properties["marker-symbol"] || "circle", + markerColor: (feature.properties["marker-color"] || "#910000"), + prefix: 'fa', + iconColor: 'white' + }); + if (!feature.properties.hasOwnProperty("title")) { + feature.properties.title = feature.properties["marker-symbol"]; + } + delete feature.properties["marker-symbol"]; + delete feature.properties["marker-color"]; + delete feature.properties["marker-size"]; + return L.marker(latlng, {title:feature.properties.title || "", icon:myMarker,}); + } opt.onEachFeature = function (f,l) { if (f.properties) { l.bindPopup('
'+JSON.stringify(f.properties,null,' ').replace(/[\{\}"]/g,'')+'
'); } }