[R-sig-Geo] Sampling via polygons question
Jonathan Greenberg
greenberg at ucdavis.edu
Tue Aug 2 21:26:46 CEST 2011
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?
--j
--
Jonathan A. Greenberg, PhD
Assistant Project Scientist
Center for Spatial Technologies and Remote Sensing (CSTARS)
Department of Land, Air and Water Resources
University of California, Davis
One Shields Avenue
Davis, CA 95616
Phone: 415-763-5476
AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307
More information about the R-sig-Geo
mailing list