[GRASSLIST:4168] Re: reclass a grid with its grid-numbers

Glynn Clements glynn.clements at virgin.net
Sun Jul 28 10:38:59 EDT 2002


Stephan Holl wrote:

> I would like to create a raster-map, where each pixel contains its
> pixel-number as category-value.
> the rows and columns are set by the region.
> the pixels should be ordered in the same order as r.stats -1 does, so
> that each pixel is treated as a unique value.
> This value would be identical with a field in my pg-database.
> So I could use d.rast.pg to pull out recalculated maps out of postgres.
> 
> Actually I am not sure, how I can create this kind of map.
> 
> Perhaps some of you could give me a hint....

	cols=`g.region -p | sed -n 's/^cols: *//p'`
	r.mapcalc "map = (row() - 1) * $cols + col() - 1"

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-user mailing list