[GRASS-user] r.buffer

Hamish hamish_b at yahoo.com
Wed Oct 28 01:44:44 EDT 2009


there are some addon scripts listed in the wiki to do this task for you,

http://grass.osgeo.org/wiki/GRASS_AddOns#v.what.rast.buffer

I am pretty sure there is another one too, perhaps already moved into
the main source tree using v.rast.stats or v.what.rast?


see also
 http://grass.osgeo.org/wiki/GRASS_AddOns#g.region.point


??v.sample.buffer?? addon
and fast stats using 3rd party program called starspan (??)


Alessandro:
> I am a GRASS newbie, so I apologise in advance for the
> simplicity of
> my question. I have a set of sites and I would like to
> create a series
> of circular buffers around each site and then use r.stats
> to extract
> some information from each buffer in combination with a
> land cover
> map. My problem is that if I simply use the v.to.rast and
> r.buffer
> commands to obtain the buffers, many of these will clash
> into each
> other because  the sites are too close. I was wondering
> whether there
> is any script out there capable of creating buffers one at
> the time
> starting from a set of sites and then using the r.stats
> command to
> extract info from data layer. If not, I would be really
> happy if you
> could point me in the right direction! I have found some
> code (see
> below) that has proved useful, but does not do exactly what
> I want.
> Basically, by starting from a set coordinates, the script
> is capable
> of zooming into a region around each site and extracting
> the relevant
> information using the r.stats command. Unfortunately I have
> no clue on
> how to create the individual buffers. Any help would be
> appreciated!
> 
> thanks!
> 
> Alessandro
> 
> 
> #!/bin/sh
> 
> #replace 'foo' with name of input file (easting and
> northing)
> #replace 'outfile' with name of output file
> #replace 'LCM2000a' with the name of the map from where you
> want to
> extract some information
> 
> 
> numSites=`wc -l foo | awk '{print $1}'`
> 
> winSize=500
> 
> for (( site=1 ; site <= $numSites ; site++ ));
>   do
>   cent_e=`awk '{if(NR=='$site') printf("%.0f", $1)}' foo`
>   cent_n=`awk '{if(NR=='$site') printf("%.0f", $2)}' foo`
> 
>   echo POINT $site e=$cent_e n=$cent_n
> 
>   nrth=`expr $cent_n + $winSize`
>   soth=`expr $cent_n - $winSize`
>   east=`expr $cent_e + $winSize`
>   west=`expr $cent_e - $winSize`
> 
>   echo SITE $site n=$nrth s=$soth e=$east w=$west
> 
>   g.region n=$nrth s=$soth e=$east w=$west res=25
>   d.erase
>   d.rast LCM2000a
> 
>   r.stats -cn LCM2000a > hab.temp
>   awk '{print '$site', $0,$1}' hab.temp >> outfile
> 
>   done
> 
> #g.region rast=LCM2000a
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 


      


More information about the grass-user mailing list