On 14/07/08 15:14, Glynn Clements wrote:
Moritz Lennert wrote:

Well, this works:

r.mapcalc brol3=if(y()<=9521600 && x()<=427000,1,null())

but this doesn't:

r.mapcalc brol3=if(y()==9521600 && x()==427000,1,null())

which raises the issue of precision of the coordinates...

What are the region settings? Bear in mind that x() and y() return the
coordinates of the cell's centre, not a corner.

Just for completeness: It is a cell map, but resolution was aligned on bounds, so something like 1.9876 and 2.0045

When I set resolution to 2 and align bounds to resolution and then use

r.mapcalc brol3=if(y()==9521601 && x()==427001,1,null())

it works

whereas

r.mapcalc brol3=if(y()==9521600 && x()==427000,1,null())

doesn't. So clearly an issue of falling right on the center of the pixel.

Also note that the calculation involves multiplying by the resolution.

You mean internally by mapcalc, or that I should include resolution into the calculation ?

If the resolution cannot be exactly represented as both a binary
fraction and a decimal fraction, you will get rounding error.

That and/or hitting the cell center was probably the problem.

Thanks for your explanations.

Moritz
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to