Hi everybody.
I've run across a bug in
org.geotools.process.raster.RasterToVectorProcess. I can describe it
quickly, as well as the quick fix; I don't really know yet how to submit it
for inclusion into GeoTools itself.
AIUI, the process works by finding edges on a data grid. The edges are
assembled into polygons, each of which may be part of the region of
interest or a hole in that region. To test, it tries to find an interior
point of the polygon to check if it's "inside" or "outside". Usually it's
enough to use com.vividsolutions.jts.algorithm.InteriorPointArea, but if
that fails the backup plan is to walk around each vertex and check the
point one grid-cell-width to the right.
The problem comes up when the grid polygon is an L-shape, like
X
XXXX
Here, the InteriorPointArea gives a point on the upper edge of the "right
arm" of the shape, which isn't an interior point. Then we check an offset
away from all six vertices, all of which are either on the boundary or
outside the polygon. The algorithm throws an exception and Dies Horribly.
The solution is to move right *and up* by half a grid cell. Every grid
polygon must have at least one lower-left corner (proof left as exercise to
reader), for which this offset will give a point within a grid cell
contained within the interior of the polygon. In terms of the code, line
427 should be changed from
c.y = ringC.y;
to
c.y = ringC.y + cellWidthY / 2;
and the algorithm will work as intended.
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel