[postgis-users] Testing for empty feature

Kevin Neufeld kneufeld at refractions.net
Fri Jul 4 08:32:13 PDT 2008


I believe that an empty multipolygon is converted into an empty
geometrycollection in JTS and hence PostGIS.


postgis=# SELECT ST_AsText('MULTIPOLYGON EMPTY'::geometry);
        st_astext
--------------------------
 GEOMETRYCOLLECTION EMPTY
(1 row)


postgis=# SELECT ST_IsEmpty('MULTIPOLYGON EMPTY'::geometry);
 st_isempty
------------
 t
(1 row)

Alternatively, I suppose you could get the number of points in the geometry.

postgis=# SELECT ST_NPoints('MULTIPOLYGON EMPTY'::geometry);
 st_npoints
------------
          0
(1 row)


Cheers,
Kevin


Sean Fulton wrote:
> How do I test for an empty feature such as 'MULTIPOLYGON(( EMPTY ))' ?
> 
> IsEmpty seems to work only for collections.
> 
> astext(wkb_geometry) = 'MULTIPOLYGON(( EMPTY ))' doesn't seem to work.
> 
> Thanks,
> 
>     Sean
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list