[postgis-devel] [PostGIS] #549: ST_isCollection

PostGIS trac at osgeo.org
Thu Jul 1 05:07:46 PDT 2010


#549: ST_isCollection
-------------------------+--------------------------------------------------
 Reporter:  strk         |       Owner:  pramsey      
     Type:  enhancement  |      Status:  new          
 Priority:  medium       |   Milestone:  PostGIS 2.0.0
Component:  postgis      |     Version:  trunk        
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by yabo):

 Replying to [comment:5 strk]:
 > Well, a POINT EMPTY isn't, a GEOMETRYCOLLECTION EMPTY is, a
 MULTILINESTRING EMPTY is.
 > But this is my POV, not necessarely what you're looking for.
 > It was you proposing the function :)
 >
 > Anyway, my suggestion should pretty much match the NULL result from
 ST_GetNumGeometries,
 > which was the whole reason to suggest this new function, right ?
 > It used to return 0 for GEOMETRYCOLLECTION EMPTY and NULL for POINT
 EMPTY.

 That seems coherent. The C function should be ok. So here we go for the
 tests :

 {{{
 $ svn diff
 Index: iscollection_expected
 ===================================================================
 --- iscollection_expected       (revision 0)
 +++ iscollection_expected       (revision 0)
 @@ -0,0 +1,18 @@
 +f
 +f
 +f
 +f
 +f
 +f
 +t
 +t
 +t
 +t
 +t
 +t
 +t
 +t
 +t
 +t
 +t
 +t
 Index: iscollection.sql
 ===================================================================
 --- iscollection.sql    (revision 0)
 +++ iscollection.sql    (revision 0)
 @@ -0,0 +1,27 @@
 +-- Ensure there are no false-positives
 +SELECT ST_IsCollection('POINT(42 42)');
 +SELECT ST_IsCollection('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))');
 +SELECT ST_IsCollection('LINESTRING(0 0, 10 10)');
 +SELECT ST_IsCollection('POINT EMPTY');
 +SELECT ST_IsCollection('POLYGON EMPTY');
 +SELECT ST_IsCollection('LINESTRING EMPTY');
 +
 +--Ensure that all collections return true (even if they contain a single
 geometry).
 +SELECT ST_IsCollection('MULTIPOINT EMPTY');
 +SELECT ST_IsCollection('MULTIPOINT((0 0))');
 +SELECT ST_IsCollection('MULTIPOINT((0 0), (42 42))');
 +
 +SELECT ST_IsCollection('MULTILINESTRING EMPTY');
 +SELECT ST_IsCollection('MULTILINESTRING((0 0, 10 10))');
 +SELECT ST_IsCollection('MULTILINESTRING((0 0, 10 10), (100 100, 142
 142))');
 +
 +SELECT ST_IsCollection('MULTIPOLYGON EMPTY');
 +SELECT ST_IsCollection('MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0)))');
 +SELECT ST_IsCollection('MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0)),
 ((100 100, 110 100, 110 110, 100 110, 100 100)))');
 +
 +SELECT ST_IsCollection('GEOMETRYCOLLECTION EMPTY');
 +SELECT ST_IsCollection('GEOMETRYCOLLECTION(POINT(0 0))');
 +SELECT ST_IsCollection('GEOMETRYCOLLECTION(POINT(0 0), POINT(42 42))');
 +
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/549#comment:6>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list