ST_IsEmpty doesn't seem to work for me and I don't see the MultiPolygon being converted to a GeometryCollection.

civics=# SELECT astext(wkb_geometry) FROM scale150000 LIMIT 1;
        astext
------------------------
MULTIPOLYGON(( EMPTY))
(1 row)

civics=# SELECT ST_IsEmpty(wkb_geometry) FROM scale150000 LIMIT 1;
st_isempty
------------
f
(1 row)

ST_NPOINTS works. It seems like there should be a more direct way.


        Sean

On 2008-07-04 12:03:33 -0400, Martin Davis <[EMAIL PROTECTED]> said:

Actually JTS/GEOS handle empty MultiPolygons just fine. I don't know why
the MULTIPOLYGON EMPTY is being converted to a general
GeometryCollection - I think this must be something that is being done
by PostGIS.

Seems like the answer is to use ST_IsEmpty. Doing text comparisons is
always going to be risky.

Kevin Neufeld wrote:
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
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users



_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to