From ffe00405f48c34a3c5c8431801247362d94cd31d Mon Sep 17 00:00:00 2001 From: Derick M <58572875+TurtIeSocks@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:19:59 -0400 Subject: [PATCH] fix: handling for features without cutouts --- client/src/pages/map/popups/Polygon.tsx | 5 +++++ client/src/services/geoUtils.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/client/src/pages/map/popups/Polygon.tsx b/client/src/pages/map/popups/Polygon.tsx index 521ee0a7..c21bddcc 100644 --- a/client/src/pages/map/popups/Polygon.tsx +++ b/client/src/pages/map/popups/Polygon.tsx @@ -318,6 +318,11 @@ export function PolygonPopup({ c.length < 2) + : feature.geometry.coordinates.length < 2 + } onClick={() => { useImportExport.setState({ feature: getFeatureCutouts(feature), diff --git a/client/src/services/geoUtils.ts b/client/src/services/geoUtils.ts index c1a86e43..32ddb1a3 100644 --- a/client/src/services/geoUtils.ts +++ b/client/src/services/geoUtils.ts @@ -134,6 +134,9 @@ export function getFeatureCutouts( type: 'MultiPolygon', coordinates: polygons.map((p) => p.coordinates), } - : polygons[0], + : polygons[0] || { + type: '', + coordinates: [], + }, } }