library(raster) zipfile=tempfile() download.file("http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/N35E133.hgt.zip",zipfile) unzip(zipfile) t1 = raster('N35E133.hgt') download.file("http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/N35E134.hgt.zip",zipfile) unzip(zipfile) t2 = raster('N35E134.hgt') tottori<-merge(t1,t2) slope <- terrain(tottori, opt='slope') aspect <- terrain(tottori, opt='aspect') hill <- hillShade(slope, aspect, 40, 270) brks<-c(1,seq(100,2000,100)) arg <- list(at=c(0,500,1000,1500,2000), labels=c("0","500","1000","1500","2000")) plot(hill, col=grey(0:100/100), legend=FALSE, main='Tottori') plot(tottori,breaks=brks,col=terrain.colors(25,alpha=0.35), add=TRUE, axis.args=arg) yonago_city<-c(133.331,35.428) tottori_city<-c(134.235,35.501) points(yonago_city[1],yonago_city[2],pch=16,cex=0.5, col="red") points(tottori_city[1],tottori_city[2],pch=16,cex=0.5, col="red") segments(yonago_city[1],yonago_city[2],tottori_city[1],tottori_city[2],col="red",lwd=1.5)
|