Quantcast

UnionOP for huge polygon collection

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

UnionOP for huge polygon collection

Markus Eichhorn
Hi list,
I've been trying to union a collection of Geometry-object (all elements are polygons). But with the
geometry.union(other);  it is much to slow for huge collection.
So I used the UnaryUnionOp (see code).

private Coordinate[] UnionWithUnionOp(ArrayList<Geometry> allPolygons){
       
        Geometry allinOnePolygon = UnaryUnionOp.union(allPolygons);
        return allinOnePolygon.getCoordinates();
    }

After union the polygons with the UnaryUnionOp the order of coordinates of the result polygon is not right ( I think, because of the polygons are not ordered and distributed all over the space). So I get an self overlapping polygon which makes lots of problems for the visualisation.
Is my handling of the UnaryUnionOp false? Or can't I handle such spread polygons with it?
Thanks for answers or hints!
Greets
Markus

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: UnionOP for huge polygon collection

Martin Davis
Markus,

Your approach is exactly right - that's what UnaryUnionOp is designed to
do.  I'm not sure why you're seeing incorrect results - the output seems
very strange. If you can post some test data or even better a simple
test case I can dig into this to see what's going on.

Another post suggested noding first. This is not necessary, UnaryUnionOp
does any noding required.

Martin

Markus Eichhorn wrote:

> Hi list,
> I've been trying to union a collection of Geometry-object (all
> elements are polygons). But with the
> geometry.union(other);  it is much to slow for huge collection.
> So I used the UnaryUnionOp (see code).
>
> private Coordinate[] UnionWithUnionOp(ArrayList<Geometry> allPolygons){
>        
>         Geometry allinOnePolygon = UnaryUnionOp.union(allPolygons);
>         return allinOnePolygon.getCoordinates();
>     }
>
> After union the polygons with the UnaryUnionOp the order of
> coordinates of the result polygon is not right ( I think, because of
> the polygons are not ordered and distributed all over the space). So I
> get an self overlapping polygon which makes lots of problems for the
> visualisation.
> Is my handling of the UnaryUnionOp false? Or can't I handle such
> spread polygons with it?
> Thanks for answers or hints!
> Greets
> Markus
> ------------------------------------------------------------------------
>
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>  

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Loading...