library(rgdal)
library(raster)
alt <- getData('alt', country = "AT")
gadm <- getData('GADM', country = "AT", level = 2)
gadm_sub <- gadm[sample(1:length(gadm), 5), ]
plot(alt)
plot(gadm_sub, add=T)
asp <- terrain(alt, opt = "aspect", unit = "degrees", df = F)
slo <- terrain(alt, opt = "slope", unit = "degrees", df = F)
> extract(slo, gadm_sub, fun = mean, na.rm = T, small = T, df = T)
ID slope
1 1 9.959053
2 2 1.047443
3 3 7.456165
4 4 1.673786
5 5 11.946553
> extract(asp, gadm_sub, fun = mean, na.rm = T, small = T, df = T)
ID aspect
1 1 170.8065
2 2 184.0130
3 3 190.7155
4 4 136.8953
5 5 205.2115
18 Jun 2013
R GIS: Terrain Analysis for Polygons as Simple as it Gets!
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment