handle invalid lat or lon more obviously

skip rather than stop.
Bump to 4.3.2
This commit is contained in:
Dave Conway-Jones 2023-11-09 10:34:25 +00:00
parent 7a9b38f6ac
commit a3ea952eed
No known key found for this signature in database
GPG Key ID: 1DDB0E91A28C2643
4 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v4.3.2 - Fix geojson popup missing label name.
- v4.3.1 - Small fix to icon transparency, and routing detail. - v4.3.1 - Small fix to icon transparency, and routing detail.
- v4.3.0 - Add support for PMtiles files. - v4.3.0 - Add support for PMtiles files.
- v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252 - v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252

View File

@ -13,6 +13,7 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
### Updates ### Updates
- v4.3.2 - Fix geojson popup missing label name.
- v4.3.1 - Small fix to icon transparency, and routing detail. - v4.3.1 - Small fix to icon transparency, and routing detail.
- v4.3.0 - Add support for PMtiles files. - v4.3.0 - Add support for PMtiles files.
- v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252 - v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-web-worldmap", "name": "node-red-contrib-web-worldmap",
"version": "4.3.1", "version": "4.3.2",
"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": {
"@turf/bezier-spline": "~6.5.0", "@turf/bezier-spline": "~6.5.0",

View File

@ -117,7 +117,7 @@ console.log("CONNECT TO",location.pathname + 'socket');
var handleData = function(data) { var handleData = function(data) {
if (Array.isArray(data)) { if (Array.isArray(data)) {
//console.log("ARRAY"); //console.log("ARRAY:",data.length);
for (var prop in data) { for (var prop in data) {
if (data[prop].command) { doCommand(data[prop].command); delete data[prop].command; } if (data[prop].command) { doCommand(data[prop].command); delete data[prop].command; }
if (data[prop].hasOwnProperty("name")) { if (data[prop].hasOwnProperty("name")) {
@ -1716,8 +1716,16 @@ function setMarker(data) {
delete data.position; delete data.position;
ll = new L.LatLng((data.lat*1), (data.lon*1)); ll = new L.LatLng((data.lat*1), (data.lon*1));
} }
else if (data.hasOwnProperty("lat") && data.hasOwnProperty("lon")) { ll = new L.LatLng((data.lat*1), (data.lon*1)); } else if (data.hasOwnProperty("lat") && data.hasOwnProperty("lon")) {
else if (data.hasOwnProperty("latitude") && data.hasOwnProperty("longitude")) { ll = new L.LatLng((data.latitude*1), (data.longitude*1)); } if (isNaN(data.lat*1)) { console.log("Invalid lat: lat:",data.lat, " - lon:",data.lon); return; }
if (isNaN(data.lon*1)) { console.log("Invalid lon: lat:",data.lat, " - lon:",data.lon); return; }
ll = new L.LatLng((data.lat*1), (data.lon*1));
}
else if (data.hasOwnProperty("latitude") && data.hasOwnProperty("longitude")) {
if (isNaN(data.latitude*1)) { console.log("Invalid latitude: lat:",data.latitude, " - lon:",data.longitude); return; }
if (isNaN(data.longitude*1)) { console.log("Invalid longitude: lat:",data.latitude, " - lon:",data.longitude); return; }
ll = new L.LatLng((data.latitude*1), (data.longitude*1));
}
else { else {
// console.log("No location:",data); // console.log("No location:",data);
return; return;