Skip to content

[External] Raster map in R

1 message · Barry Rowlingson

#
Your data has 45 points which aren't on a regular X-Y grid. If you want to
make a regular raster grid then you've got to have some method for deciding
what value is at any arbitrary (x,y) location given your data. This is
"spatial interpolation" and there's a whole world of methods out there for
this including inverse distance weighting, kriging, spline fitting... etc.

For example, using the `automap` package you can do a quick "ordinary
kriging":

First convert data frame to spatial points data frame:

 > coordinates(Tuto)=~X+Y

Do everything:

 > m = autoKrige(a~1, input_data=Tuto)
 [using ordinary kriging]

plot results:

 > plot(m)

This shows prediction and standard error of estimates of `a` over the space
given the spatial dependence in the variance of `a` shown in the lower
graph and the other aspects of the ordinary Kriging model.

Don't take this as The One Way To Do It though, review the literature on
spatial interpolation, define your reasoning for your model, and choose
code based on that. You'll possibly end up using the `gstat` package though.

Barry
On Tue, Mar 8, 2022 at 6:22 AM Eliza Botto <eliza_botto at outlook.com> wrote: