[R-sig-Geo] vertical profile of raster DEM along road (package raster)
Matteo Mattiuzzi
matteo.mattiuzzi at boku.ac.at
Thu Mar 21 19:52:08 CET 2013
Dear Omphalodes,
library(raster)
library(sp)
set.seed(2)
data(volcano)
r <- raster(volcano)
plot(r)
l1 = cbind(c(seq(0,1 , by = 0.1)), runif(11, 0, 1))
S1 = Lines(list(Line(l1)), ID = "a")
lines(S1, asp = 1, col = "red")
S1<-SpatialLines(list(S1)) # I'm not practic in sp, but this at least works!
extract(r,S1)
Matteo
>>> Omphalodes Verna 03/21/13 6:06 PM >>>
Dear list.
I am asking for advice for getting verticale profile of DEM along line object. I konw, it is easy for one straight line (distance and extract functions) also with using a combination of GRASS and R ( http://casoilresource.lawr.ucdavis.edu/drupal/node/375 ). Is in R possible to do this.
Thanks to all. OV
Here is a sample code:
library(raster)
library(sp)
set.seed(2)
data(volcano)
r <- raster(volcano)
plot(r)
l1 = cbind(c(seq(0,1 , by = 0.1)), runif(11, 0, 1))
S1 = Lines(list(Line(l1)), ID = "a")
lines(S1, asp = 1, col = "red")
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list