[postgis-devel] [PostGIS] #534: Provide function to add new geometries to a collection

PostGIS trac at osgeo.org
Wed May 26 13:48:40 PDT 2010


#534: Provide function to add new geometries to a collection
---------------------------+------------------------------------------------
  Reporter:  jchamberlain  |       Owner:  robe         
      Type:  enhancement   |      Status:  assigned     
  Priority:  medium        |   Milestone:  PostGIS 1.5.2
 Component:  postgis       |     Version:  1.5.X        
Resolution:                |    Keywords:               
---------------------------+------------------------------------------------
Comment (by robe):

 One problem with ST_Collect is if you are adding a point to a multipoint,
 you would end up with a geometry collection.

 You would probably want to combine with ST_CollectionExtract
 http://www.postgis.org/documentation/manual-1.5/ST_CollectionExtract.html


 {{{
 -- adding a point to a multipoint
 SELECT
 ST_AsText(ST_CollectionExtract(ST_Collect(ST_GeomFromText('MULTIPOINT(1 2,
 3 4)'), ST_GeomFromText('POINT(5 5)')),1));
 }}}


 {{{
 -- adding an array of points to a multipoint
 SELECT
 ST_AsText(ST_CollectionExtract(ST_Collect(ARRAY[ST_GeomFromText('MULTIPOINT(1
 2, 3 4)'), ST_GeomFromText('POINT(5 5)'), ST_GeomFromText('POINT(0 0 )')]
 ),1));
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/534#comment:2>
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