I use TypeScript and currently I wish to validate a Geometry object.
I use booleanValid
from turf package to ensure that the object is valid.
const isGeometryValid: boolean = booleanValid(geometry as unknown as Geometry);
After testing I found out that the booleanValid
only checks the Right-Hand Rule and doesn't check if the loop is closed.
The following array returned true even though the loop is not closed just because it satisfies the Right-Hand Rule:
[ [ [0,0], [10,0], [10,10], [0,10], [0,8] ] ]
I need a way to check all the validations for Geometry and not just one or some of them
booleanValid
is unstable in its current state and I was advised by a collaborator to find an alternative for using turf for validating geometry objects.
I personally would say in it's current state not to rely on booleanValid for comprehensive GeoJSON validation. You could potentially look at packages such as https://github.com/placemark/check-geojson and https://github.com/mapbox/geojsonhint which may offer similar alternatives depending on your requirements.