Skip to content

Commit

Permalink
fix: handling for features without cutouts
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Jul 29, 2024
1 parent 9bab2be commit ffe0040
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions client/src/pages/map/popups/Polygon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ export function PolygonPopup({
</MenuItem>
<MenuItem
dense
disabled={
feature.geometry.type === 'MultiPolygon'
? feature.geometry.coordinates.every((c) => c.length < 2)
: feature.geometry.coordinates.length < 2
}
onClick={() => {
useImportExport.setState({
feature: getFeatureCutouts(feature),
Expand Down
5 changes: 4 additions & 1 deletion client/src/services/geoUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ export function getFeatureCutouts(
type: 'MultiPolygon',
coordinates: polygons.map((p) => p.coordinates),
}
: polygons[0],
: polygons[0] || {
type: '',
coordinates: [],
},
}
}

0 comments on commit ffe0040

Please sign in to comment.