你可以很容易地在R
中做到這一點。我建議你download and install it(它是免費的和開源的)。你唯一需要做的就是研究如何在R中編寫你的價格函數,這就是爲什麼我建議你發佈代碼。一旦你定義了pricefunc,你就可以從R命令行運行這些命令。
# Install required packages
install.packages(c("raster" , "spatstat" , "sp" , "rgdal") , dep = TRUE)
# Load required packages
require(raster)
require(spatstat)
require(sp)
require(rgdal)
# Read in your data files (you might have to alter the directory paths here, the R default is to look in your $USERHOME$ directory R uses/not \ to delimit directories
slp <- raster("slope.tif")
roads <- readShapeLines("road.shp")
# Create point segment pattern from Spatial Lines
distPSP <- as.psp(roads)
# Create point pattern from slope raster values
slpPPP <- as.ppp(values(slp))
# Calculate distances from lines for each cell
distances <- nncross(slpPPP , distPSP)
# Create raster with calcualted distances
rDist <- raster(slp)
values(rDist) <- distances
# Define your princefunc() here. It should take two input values, slope and distance and return one value, which I have called price
pricefunc <- function(slp , dist){
...my code
... more code
...more code
return(price)
}
# Calculate price raster using your price function and save as output.tif
rPrice <- overlay(slp , rDist , fun = function(x , y){ pricefunc(x , y) } , filename = "output.tif")
您可以在'R'中做到這一點。你是否熟悉它?如果你能給我們提供你的價格的詳細信息,這將有助於提供一個完整的解決方案.Func – 2013-03-14 17:32:28
我還沒有使用R. priceFunc超長。我認爲這不重要。它基本上採用參數斜率和距離並返回一個價格。 – ustroetz 2013-03-14 17:54:09
如果您想要一個完整的解決方案,這非常重要。我只能帶你到目前爲止,而不知道如何根據你的輸入值來計算價格。 – 2013-03-14 18:05:11