turf.booleanConcave
What is turf.booleanConcave?
turf.booleanConcave returns true if a Polygon has at least one reflex angle (making it concave), otherwise false.
turf.booleanConcave(polygon) → booleanWhen would you use turf.booleanConcave?
Use turf.booleanConcave when your downstream algorithm assumes convex inputs — triangulation, certain point-in-polygon shortcuts, or geometric simplification heuristics. Branching on concavity lets you pick a fast-path for convex shapes and fall back to a general algorithm for concave ones.
It is also a quick sanity check in data pipelines: a parcel expected to be rectangular but flagged as concave usually indicates a digitisation error such as crossing edges.
1if (turf.booleanConcave(parcel)) {
2 flagForReview(parcel);
3}FAQs
How do I install Turf.js to use this function?
Install npm install @turf/boolean-concave and import import { booleanConcave } from '@turf/boolean-concave', or use turf.booleanConcave via @turf/turf.
Does it handle polygons with holes?
It evaluates the outer ring only. A polygon with a convex outer ring and internal holes is reported as convex.
Does it work on MultiPolygons?
No, not directly. Flatten with turf.flatten and test each Polygon individually.
How does it differ from turf.booleanValid?
booleanConcave describes shape (convex vs concave). booleanValid checks spec conformance (closed rings, no self-intersections). A valid polygon can be concave.