Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a Spatial Point DF spo (covering an irregular shaped area of interest). The data are not on a regular grid due to crs transformation.

My goal is a raster with predefined resolution and extent of the area of interest ( more spatial point data are to be mapped on this master raster) .

Problems start when I

rasterize(spo, raster(ncol, nrow, extent, crs), spo$param)

I need to adjust nrowand ncol in a way so that I wont get moire patterns of NAs within my area of interest. I cant use a predefined (higher) resolution.

As a solution to this, I thought I would need some kind of Spatial Pixel DF spi, that covers my whole area of interest (just like meuse.grid in library(raster); data(meuse.grid)), and serves as a master grid. Then, I can use it to interpolate my data, e.g.

idw(param~1,spo,spi)

and by this, get full cover of my area of interest at my chosen resolution. But how can a SpatialPixelsDataFrame be produced from the point data?

So in my view, the question boils down to: How to produce meuse.grid from meuse dataset?

Maybe I'm taking the wrong approach here, so please let me know if more easily can achieved what I'm after, using a different way.

share|improve this question
1  
I think I see what you mean, to interpolate a new grid from irregular data you need a base grid first that covers the region at a sensible resolution. You can do this pretty easily by hand using the tools, but take a look at trip::makeGridTopology for a stab at generalizing it while keeping all the options open. You still need to generate the Data part but it's not hard. If this sounds right I will answer with an example and wrapper function (that might be more generally useful). –  mdsumner Dec 12 '12 at 21:57
    
@mdsumner, trip::makeGridTopology looks promising. If you could provide an example, I would really really appreciate it. Thanks –  sunpyg Dec 13 '12 at 11:32

1 Answer 1

up vote 1 down vote accepted

What I would do is create a convex hull around the source points in spo, and sample in that polygon using spsample. This function allows you to prescribe the gridcell size, see this function in automap for an example (disclaimer, I wrote automap).

The next step would be to interpolate the values, e.g. using automap:

library(automap)
loadMeuse()
kr = autoKrige(log(zinc)~1, meuse, convex_hull_grid)

This uses kriging (Ordinary Kriging in this case) to fit a variogram model to the data and interpolate the values in meuse to the grid in convex_hull_grid.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.