[postgis-devel] Is there a reason those GArray functions aren'tdocumented?

Obe, Regina robe.dnd at cityofboston.gov
Thu Jul 3 04:31:18 PDT 2008


 
Kevin,

----------------
> I think this is exactly why they were never documented.  I suppose we 
> could add an "Internals" section to the documentation and catalog
these 
> as well as all the _ST* methods.


> I think this, or the simliar approach 
> ST_MakePolygon(ST_MakeLine(geometry set)), is how one would build up a

> Polygon - construct linestrings that define the exterior and interior 
> rings, and use them to define the boundary of the polygon.

> Cheers,
> Kevin

Thanks. Agreed these should probably be in a separate section if we have
them at all.  In this particular case I couldn't use geometry set
because a geometry set requires rows of data where as I had a finite set
of points  constructed by separate operations against a known geometry.
Think of a complex geometry where you want to create a new geometry from
select properties of that geometry e.g. the exterior, the 5th interior
and the 6th interior (well thats not a good example).  

You would have to resort to something silly and inefficient but granted
more SQL portable like

SELECT B.*,
ST_Polygonize(ST_Collect(B.the_geom))

FROM 
(
UNION ALL SELECT A.otherfields, some_monkey_business_adding_some
points(ST_Exterior_Ring(the_geom)) 
FROM A
UNION ALL SELECT A.otherfield, some_other_monkey_business(A.the_geom) 
... FROM A

... the unions can get pretty ugly after a while) ) B ..
GROUP BY ...


When you could have done more (maybe not more simply) but I suspect more
efficiently

SELECT A....,
ST_Polygonize_garray(ARRAY[some_monkey_business_adding_some
points(ST_ExteriorRing(the_geom)),
some_other_monkey_business(ST_ExteriorRingN(the_geom,2))]) As the_geom

FROM  A

So I finally got fed up and just used one of those garray functions.

Its a rare use case but it does lurk its ugly head every once in a while
and then I have to wash myself off after using it because I felt dirty
using a non-documented PostGIS function and also a particular unique
feature of PostgreSQL (its implementation of arrays) :).

Thanks,
Regina
 

-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.




More information about the postgis-devel mailing list