Turf.jsBooleans

turf.booleanDisjoint

What is turf.booleanDisjoint?

turf.booleanDisjoint returns true when two geometries have no points in common — that is, their intersection is empty. It is the logical complement of turf.booleanIntersects.

JavaScript
turf.booleanDisjoint(feature1, feature2) → boolean

When would you use turf.booleanDisjoint?

Use turf.booleanDisjoint when you want to filter features that are completely separate from another set — neighbourhoods without any overlap with a flood zone, trucks whose routes never enter a restricted area, or any "free of" analysis.

Either booleanDisjoint or !booleanIntersects answers the same question, but booleanDisjoint is more expressive in code where the intent is the separation rather than the presence of contact.

JavaScript
const safe = parcels.features.filter(p => turf.booleanDisjoint(p, floodZone));

FAQs

How do I install Turf.js to use this function?

Install npm install @turf/boolean-disjoint and import import { booleanDisjoint } from '@turf/boolean-disjoint'. It is also available via @turf/turf.

Is touching considered disjoint?

No. Two features that share a single boundary point are not disjoint — their intersection (that point) is non-empty. Use turf.booleanTouches to explicitly test boundary-only contact.

How fast is it on large datasets?

Per-pair cost is roughly equivalent to booleanIntersects. For bulk queries, pre-index with a spatial tree (rbush, flatbush) and check disjoint only against candidates whose bboxes overlap.

Should I use booleanDisjoint or negate booleanIntersects?

They are equivalent. Pick the one that reads more naturally in context — disjoint for code that emphasises separation, !intersects when you are already thinking in terms of contact.