That's a good idea, and makes sense.
But won't I still need to check that the polygons are able to merge? If
I supply two disconnected polygons to the union function, I imagine it
won't be happy?
Martin Davis wrote:
One way you can speed this up is to use a spatial index on your
processed polygon set. You'll be updating it as you merge polygons,
so it needs to be a Quadtree.
Do you have attributes attached to your polygons? If *not*, then you
could cluster polygons together (ie spatially by proximity) and then
use UnaryUnion to merge them all together at once (ie
GeometryCollection.union()) One way to cluster the polygons is to
make a coarse grid over the extent of the polygons, assign each
polygon to the grid cell containing it's centroid, then take each grid
cell group as a cluster.
Lee Goddard wrote:
I have several million points that compose several thousand polygons,
and I'm outputting KMZ.
The KMZ is about 2MB, and I'm trying to reduce the size by merging
polygons that have adjecent edges, and drop those that are contained
within others.
I have created to arrays of polygons: one of all unprocessed, one
empty. For each unprocessed polygon, I try to compare it the
processed, dropping the unprocessed or merging it, as appropriate.
This seems frr from ideal. This must be a common task, but being new
to JTS and topology in general, I'm not sure if I should be able to
find a method to do this for me, or if I should continue trying to do
it my own way?
_______________________________________________
jts-devel mailing list
jts-devel@lists.jump-project.org
http://lists.refractions.net/mailman/listinfo/jts-devel