[R-sig-Geo] polygons to grid?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat Nov 21 14:36:12 CET 2009


On Sat, Nov 21, 2009 at 1:20 PM, Agustin Lobo <alobolistas at gmail.com> wrote:
> Hi?
>
> Is it possible to perform a vector to raster conversion in R,
> from SpatialPolygonsDataFrame to a SpatialGrid (providing the final
> resolution?

 If what you want is a raster grid storing the value of some attribute
of polygons sampled at a grid of locations, see help(overlay) and
help("overlay-methods") in package sp. Note the complications that can
happen if your polygons overlap.

 Another possibility is simply to plot your polygons to a png device
with no margins or axes or other decorations. I'd call this a
different class of vector-raster conversion, and might be what you
need if you want a raster representation of the outline of your
polygons. You'd then need to read in the png and set coordinates with
the other various raster handling functions.

Barry



More information about the R-sig-Geo mailing list