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

Paragon Corporation lr at pcorp.us
Mon Nov 30 12:14:37 PST 2009


That I know works, I was just thinking that it would be more efficient if it
was implemented as a function.

The function would only need dump out the first layer and zoom into the
array that contains the inner geometry.  The below has to explode the whole
geometry into points and throw more out.
 

-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of Kevin
Neufeld
Sent: Monday, November 30, 2009 11:59 AM
To: PostGIS Development Discussion
Subject: Re: [postgis-devel] [PostGIS] #324: ST_DumpPoints(geom,integer[])
is misnamed

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.
>>
> 
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel






More information about the postgis-devel mailing list