How the ST_Disjoint Geometry Checker works, and what it assumes
ST_Disjoint(A, B) is true when the geometries have no point in common: their interiors and boundaries do not meet anywhere. In DE-9IM terms the pattern is FF*FF****, and it is always the opposite of ST_Intersects. A single shared corner is enough to make two geometries not disjoint.
In a database query it is usually better written as NOT ST_Intersects(a, b). The two give the same answer, but ST_Intersects can use a spatial index and ST_Disjoint cannot, because the pairs an index skips are exactly the disjoint ones. On this page speed does not matter, so the question can be asked directly.
Disjoint says nothing about how far apart the geometries are. When the answer is true, ST_Distance gives the gap and ST_DWithin tests it against a limit. An empty geometry has no points, so it is disjoint from everything.
Where this comes up in GIS work
- Confirming that exclusion zones, lots or tiles that must not overlap really do not share any point.
- Checking a result set from a NOT ST_Intersects query by hand.
- Testing that a proposed site keeps completely clear of a boundary rather than just touching it.
A worked example
Two squares with a gap between them:
A: POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))
B: POLYGON ((6 6, 9 6, 9 9, 6 9, 6 6))
ST_Disjoint(A, B) = true
DE-9IM matrix: FF2FF1212
Slide the second square left until it shares the first one's right-hand edge, POLYGON ((4 0, 8 0, 8 4, 4 4, 4 0)), and the answer becomes false. The matrix FF2F11212 has a 1 where the two boundaries meet: they share a line, so they touch.
Using the ST_Disjoint Geometry Checker
- Paste the first geometry into Geometry A, or select Load example.
- Paste the second geometry into Geometry B.
- Select Check ST_Disjoint, or press Ctrl + Enter (Cmd + Enter on a Mac).
- Read the verdict. If the geometries are disjoint, ST_Distance tells you how far apart they are.
When the output looks wrong
- Two parcels that only meet at a corner are not disjoint
- A single shared corner point is still a shared point, so the geometries touch and are not disjoint. That is the correct answer: ST_Disjoint is only true when there is a gap between them, however small.
- ST_Disjoint is slow in my database
- It cannot use a spatial index, because disjoint pairs are exactly the ones an index skips. Write NOT ST_Intersects(a, b) instead, which gives the identical answer and lets the planner use the index.
- The geometries are disjoint but I expected them to be close
- Disjoint says nothing about how far apart the geometries are. Use ST_Distance for the gap or ST_DWithin to test it against a limit.
Questions about the ST_Disjoint Geometry Checker
What does ST_Disjoint mean exactly?
That the interiors and boundaries of A and B share no point at all: the DE-9IM pattern FF*FF****. It is the exact opposite of ST_Intersects.
Should I use ST_Disjoint in queries?
Usually not. NOT ST_Intersects gives the same answer and can use a spatial index, which ST_Disjoint cannot. The distinction matters on large tables.
Is an empty geometry disjoint from everything?
Yes. An empty geometry has no points, so it cannot share one with anything, and ST_Disjoint is true while every other relationship is false.
Is my data uploaded?
No. The check runs entirely in your browser.