[postgis-tickets] [PostGIS] #3428: Feature request: A function to convert a geometry's coordinates into a MultiPoint

PostGIS trac at osgeo.org
Wed Jan 13 15:33:33 PST 2016


#3428: Feature request: A function to convert a geometry's coordinates into a
MultiPoint
-------------------------+----------------------------
 Reporter:  mwtoews      |      Owner:  pramsey
     Type:  enhancement  |     Status:  new
 Priority:  medium       |  Milestone:  PostGIS Future
Component:  postgis      |    Version:
 Keywords:               |
-------------------------+----------------------------
 This feature request is for a function to convert the coordinates from any
 geometry into a MULTIPOINT geometry. For example:
 {{{
 POINT(30 10) => MULTIPOINT(30 10)
 LINESTRING Z (30 10 4,10 30 5,40 40 6) => MULTIPOINT Z (30 10 4,10 30 5,40
 40 6)
 POLYGON((30 10,40 40,20 40,10 20,30 10)) => MULTIPOINT(30 10,40 40,20
 40,10 20,30 10)
 POLYGON((35 10,45 45,15 40,10 20,35 10),(20 30,35 35,30 20,20 30))
   => MULTIPOINT(35 10,45 45,15 40,10 20,35 10,20 30,35 35,30 20,20 30)
 MULTIPOINT M (10 40 1,40 30 2,20 20 3,30 10 4)
   => MULTIPOINT M (10 40 1,40 30 2,20 20 3,30 10 4)
 }}}

 Similar functionality can be done with existing ST_Collect and
 ST_DumpPoints functions, e.g.:
 {{{
 CREATE OR REPLACE FUNCTION ST_ToMultiPoint(geometry) RETURNS geometry AS
 'SELECT ST_CollectionExtract(ST_Collect(geom), 1)
  FROM (SELECT * FROM ST_DumpPoints($1)) AS dp;' LANGUAGE sql IMMUTABLE;
 }}}
 however this is not optimised and has a dismal performance. An equivalent
 function in C would be very efficient.

 As for a function name, similar to ST_Boundary, it could be ST_Coordinate
 or similar.

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3428>
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-tickets mailing list