Bug in RasterToVectorProcess
----------------------------

                 Key: GEOT-3855
                 URL: https://jira.codehaus.org/browse/GEOT-3855
             Project: GeoTools
          Issue Type: Bug
          Components: process
    Affects Versions: 8.0-M1, 2.7.2
            Reporter: Michael Bedward
            Assignee: Michael Bedward
             Fix For: 2.7.3, 8.0-M2


>From John Armstrong:
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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to