[postgis-devel] polygonize

strk at refractions.net strk at refractions.net
Tue Dec 21 04:21:27 PST 2004


On Mon, Dec 20, 2004 at 04:24:06PM +0100, strk at refractions.net wrote:
> On Mon, Dec 20, 2004 at 09:48:38AM -0500, Carl Anderson wrote:
> > strk at refractions.net wrote:
> >
> > (rhetorical questions follow)
> > But
> > polygonize_garray is declared to accept  geometry[].
> >    is the data type geometry[] intended to be polymorphic?  (pointers 
> > or TOAST)
> > or do
> >       geom_accum, collect_garray and polygonize_garray
> >       all agree to support something else when passed the geometry[] 
> > datatype?
> > 
> > select  array_append('{}',the_geom) from shapes limit 2;
> >                      array_append
> > ---------------------------------------------------------------------
> > {SRID=2240;01060000000010000....}
> > {SRID=2240;01060000000010000...}
> > {SRID=2240;01060000000010000...}
> > 
> > select geom_accum('[]',the_geom) from shapes limit 2;
> >                    geom_accum
> > ---------------------------------------------------------------------
> > [808333614:808333614] = {0100000000}
> > [32:32] = {0100000000}
> > [32:32] = {0100000000}
> 
> Ok, we are cheating.
> I'll make some research on supporting real arrays.
> --strk;

It's not been easy (ArrayType interfaces are not well documented)
but I've handled to make geom_accum a *real* array builder.
This have a bigger impact on memory usage as array elements
in the former case where freed as soon as used, while now this
is not possible, as elements are *real* geoms, not pointers.

On the other hand you can pass (the undocumented) collect_garray,
unite_garray, polygonize_garray and makeline_garray literal
geometry arrays. For this purpose typdelimiter of type geometry
has been set to ':', which is never in the canonical text form.

To get the new functionalities w/out a dump/reload:

UPDATE pg_type SET typdelim = ':' WHERE typname = 'geometry';

NOTE: the code has not been tested against PG<800

--strk;



More information about the postgis-devel mailing list