[R-sig-Geo] SpatialPixelDataFrame over a polygon

Paul Hiemstra p.hiemstra at geo.uu.nl
Thu Mar 6 23:31:06 CET 2008


G. Allegri schreef:
> Hello list,
> I need to create a SpatialPixelDataFrame to do a gaussian simulation over an
> area delimited by a polygon. The object I want to produce is something
> similar to the "meuse.grid" example.
> I could do it in Grass, converting first the polygon to raster (with the
> resolution of the Grass region), and then converting the raster to points
> vector. Then I import it with spgrass6 and "grid" it to SPDF.
> Is there a more straightforward way to accomplish it totally inside R?
>
> Giovanni
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   
Hi Giovanni,

You can use spsample() to make a grid within a polygon, use the 
"cellsize =" argument to set the size of your grid cells, e.g.:

grd = spsample(polygon, cellsize = 1e3)

cheers,
Paul

-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:     +31302535773
Fax:    +31302531145
http://intamap.geo.uu.nl/~paul




More information about the R-sig-Geo mailing list