[GRASS-user] split adjacent categories

Martin Wegmann wegmann at biozentrum.uni-wuerzburg.de
Thu Jan 10 13:47:26 EST 2008


Hello,

I have a raster with different categories (adjacent patches)  but when I 
buffer this raster file I get a buffer for the whole area and not for each 
single patch.

I thought of a loop ( r.mapcalc "select patch cat x" - r.buffer x  - 
r.mapcalc  " set buffer of patch x to null()" ) and then r.patch.

I already did some experiences with 

COUNTER = 1

# while [  $COUNTER -lt $max ]; do
while [  $COUNTER < $max ]; do
        echo The counter is $COUNTER
	
	r.mapcalc "t1 = if(rast_in == $COUNTER,1,null())"
	r.buffer input=t1 output=b.$COUNTER distance=500

	let COUNTER=COUNTER+1 
		
   done

but failed because COUNTER was not recognized and I don't know at all, if 
these bash statements work at all using GRASS.

I welcome any other idea.

Martin


More information about the grass-user mailing list