Hi JTS folk,
This is Rob from the GeoTrellis team. We have an algorithm that performs
vectorization against raster data that does a RegionGroup operation over
the raster and then vectorizes each region along the cell borders.
We're wrapping JTS in scala code (you can find it here:
https://github.com/geotrellis/geotrellis/tree/master/feature/src/main/scala/geotrellis/feature).
This is replacing some earlier wrapping work contained in GeoTrellis <=
0.9.X. One difference between the two wrappers is that the current Polygon
checks to see that the JTS geometry is valid in the constructor (as does
each geometry type).
This is causing one of our previous Vectorization unit tests to fail. In
this case, the Raster looks like this:
X X X X X
X P P P X
X P X P X
X X P P X
X X X X X
Where X represents NoData, and P represents a value (The letter choice is
arbitrary). The algorithm creates a vector who's border LineString goes
around the perimeter of the region of P's.
The problem is, the algorithm creates a border with two points being the
same:
______
| __ |
|__| _| |
| __ |
(apologies for the very rough ASCII art, I hope it translates).
So because the border intersects itself, it's considered an invalid
polygon. The algorithm could possibly changed to consider the outside
perimeter as the LineRing and the space in the middle as a hole; this would
require some significant changes to an already complex algorithm, and I'm
not sure it could handle all of the edge cases.
My question is, is there a way to solve this in JTS? To take a LineString
that is invalid for the border of the polygon, and separate it out into a
valid border and a hole, and to create a valid polygon from it, in a
generic way?
Thanks,
Rob
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user