From f9a0926c59d63e4cd73a8eed5f18ad60b49a84a1 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Fri, 5 Aug 2022 18:08:12 +0100 Subject: [PATCH] Geomap: Do not show markers with empty coordinates (#53330) (#53337) --- public/app/features/geo/format/utils.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/app/features/geo/format/utils.ts b/public/app/features/geo/format/utils.ts index babba1cde80..c5d5814894d 100644 --- a/public/app/features/geo/format/utils.ts +++ b/public/app/features/geo/format/utils.ts @@ -28,7 +28,16 @@ export function pointFieldFromGeohash(geohash: Field): Field { export function pointFieldFromLonLat(lon: Field, lat: Field): Field { const buffer = new Array(lon.values.length); for (let i = 0; i < lon.values.length; i++) { - buffer[i] = new Point(fromLonLat([lon.values.get(i), lat.values.get(i)])); + const longitude = lon.values.get(i); + const latitude = lat.values.get(i); + + // TODO: Add unit tests to thoroughly test out edge cases + // If longitude or latitude are null, don't add them to buffer + if (longitude === null || latitude === null) { + continue; + } + + buffer[i] = new Point(fromLonLat([longitude, latitude])); } return {