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

PostGIS trac at osgeo.org
Thu Jul 1 03:20:14 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):

 Something like this ?

 There should also be a test on 'GEOMETRYCOLLECTION EMPTY' but I don't know
 what it should return. Is an empty geometry a collection ? Maybe could the
 C function be patched to catch that case.

 {{{
 $ svn diff
 Index: iscollection_expected
 ===================================================================
 --- iscollection_expected       (revision 0)
 +++ iscollection_expected       (revision 0)
 @@ -0,0 +1,11 @@
 +f
 +f
 +f
 +t
 +t
 +t
 +t
 +t
 +t
 +t
 +t
 Index: iscollection.sql
 ===================================================================
 --- iscollection.sql    (revision 0)
 +++ iscollection.sql    (revision 0)
 @@ -0,0 +1,17 @@
 +-- 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)');
 +
 +--Ensure that all collections return true (even if they contain a single
 geometry).
 +SELECT ST_IsCollection('MULTIPOINT((0 0))');
 +SELECT ST_IsCollection('MULTIPOINT((0 0), (42 42))');
 +
 +SELECT ST_IsCollection('MULTILINE((0 0, 10 10))');
 +SELECT ST_IsCollection('MULTILINE((0 0, 10 10), (100 100, 142 142))');
 +
 +SELECT ST_IsCollection('MULTIPOLYGON(((0 0, 10 0, 10 10, 10 0, 0 0)))');
 +SELECT ST_IsCollection('MULTIPOLYGON(((0 0, 10 0, 10 10, 10 0, 0 0), (100
 100, 110 100, 110 110, 100 110, 100 100)))');
 +
 +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:4>
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