[R-sig-Geo] Sampling via polygons question
Roger Bivand
Roger.Bivand at nhh.no
Wed Aug 3 16:47:02 CEST 2011
On Tue, 2 Aug 2011, Jonathan Greenberg wrote:
> R-sig-geo'ers:
>
> Hoping to get some feedback on this problem. Given a SpatialPolygons
> object with N polygons, I would like to sample (probably via raster's
> "extract") a window from a raster() object around *each pixel* falling
> with *each polygon*. I'm not asking about a straight buffer around a
> polygon and then sampling via (e.g.) extract -- this is more akin to
> converting each polygon to a set of points representing cells of the
> raster object, then sampling via a buffer around each of these points.
> The window to be extracted around each location is of a fixed size,
> so each point within a polygon should yield the same size output.
> Thoughts? What is the most efficient way to convert a polygon to a
> set of points?
Could you please provide a self-contained code example, possibly with a
simple downloadable shapefile of polygons covering your case? Are the
polygons intended to touch? are the buffers in fact the pixels
(rectangular) or circular? I think I see what you mean, but may well
misunderstand your intentions.
Roger
>
> --j
>
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list