diff --git a/packages/turf-boolean-valid/index.ts b/packages/turf-boolean-valid/index.ts index db24fc5b9b..f50488ac94 100644 --- a/packages/turf-boolean-valid/index.ts +++ b/packages/turf-boolean-valid/index.ts @@ -90,7 +90,7 @@ function booleanValid(feature: Feature | Geometry) { function checkRingsClose(geom: Position[]) { return ( - geom[0][0] === geom[geom.length - 1][0] || + geom[0][0] === geom[geom.length - 1][0] && geom[0][1] === geom[geom.length - 1][1] ); } diff --git a/packages/turf-boolean-valid/test/false/Polygon/not-closing-ring.geojson b/packages/turf-boolean-valid/test/false/Polygon/not-closing-ring.geojson new file mode 100644 index 0000000000..df738d0719 --- /dev/null +++ b/packages/turf-boolean-valid/test/false/Polygon/not-closing-ring.geojson @@ -0,0 +1,20 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [-0.703125, 24.84656534821976], + [11.25, 24.84656534821976], + [11.25, 31.353636941500987], + [-0.703125, 31.353636941500987] + ] + ] + } + } + ] +}