ClearSKY FaviconClearSKY Polygon Tools
Back to Glossary

Within (spatial predicate)

True if geometry A lies completely inside geometry B (the inverse of Contains).

Category: Topology · Also known as: ST_Within, within predicate

Definition (expanded)

Within answers: is A entirely inside B? It is commonly used for spatial joins and filters. Like Contains, boundary behavior depends on the exact predicate semantics in the library/database you use.

Examples

PostGIS within

SQL

SELECT ST_Within(a.geom, b.geom) FROM a, b;

Common mistakes