2017-12-08 14 views
0

道路、斜面、植生によって制限されていると仮定して、道路からどれだけ遠くまで走ることができるかを調べるプロジェクトを開始しました。私は問題に順番にアプローチしようとしましたが、解決できる以上の問題が発生していますので、この記事のすべてを追加します。私の最初の試みは、@クリストファー・ステファンへfind all the terrain that is <= 5 degrees.勾配の閾値内にある道路網からの距離を遠ざける

のおかげにしたので、私の車は、5度の傾きよりもで駆動することはできません

、私は次の絵を持っています。 Area that is steeper than 5 degrees of slope

先行する仕事や、私がしようとしていることに対処する記事を見つけることができないので、私はそれを説明します。

私は車の中の道路にいるとき、この場合はパラワンですが、斜面が5度(非常に重要)になるか、または私がオフロードで走ることができるか、ジャングルに走る(あまり重要ではない)。

私は5度以内の勾配を持っていると思っています。道路をプロットして、どうにか5度未満の隣のボックスをシェードします。斜面が5度以上になると、それを別の色にします。 (出力はこのグラフィックです)。

次に、各陰影領域内にある領域の割合を見つける必要があります(pを見つけると仮定し、もう1つは1-pです)。

絵のコードはあなたがhttp://philgis.org/country-basemaps/roadsからシェープファイルとして道路網を取得し、levelplotに追加することができ

library(raster) 
library(rasterVis) 
elevation <- getData("alt", country = "PHL") 
x <- terrain(elevation, opt = c("slope", "aspect"), unit = "degrees") 
e <- drawExtent(show = TRUE) 
gewataSub <- crop(x, e) 
m <- c(0, 5, 0, 5, maxValue(gewataSub$slope), 1) 
rclmat <- matrix(m, ncol = 3, byrow = TRUE) 
rc <- reclassify(gewataSub$slope, rclmat) 
levelplot(rc, margin = F, col.regions = c("wheat", "gray"), colorkey = list(at = c(0, 1, 2), labels = list(at = c(0.5, 1.5), labels = c("<= 5", "> 5")))) 

おかげ

答えて

0

を下回っています。そこから私はあなたの期待される結果がどうなるかを正確に理解していません。

library(raster) 
library(rasterVis) 
library(rgdal) 

elevation <- getData("alt", country = "PHL") 
x <- terrain(elevation, opt = c("slope", "aspect"), unit = "degrees") 
plot(x$slope) 

e <- drawExtent(show = TRUE) 
gewataSub <- crop(x, e) 
plot(gewataSub$slope, 1) 

m <- c(0, 5, 0, 5, maxValue(gewataSub$slope), 1) 
rclmat <- matrix(m, ncol = 3, byrow = TRUE) 
rc <- reclassify(gewataSub$slope, rclmat) 

roads = readOGR("/Users/christopherstephan/Downloads", layer = "roads") 

levelplot(
    rc, 
    margin = F, 
    col.regions = c("wheat", "gray"), 
    colorkey = list(at = c(0, 1, 2), labels = list(
    at = c(0.5, 1.5), labels = c("<= 5", "> 5") 
)) 
) + layer(sp.polygons(roads)) 

enter image description here

関連する問題