Skip to content

Commit 3418503

Browse files
committed
gracefully handle empty coordinate arrays
1 parent b978c7a commit 3418503

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib/geo_location_utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,11 @@ function extractTraceFeature(calcTrace) {
226226
};
227227

228228
// Compute centroid, add it to the properties
229-
fOut.properties.ct = findCentroid(fOut);
229+
if (fOut.geometry.coordinates.length > 0) {
230+
fOut.properties.ct = findCentroid(fOut);
231+
} else {
232+
fOut.properties.ct = [NaN, NaN];
233+
}
230234

231235
// Mutate in in/out features into calcdata
232236
cdi.fIn = fIn;

0 commit comments

Comments
 (0)