[postgis-devel] [PostGIS] #324: ST_DumpPoints(geom, integer[]) is misnamed

Kevin Neufeld kneufeld at refractions.net
Mon Nov 30 08:59:29 PST 2009


Kevin Neufeld wrote:
> I think you can select just an interior ring if you know the ring's 
> index ...
> 
>  SELECT path, ST_AsText(geom)
>  FROM (
>    SELECT (ST_DumpPoints(g.geom)).*
>    FROM
>      (SELECT
>         'POLYGON (( 3 0, 3 3, 6 3, 6 0, 3 0 ), ( 5 1, 4 2, 5 2, 5 1 
> ))'::geometry AS geom
>      ) AS g
>    ) AS j;

WHERE path[1] = 2;

-- (Oops, forgot the WHERE clause)


>  path  | st_astext
> -------+------------
>  {2,1} | POINT(5 1)
>  {2,2} | POINT(4 2)
>  {2,3} | POINT(5 2)
>  {2,4} | POINT(5 1)
> (4 rows)
> 
> -- Kevin
> 
> PostGIS wrote:
>> #324: ST_DumpPoints(geom, integer[]) is misnamed
>> ---------------------+------------------------------------------------------ 
>>
>>  Reporter:  robe     |       Owner:  kneufeld          Type:  defect   
>> |      Status:  new           Priority:  medium   |   Milestone:  
>> PostGIS 1.5.0
>> Component:  postgis  |     Version:  trunk         Keywords:           
>> |  
>> ---------------------+------------------------------------------------------ 
>>
>>  We should either make this function do something cool or rename it to
>>  _ST_DumpPoints.
>>
>>  The user in me was thinking
>>  "Why does this function have no description?  I wonder if the good 
>> PostGIS
>>  developers just forgot to document it.  I wonder if I can extract the
>>  points of an inner ring in a collection of a polygon by doing"
>>
>>
>>  {{{
>>  SELECT path, ST_AsText(geom)
>>  FROM (
>>    SELECT (ST_DumpPoints(g.geom,ARRAY[4,2])).*
>>    FROM
>>      (SELECT
>>         'GEOMETRYCOLLECTION(
>>            POINT ( 0 1 ),
>>            LINESTRING ( 0 3, 3 4 ),
>>            POLYGON (( 2 0, 2 3, 0 2, 2 0 )),
>>            POLYGON (( 3 0, 3 3, 6 3, 6 0, 3 0 ),
>>                     ( 5 1, 4 2, 5 2, 5 1 )),
>>            MULTIPOLYGON (
>>                    (( 0 5, 0 8, 4 8, 4 5, 0 5 ),
>>                     ( 1 6, 3 6, 2 7, 1 6 )),
>>                    (( 5 4, 5 8, 6 7, 5 4 ))
>>            )
>>          )'::geometry AS geom
>>      ) AS g
>>    ) AS j;
>>  }}}
>>
>>  To my disappointment -- ehh you can't - its just a  helper function 
>> not a
>>  navigation function.
>>
> 



More information about the postgis-devel mailing list