[GRASS-dev] G_get_raster_sample(): request outside region

Glynn Clements glynn at gclements.plus.com
Mon Jul 17 05:15:45 EDT 2006


Florian Kindl wrote:

> > 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.
> 
> I think I understand what you are saying, but:
> - my vectors lie completely within the raster.
> - the error occurs when the region is set to the extent of the raster  
> as well as when it is set to the extent of the vectors.
> 
> So, how can it be that Vect_get_node_coor() returns coordinates  
> outside the current region?
> 
> And how can it be that the error occurs even though the node really  
> lies within the current region:
> 
> 
> +++
> 
> /* debug output of my program: */
> window.north=270001.000000
> window.south=265000.000000
> window.west= -45000.000000
> window.east= -39000.000000
> coor node 1: -41729.635417,267224.854167
> 
> WARNING: [raster] - read request for row 311730 is outside region
> ERROR: problem reading raster cell file

Note the order of the coordinates:

double G_get_raster_sample (int fd,
                struct Cell_head *window,
                struct Categories *cats,
                double north, double east,
                int usedesc, INTERP_TYPE itype)

Northing first, easting second; i.e. Y first, X second.

Why do I suspect that you have them the wrong way around? If you
subtract the easting (instead of the northing) from the north edge of
the region, you get:

270001.000000 - -41729.635417 = 311730.635417

Which looks suspiciously like the "row 311730" that it's complaning
about.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list