Skip to content
Prev 9778 / 29559 Next

convert from spatstat to sp; RFC about generic behaviour

Dear Edzer,

In raster the default approach for extracting raster values with
polygons is that a polygon has to cover the center of a cell, for the
cell to be included. However, you can use argument "weights=TRUE" in
which case you get, apart from the cell values, the percentage of each
cell that is covered by the polygon, so that you can apply, e.g., a
50% area covered threshold, or compute an area-weighted average.

In the case of lines, any cell that is crossed by a line is included.
For lines and points, a cell that is only 'touched' is included when
it is below or to the right (or both) of the line segment/point
(except for the bottom row and right most column).

I agree that this is very elegant ( I do not find it very intuitive,
but that might change when I get used to it! ) For its elegance I have
added it to raster (v 1.6-9) ( also in the spirit of, where possible,
trying to have similar approaches in spatial packages that Jeremy
recently called for
http://www.mail-archive.com/r-sig-geo at stat.math.ethz.ch/msg09015.html
). I have also added raster[polygons] <- value  , a wrapper around
polygonsToRaster(raster, value, update=TRUE) )

Robert



On Sat, Oct 30, 2010 at 3:24 AM, Edzer Pebesma
<edzer.pebesma at uni-muenster.de> wrote: