Turf.jsBooleans

turf.booleanOverlap

What is turf.booleanOverlap?

turf.booleanOverlap returns true when two geometries of the same dimension partially overlap — their intersection has the same dimension as the inputs, and neither geometry fully contains the other.

JavaScript
turf.booleanOverlap(feature1, feature2) → boolean

Supported pairs: Polygon/Polygon, MultiPolygon/MultiPolygon, LineString/LineString, MultiLineString/MultiLineString, MultiPoint/MultiPoint.

When would you use turf.booleanOverlap?

Use turf.booleanOverlap to detect true partial overlaps — two administrative boundaries that share a strip, two routes that share a section of road, two retail catchments competing for the same ground. Unlike booleanIntersects, overlap excludes total containment and mere touching.

It is particularly useful when cleaning datasets: after a merge, legitimate overlaps often indicate a topology bug, while full containment does not.

JavaScript
1if (turf.booleanOverlap(existing, proposed)) {
2  console.warn('Proposed zone overlaps existing zone.');
3}

FAQs

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

Install npm install @turf/boolean-overlap and import import { booleanOverlap } from '@turf/boolean-overlap', or via the @turf/turf umbrella.

Does fully-contained count as overlap?

No. If one geometry contains the other entirely, overlap is false — use booleanContains or booleanWithin for that case.

Does it work across different geometry types?

No — both inputs must be of matching dimension (both polygons, both lines, etc.). Mixed-type calls return false.

When should I use booleanOverlap vs booleanIntersects?

Use booleanIntersects when any contact counts. Use booleanOverlap when you want specifically a partial same-dimension overlap — the typical "conflict" case in zoning or routing.