你可以很容易地在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