Skip to content

Commit 187fcc5

Browse files
committed
tweak display of geojson properties
1 parent c0433ce commit 187fcc5

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Change Log for Node-RED Worldmap
22

3+
- v5.5.4 - slight tweak to geojson property display as table
34
- v5.5.3 - ensure SOG gets picked up earlier in chain
45
- v5.5.2 - Slight improvement for on/offline choice of map
56
- v5.5.1 - Fix maxNativeZoom for pmtiles to pull from tiles files. Issue #312

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ A <a href="https://nodered.org" target="mapinfo">Node-RED</a> node to provide a
1010

1111
### Updates
1212

13+
- v5.5.4 - slight tweak to geojson property display as table
1314
- v5.5.3 - ensure SOG gets picked up earlier in chain
1415
- v5.5.2 - Slight improvement for on/offline choice of map
1516
- v5.5.1 - Fix maxNativeZoom for pmtiles to pull from tiles files. Issue #312

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-contrib-web-worldmap",
3-
"version": "5.5.3",
3+
"version": "5.5.4",
44
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
55
"dependencies": {
66
"@turf/bezier-spline": "~7.2.0",

worldmap/worldmap.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3255,6 +3255,9 @@ function doGeojson(n,g,l,o,i) { // name, geojson, layer, options, icon
32553255
delete feature.properties["fill-opacity"];
32563256
delete feature.properties["font-color"];
32573257
delete feature.properties["font-opacity"];
3258+
// delete feature.properties["styleUrl"];
3259+
delete feature.properties["styleHash"];
3260+
delete feature.properties["styleMapHash"];
32583261
}
32593262
if (feature.hasOwnProperty("style")) {
32603263
//console.log("GSTYLE", feature.style)
@@ -3338,12 +3341,21 @@ function doGeojson(n,g,l,o,i) { // name, geojson, layer, options, icon
33383341
delete tx["_gpxType"];
33393342
var n = tx["name"];
33403343
delete tx["name"];
3341-
tx = JSON.stringify(tx,null,' ');
3342-
if ( tx !== "{}") {
3343-
var gp = '<pre style="overflow-x:scroll">'+tx.replace(/[\{\}"]/g,'')+'</pre>'
3344-
if (n) { gp = '<b>'+n+'</b>' + gp; }
3345-
l.bindPopup(gp);
3346-
}
3344+
var tx2 = Object.entries(tx);
3345+
var gp = '<table style="border:none;">';
3346+
for (var i=0; i < tx2.length; i++) {
3347+
gp += '<tr><td style="border:none; vertical-align:top; padding-right:3px;">'+tx2[i][0]+'</td><td style="border:none; vertical-align:top;">'+tx2[i][1]+'</td></tr>';
3348+
}
3349+
gp += '</table>';
3350+
//tx = JSON.stringify(tx,null,' ');
3351+
// if ( tx !== "{}") {
3352+
// //var gp = '<pre style="overflow-x:scroll">'+tx.replace(/[\{\}"]/g,'')+'</pre>'
3353+
// var gp = '<pre>'+tx.replace(/[\{\}"]/g,'')+'</pre>'
3354+
// if (n) { gp = '<b>'+n+'</b>' + gp; }
3355+
// l.bindPopup(gp);
3356+
// }
3357+
if (n) { gp = '<b>'+n+'</b>' + gp; }
3358+
if (gp.length > 36) { l.bindPopup(gp); }
33473359
}
33483360
if (o && o.hasOwnProperty("clickable") && o.clickable === true) {
33493361
l.on('click', function (e) {

0 commit comments

Comments
 (0)