From 64721bfa94dbbc045f2625d6b9af3a57e278e45b Mon Sep 17 00:00:00 2001 From: Drew Slobodnjak <60050885+drew08t@users.noreply.github.com> Date: Thu, 4 Aug 2022 18:17:32 -0700 Subject: [PATCH] Geomap: Do not show markers with empty coordinates (#53330) Co-authored-by: nmarrs --- 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 {