[GRASS-dev] G_get_raster_sample(): request outside region
glynn at gclements.plus.com
Fri Jul 14 21:42:17 EDT 2006
Florian Kindl wrote:
> I try to obtain the cell values of a raster map at the location of certain
> nodes of a vector map:
> struct Cell_head window;
> Vect_get_node_coor( In, node, &x, &y, NULL );
> z = G_get_raster_sample( fdrast, &window, NULL, x, y, 0, method );
> Running this code gives the following message:
> WARNING: [rugg_dtmgrd in c716322] - read request for row 311730 is outside region
> ERROR: problem reading raster cell file
> Are the coordinates returned by Vect_get_node_coor() a valid argument for
> G_get_raster_sample() ?
Sometimes. The coordinates passed to the latter must lie within the
current region, but the coordinates returned from the former can lie
outside of the current region.
You will need to manually check the coordinates against the region,
Vect_get_node_coor( In, node, &x, &y, NULL );
if (x >= window.west && x < window.east && y >= window.south && y < window.north)
z = G_get_raster_sample( fdrast, &window, NULL, x, y, 0, method );
> Is my use of G_get_window() OK?
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev