Skip to content

Spatial relations

Taco de Wolff edited this page Oct 19, 2025 · 3 revisions

Spatial relations define how two shapes relate to each other according to the DE-9IM specification.

relation, intersections := p.Relate(q)
relation.Disjoint()
relation.Intersects()
relation.Equals()
relation.Touches()
relation.Contains()
relation.Within()
relation.Covers()
relation.CoveredBy()
relation.Overlaps()

// convenience functions based on Relate:
p.Touches(q)  // boundaries/interiors intersect (p may overlap or contain/within q)
p.Overlaps(q) // interiors intersect (p may contain/within q)
p.Contains(q) // no boundary/interior is exterior
p.Intersections(q) // return list of intersections

Examples

Path spatial relations

Clone this wiki locally