[GRASS-user] Intersection of Vector polygons with raster
Glynn Clements
glynn at gclements.plus.com
Tue Sep 16 02:08:40 EDT 2008
Nikos Alexandris wrote:
> > I have two raster layers that I want to run r.stats on. I also have
> > a vector layer with polygons, and I'm only interested in applying
> > r.stats to the raster cells that fall within the vector polygons.
> >
> > It looks like r.stats can't clip to the vector itself. Is there any
> > command that will help me pro-process my rasters by clipping them
> > against the polygons?
> >
> > Thanks,
> > Brock
>
> Hi Brock!
>
> (a) Rasterise the vector polygons and assign cat values (one unique
> value) to each raster area, then loop over each raster area the r.stats
> module (using the cat value! and export result of each loop in a file)
Or run r.stats once with all three files as input, and collate the
results by category (e.g. using awk). That will typically be more
efficient than multiple passes of r.stats.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list