Hi Hans,

I've tried this already.... with my polygons i'll get an OutOfMemory-Exception. It seems this class cannot handle my number of polygons.
But thanks, reminding me of that way points me to new ways to try.
Markus


Am 14.09.2009 11:48 schrieb Hans Bogaards <[email protected]>:
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 geometryCollection) {

Geometry all = null; for (Iterator 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