[R-sig-Geo] working with Z values in spatial data frames

Tom Hengl hengl at science.uva.nl
Thu Nov 8 13:26:09 CET 2007


Another option to generate land surface models is the package gstat. You
can even use the position of streams/ridges to force physiographic breaks
in your output DEM.

The methodology and a sample dataset is available here:
http://geomorphometry.org/view_scripts.asp?id=6

The paper explaining the processing steps is still in review, but a
preprint can always be ordered.

Tom Hengl
http://spatial-analyst.net

> Here's one simple way, using package akima:
>
>
> library(sp)
>
> data(meuse)
>
> ## assume your data is Spatial*
>
> coordinates(meuse) <- ~x+y
>
>
>
> ## use "elev" column in akima
> library(akima)
>
> ## define a grid
> xx <- coordinates(meuse)[,1]
> yy <- coordinates(meuse)[,2]
> ## modify offset of 100 to match your data, or use a proportion
> grd <- expand.grid(x = seq(min(xx) - 200,  max(xx) + 200, length = 100),
>           y = seq(min(yy) - 200, max(yy) + 200, length = 100))
>
>
> res <- interpp(xx, yy, meuse$elev, grd$x, grd$y)
> res <- as.data.frame(res) ## akima output is a list of 3 equal-length
> vectors like grd passed in
>
>
> ## if you want to interpolate on another "Z", repeat as desired, adding
> to output
> res$cadmium <- interpp(xx, yy, meuse$cadmium, grd$x, grd$y)$z
>
>
> coordinates(res) <- ~x+y
> gridded(res) <- TRUE
>
> ## if you don't have a lot of empty cells
> fullgrid(res) <- TRUE
>
> image(res, "z")
>
> ## confirm where the high values were
> points(meuse$x, meuse$y, cex = meuse$elev/5)
>
> image(res, "cadmium")  ## etc
>
> spplot(res)
>
>
>
>
> Steve Friedman wrote:
>> Hi,
>>
>> I have a spatial data set consisting of several z values and UTM
>> coordinates.  Can someone direct me to documentation describing how I
>> can
>> plot specific z values using the coordinates to develop a continuous
>> surface
>> map?
>>
>> Thanks
>> Steve
>>
>> 	[[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
>>
>>
>>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>




More information about the R-sig-Geo mailing list