ST_IsEmpty
What is ST_IsEmpty?
ST_IsEmpty is a PostGIS function that returns true if a geometry contains no coordinates — an empty POINT, empty POLYGON, empty GEOMETRYCOLLECTION, etc. An empty geometry is distinct from a NULL geometry: the type exists but holds nothing.
ST_IsEmpty(geometry g) → booleanEmptiness is different from invalidity. ST_IsEmpty checks for presence of coordinates; ST_IsValid checks for topological correctness.
When would you use ST_IsEmpty?
Use ST_IsEmpty to filter rows that have geometry columns but no actual coordinates — these are produced by imports from formats that carry empty values, by operations like ST_Intersection where the inputs do not overlap, or by some legacy feeds:
1DELETE FROM staging
2WHERE geom IS NULL OR ST_IsEmpty(geom);Always pair IS NULL and ST_IsEmpty — NULL is SQL's missing-value marker while an empty geometry is a valid typed value with zero coordinates. Downstream spatial predicates can return unexpected results on either.
FAQs
What is the difference between NULL and empty?
NULL means "no value"; empty means "a value of this type exists but has zero coordinates". Spatial functions handle them differently — most return NULL on NULL input, but false on empty input.
How does ST_IsEmpty interact with ST_Intersection?
ST_Intersection returns an empty geometry (not NULL) when two geometries do not overlap. Filter WHERE NOT ST_IsEmpty(ST_Intersection(a, b)) to keep only real overlaps.
Can a GeometryCollection be non-empty but contain only empties?
A collection that contains empty components reports false from ST_IsEmpty if it has at least one component; a truly empty collection (no components) reports true. This corner case is rarely meaningful in practice.
Is ST_IsEmpty fast?
Very — it is a metadata check, no vertex scan. Safe to use in WHERE on large tables.