[GRASS-dev] error v.what.rast
Markus Neteler
neteler at osgeo.org
Tue Oct 14 14:14:32 PDT 2014
On Fri, Oct 10, 2014 at 1:44 PM, Glynn Clements
<glynn at gclements.plus.com> wrote:
[...]
Thanks for the detailed analysis, Glynn.
> Personally, I feel that v.what.rast should be fixed. Specifically, the
> code
>
> row = Rast_northing_to_row(Points->y[0], &window);
> col = Rast_easting_to_col(Points->x[0], &window);
>
> should be followed by:
>
> if (col < 0 || col >= window.cols || row < 0 || row >= window.rows)
> continue;
>
> The Vect_point_in_box() call just above that code doesn't appear to be
> sufficient in the case where the point lies either on the boundary of
> the region or just inside.
>
> This is partly because Vect_point_in_box() uses >= and <= rather than
>> and < (i.e. a point on the boundary is considered inside), and
> partly because Rast_northing_to_row() etc are affected by rounding
> error (window.north - window.south is not necessarily equal to
> window.ns_res * window.rows, similarly for the horizontal direction).
To avoid that it gets lost here, I have submitted that in r62254
(trunk for now, please test).
Markus
More information about the grass-dev
mailing list