For those places (valley bottoms, mountain tops), a spline interpolation do
better ((and even better when using stream information like in Hutchinson's
algorithm that was (is?) implemented in Arc/INFO.)) You mentioned the akima
package, here is an example with fields.

library(raster)
library(maptools)
library(fields)

cl <- ContourLines2SLDF(contourLines(volcano))
cl@data$level <- as.numeric(as.character(cl@data$level))
r <- flip(t(raster(volcano)), 'y')
p <- as(cl, 'SpatialPointsDataFrame')

tps <- Tps(coordinates(p), p@data$level)
s <- interpolate(r, tps)

par(mfrow=c(1,2))
plot(s)
plot(cl, add=T)
plot(s, r)


On Fri, Jul 8, 2011 at 7:05 AM, Barry Rowlingson <
b.rowlingson@lancaster.ac.uk> wrote:

> On Fri, Jul 8, 2011 at 2:26 PM, Robert Hijmans <r.hijmans@gmail.com>
> wrote:
>
>
>
> > # now there are many ways to interpolate. See, e.g., the 'gstat' and
> > 'automap' packages. See raster::interpolate for an example with splines.
> > # using gstat and inverse distrance weighted interpolation:
> >
> > library(gstat)
> > g <- gstat(id="level", formula = level~1, data=p, nmax=7, set=list(idp =
> > .5))
> > x1 <- interpolate(r, g)
>
> Statistical interpolation techniques may be right for this, but
> thinking about it last night made me realise that contours are more
> than just linear estimates of height at location. There's the
> implication that between any two contour lines of height H1 and H2
> there are no locations with height outside the bounds of (H1,H2).
> Otherwise there would be a contour line there.
>
>  And this may not be so uncommon in elevation models. Consider a steep
> sided valley with a wide flood plain. You have close contours on
> either side with a big gap between. Would a "statistical"
> interpolation run down the valley side and plummet on down, then back
> up the other side, turning the flood plain into a deep rounded valley
> bottom? Sure it all depends on the parameters of the smoothing, but a
> method that knew it was dealing with contours would constrain the
> surface such that points between contour lines were always between the
> contour line values.
>
>  I think at least one of the algorithms in GRASS-GIS does this by
> "drawing" the contour lines on the raster and then doing a 'flood
> fill' operation between them.
>
>  I'll have to dig out some GIS books...
>
> Barry
>

	[[alternative HTML version deleted]]

