[R] Contouring irregular xyz data via TIN

Martin Maechler maechler at stat.math.ethz.ch
Fri Aug 15 09:17:57 CEST 2003


>>>>> "Hisaji" == Hisaji Ono <hi_ono2001 at ybb.ne.jp>
>>>>>     on Fri, 15 Aug 2003 08:31:34 +0900 writes:

    Hisaji> Hi, Kris.
    >> Dear,
    >> 
    >> I have XYZ data available in a MySQL database. I get it out, can plot
    >> the data with the plot() function, load it into a geoR datastructure.
    >> But what I actually would like to do is a simple contouring of the data
    >> based on a no Kriging interpolation such as TIN based.
    >> 
    >> I know the first thing I shold do is interpolate a full matrix for the
    >> region I have my points for, then contour should do its work. Any idea
    >> which function can be used for XYZ interpolations, maybe/hopefully based
    >> on a Delaunay triangulation in combination with linear or spline
    >> interpolation. Is there a package that allows me to do this?
    >> 

    Hisaji> I found following URL. It's an example  for S-PLUS, so you might need some
    Hisaji> modifications.

    Hisaji> http://geography.uoregon.edu/courses/geog414f01/lectures/lec10.htm

    Hisaji> I hope this would help you.

Thank you!
Note that one of the more sophisticated solutions there uses
Akima(1978)'s polynomial interpolation scheme, function
interp() in S-plus.

R's "akima" package interp() function can do a bit more and uses
bivariate spline-interpolation {as in Akima(1996)} by default
(thanks to Albrecht Gebhardt <albrecht.gebhardt at uni-klu.ac.at>

In short:
   ## if needed, get the CRAN package "akima"
   install.packages("akima")
   library(akima)
   help(interp)
   ## now use interp():
   intxyz <- interp(x,y,z)
   with(zreg, contour(x,y,z))


Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><




More information about the R-help mailing list