[R-sig-Geo] Spatial data interpolation on R

Don MacQueen macq at llnl.gov
Tue Jun 29 17:59:38 CEST 2010


If you are willing to do simple interpolation, 
i.e., ignoring any spatial correlation, you could 
look at the interp() function, which is in the 
akima package.  Even if you need to incorporate 
spatial correlation, starting with the interp() 
function would probably serve as a good way to 
get started learning R. The help page for 
interp() has some examples.

Here's an excerpt from the help page for the interp() function:

interp                  package:akima                  R Documentation

Gridded Bivariate Interpolation for Irregular Data

Description:

      These functions implement bivariate interpolation onto a grid for
      irregularly spaced input data.  Bilinear or bicubic spline
      interpolation is applied using different versions of algorithms
      from Akima.


Install the akima package using the R console GUI 
(Mac or Windows) or the install.packages() 
function (linux).

Then there's the question of coordinate systems. 
interp() assumes cartesian coordinates, but 
lat/long is not cartesian. If your site is too 
large, you shouldn't ignore this, so you will 
have to learn how to project from lat/long to UTM 
or other appropriate local coordinate  system. 
For this, I use the spTransform() function in the 
rgdal package. Looking on the CRAN website, it 
appears there is a Windows binary for rgdal; for 
the other platforms (I use Mac), it can be more 
challenging. Converting your data into a 
"spatial" class object, so that it can be 
projected, will be a challenge at first.

Gettng the book that Mark Connolly mentioned would help a lot.

-Don


At 10:20 AM -0700 6/2/10, Thiago Veloso wrote:
>Content-Type: text/plain
>Content-Disposition: inline
>Content-length: 937
>
>Dear R colleagues!
>  I´d like to start my participation in this list 
>by describing my current problem: inside my area 
>of study I need to compare precipitation data 
>from two different sources: both station (total 
>of 86) and a grid (at 8km) of satellite 
>estimates.
>   My specific objective is to interpolate the 
>station data into a regular grid in the same 
>resolution of the satellite estimates, 
>preferentially having control of the spatial 
>domain (lat/lon coordinates). As far as I know 
>this is the correct way of making such 
>comparison.
>   Could anybody please point directions to 
>perform this task using R? I´m such a beginner 
>that I don´t even know if
>  there´s a package designed to create regular 
>grids from "random" data (interpolating by 
>kriging or other technique). Usage examples 
>would be welcomed as well!
>Thanks in advance,
>  Thiago.
>
>
>
>      
>	[[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


-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062



More information about the R-sig-Geo mailing list