Skip to content

How to clip and interpolate data using shapefile as a boundary

4 messages · Thiago V. dos Santos, Roman Luštrik, Robert J. Hijmans

#
Thiago,

You could get the bbox(polygon) and then subset the points for the
area of the polygon (keeping points just outside of it) and use these
points in e.g. gstat if you want to interpolate.

You can also turn this into a SpatialPointsDataFrame object and use
gridded(obj) = TRUE

In raster, to avoid the strips, you could try:
rprecip<-raster(xmn=-82.90,xmx=-34.30,ymn=-50.30,ymx=12.10)
res(rprecip) = 0.2
(i.e. assure that the resolution matches your data, and that points
fall in the center, not the intersections of, grid cell).

Hope this helps,

Robert
On Tue, Oct 19, 2010 at 1:06 PM, Thiago Veloso <thi_veloso at yahoo.com.br> wrote: