From ca2db8dd3c301384bc0cc3b2a154c758d8ce99e3 Mon Sep 17 00:00:00 2001 From: Lars Wikman Date: Fri, 23 Aug 2024 16:54:25 +0200 Subject: [PATCH] Fix issues with undefined lat and long on world map (#1466) --- assets/js/app.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index 2f1840cfb..8ca65e4a1 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -167,18 +167,20 @@ Hooks.WorldMap = { for (let i = 0; i < markers.length; i++) { let marker = markers[i]; let location = marker["location"]; - let newMarker = { - type: "Feature", - properties: { - name: marker["identifier"], - status: marker["status"], - }, - geometry: { - type: "Point", - coordinates: [location["longitude"], location["latitude"]] + if (location["longitude"] !== undefined && location["latitude"] !== undefined) { + let newMarker = { + type: "Feature", + properties: { + name: marker["identifier"], + status: marker["status"], + }, + geometry: { + type: "Point", + coordinates: [location["longitude"], location["latitude"]] + } } + devices.push(newMarker); } - devices.push(newMarker); } var markerConnectedOptions = {