Doug, your dataset appears not to be a true polygonal coverage. The polygons look like they've been buffered by a small amount, so that they overlap one another along the edges. The technique I described will only work if the input is a true coverage. I think you'll need to look for a version of the dataset which is a true coverage (e.g. hasn't been buffered). Failing that, you're into a conflation exercise, which can get complicated.

Doug Smith wrote:
I like the plan of trying this in JUMP, then looking at the code to see
how it works. However, I'm having a hard time making it work in JUMP and
wonder if you can provide a bit more guidance.

I have attached my GeometryCollection WKT here:
http://drop.io/mapster/asset/d-postal-codes-wkt-zip

Here is what I have tried:

1. Open the WKT file in OpenJUMP.
2. Tools -> Edit Geometry -> Extract Segments
   - Click "Remove segments appearing more than one time" and
     "Merge resulting segments"
3. Make the extracted segments layer editable
4. Select all of the features in the extracted segments layer with the
"select parts" tool.
5. Tools -> Generalization -> Simplify (JTS algorithm)
   - point displacement = 0.01

The result is simplification similar to the screen capture I posted
earlier, where the polygons overlap one another -- the edges don't line
up.

Can you please let me know what I'm missing?

Thanks!

Doug

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin
Davis
Sent: Thursday, February 05, 2009 12:22 PM
To: JTS Topology Suite Development
Subject: Re: [jts-devel] Simplify & Snap?

I think you're heading down a hard road here, Doug. I think you're going to have a hard time preventing vertices from snapping to things they shouldn't.

IMO the best way to simplify polygonal coverages like this is to convert

the coverage to an edge-node topology, simplify the edges, and then repolygonize.

There's bits and pieces in JTS to help you do this, but nothing "off-the-shelf". (I also have experimental code to do this, but it's not ready for release.)

You can also use existing tools in JUMP to at least experiment with this

- and if you're keen you can always look at how they work and bundle the

code into a library for your own use. Try extracting all the unique, line segments, merging them, simplify, then repolygonize.

Doug Smith wrote:
Hi Everyone,

I'm wondering if this is possible: I have a bunch of postal code
polygons that are pretty complex. I'd like to simplify them, then cause
the adjacent points of polygons to snap together so that there is no
overlap.  (Pre-simplify, they align to one another perfectly.)
Here is the code I'm currently trying:

-----
GeometryCollection geomColl =
createGeometryCollectionFromWKT(polygonsAsWTK);
GeometryCollectionIterator iter = new
GeometryCollectionIterator(geomColl);
while (iter.hasNext()) {
        Geometry g = (Geometry)iter.next();
        Geometry simpleG = TopologyPreservingSimplifier.simplify(g,
0.01);
        if (snappyGeometries.size() > 0) {
                GeometrySnapper snapper = new GeometrySnapper(simpleG);
                Geometry lastGeometry =
snappyGeometries.get(snappyGeometries.size()-1);
                double snapTolerance =
GeometrySnapper.computeOverlaySnapTolerance(lastGeometry, simpleG);
                simpleG =
snapper.snapTo(snappyGeometries.get(snappyGeometries.size()-1),
snapTolerance);
        }
        snappyGeometries.add(simpleG);
}

Geometry[] geometriesAsArray = (Geometry[])
snappyGeometries.toArray(new Geometry[snappyGeometries.size()]);
Geometry snappyGeomCollection = new
GeometryCollection(geometriesAsArray,
geometriesAsArray[0].getFactory());
-----

And here is what "snappyGeomCollection" looks like in OpenJUMP:

http://drop.io/mapster/asset/snaptest-jpg

The code above assumes that the GeometryCollectionIterator will return
Geometries in an order that will snap appropriately. I'm pretty much
flying blind on this though, because I don't clearly know the
capabilities of the Iterator or the GeometrySnapper.
Any pointers would be very welcome!

Thanks,

Doug
---
Doug Smith
ELP Web Developer
http://www.daveramsey.com
"Life is an occasion, rise to it" -- Mr. Magorium

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



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

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

Reply via email to