Painting river widths according to their contents of water

Lars Schylberg larss at
Mon Mar 8 06:35:17 EST 1993

I saw that Michael Shapiro gave a soulution to use r.buffer.  That
works fine but you can't retain the actual values in this way.

One other soulution that I have used for getting different width on
road data depending on road classes is to use a mode filter approach.

1) Convert your your vector data to raster data. ( )
2) Divide your data into the classes that diffent width should repressent.
   Make a separate map for each width class with the original raster cell values.
   ( r.reclass + awk  or  r.mapcalc ( if(....)  )
3) Run a mode filter operation that will have a edge growing effect, but that will
   retain the orignal values of the the cells in the growing step.  Choose filter
   size in accorance to how wide you want to have the streams.  ( r.neighbours )
4  Patch the different maps together to one resulting image.
   ( r.patch )

To get a nicer shape on the growing process with larger filter kernels
could a circular shaped mode filter kernels be used.  This could be
achived with a new function that I have written for r.mapcalc. If you
are interested I could send it to you with email.  I will be in


Lars Schylberg                          Email: larss at  
Dept. of Geodesy and Photogrammetry 
Royal Institute of Technology (KTH)     Tel.   +46 8 790 86 33   
S-100 44  STOCKHOLM, SWEDEN             Fax.   +46 8 790 66 10

More information about the grass-user mailing list