[GRASS-user] row() and col() problem

Jarosław Jasiewicz wrote:

I try to generate map where every cell will have unique value
I do that with following mapcalc formula:

map=(row()*451)+col()

where 451 is the total number of columns + 1

I expected following solution;

452,453,454,455,....
953,954,955,956,....
.....

But I recived:

452,452,453,454,454,....
452,452,453,454,454,....
953,954,955,956,....
953,954,955,956,....
....

Where is the error in formula (or it is rounding problem)?

did you change the g.region resolution after creating the map?

if you do 'g.region rast=map' before output is it ok?

Hamish

Hamish pisze:

Jarosław Jasiewicz wrote:
  

I try to generate map where every cell will have unique value
I do that with following mapcalc formula:

map=(row()*451)+col()

where 451 is the total number of columns + 1

I expected following solution;

452,453,454,455,....
953,954,955,956,....
.....

But I recived:

452,452,453,454,454,....
953,954,955,956,....
....

Where is the error in formula (or it is rounding problem)?
    
did you change the g.region resolution after creating the map?

if you do 'g.region rast=map' before output is it ok?
  

Yes, but not

Hamish

well, the problem may lays elsewhere

r.stats -1 input=map shows expected result, but when I use "display cell values layer" form gis.m it shows wrong results. It change default region as I know.
thanks
Jarek