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 {