[postgis-users] GeomUnion() as aggregate

strk at refractions.net strk at refractions.net
Mon Apr 11 04:20:52 PDT 2005


Micheal, GeomUnion is a topological operation and
in topological terms neither components nor vertexes order
have a special meaning. If you're just looking for a collector
function use collect(whatever) instead.

--strk;

On Mon, Apr 11, 2005 at 12:15:49PM +0200, Michael Fecht wrote:
> GeomUnion() as aggregate to union linestrings returns  a multilinestring 
> with lineparts in the reverse order than the original linestrings.
> 
> Original:
>  SRID=-1;LINESTRING(1 1,2.5 1.5,2.5 3)
>  SRID=-1;LINESTRING(2.5 3,3 3.5,4.5 3.5)
>  SRID=-1;LINESTRING(4.5 3.5,5 4.5,7 4.5)
>  SRID=-1;LINESTRING(7 4.5,7.5 4,7 3.5,6.5 3,7 2.5)
> 
> process GeomUnion with :
>                    
>                         select geomunion(geo) from lines;
> 
> returns
> SRID=-1;MULTILINESTRING((7 4.5,7.5 4,7 3.5,6.5 3,7 2.5),(4.5 3.5,5 4.5,7 
> 4.5),(2.5 3,3 3.5,4.5 3.5),(1 1,2.5 1.5,2.5 3))
>   starting with the last linestring of table "lines".
> 
> using :
>                      select geomunion(geo) from (select * from lines 
> order by id desc) as view;
> 
> returns the multilinestring with lineparts ordered like in the original 
> dataset:
> SRID=-1;MULTILINESTRING((1 1,2.5 1.5,2.5 3),(2.5 3,3 3.5,4.5 3.5),(4.5 
> 3.5,5 4.5,7 4.5),(7 4.5,7.5 4,7 3.5,6.5 3,7 2.5))
> 
> This behaviour of the GeomUnion() Funktion is not intuitive. Maybe the 
> processing order should be adapted.
> 
> Michael
> 
> 
> 
> -- 
> ---------------------
> Michael Fecht
> GRID-IT GmbH
> Technikerstraße 21a
> A6020 Innsbruck
> fon +43 (0) 512 507 4862
> e-mail fecht(at)grid-it.at
> ---------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list