Hi Markus and all,

geometry.union(other);  it is much to slow for huge collection. In the end.
> it should work with collection within 20.000 and more geometries.My code
> looks like this:
>
> private Geometry unionIntoOneGeometry(
>             Collection<Geometry> geometryCollection) {
>         Geometry all = null;
>         for (Iterator<Geometry> i = geometryCollection.iterator();
> i.hasNext();) {
>             Geometry geometry = i.next();
>             if (geometry == null)
>                 continue;
>             if (all == null) {
>                 all = geometry;
>             } else {
>                 all = all.union(geometry);
>             }
>         }
>         return all;
>     }
>

What I have found somewhere in the JTS documents is:
        Geometry geom = geometryCollection.buffer(0);

Hope this helps
--
Hans
With great power comes great responsibility
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to