tidy geojson handling slughtly.

This commit is contained in:
Dave Conway-Jones 2021-09-10 14:57:52 +01:00
parent 6234299fd4
commit 71a979b75d
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
4 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap
- v2.15.6 - Tidy up geoJson handling a bit more.
- v2.15.5 - Fix SDIC icons to accept unicoded icons as labels.
- v2.15.4 - Let clear heatmap command do what it says.
- v2.15.3 - Fix panit command to work, try to use alt units, popup alignments.

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates
- v2.15.6 - Tidy up geoJson handling a bit more.
- v2.15.5 - Fix SDIC icons to accept unicoded icons as labels.
- v2.15.4 - Let clear heatmap command do what it says.
- v2.15.3 - Fix panit command to work, try to use alt units, popup alignments.

View File

@ -1,6 +1,6 @@
{
"name": "node-red-contrib-web-worldmap",
"version": "2.15.5",
"version": "2.15.6",
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": {
"cgi": "0.3.1",

View File

@ -2526,8 +2526,14 @@ function doGeojson(n,g,l,o) {
return L.marker(latlng, {title:feature.properties.title || "", icon:myMarker});
}
opt.onEachFeature = function (f,l) {
if (f.properties) { l.bindPopup('<pre style="overflow-x: scroll">'+JSON.stringify(f.properties,null,' ').replace(/[\{\}"]/g,'')+'</pre>'); }
if (o.hasOwnProperty("clickable") && o.clickable === true) {
if (f.properties && Object.keys(f.properties).length > 0) {
var tx = JSON.stringify(f.properties,null,' ');
if ( tx !== "{}") {
l.bindPopup('<pre style="overflow-x: scroll">'+JSON.stringify(f.properties,null,' ').replace(/[\{\}"]/g,'')+'</pre>');
}
}
if (o && o.hasOwnProperty("clickable") && o.clickable === true) {
l.on('click', function (e) {
ws.send(JSON.stringify({action:"clickgeo",name:n,type:f.type,properties:f.properties,geometry:f.geometry}));
});