I have a function that calculates a price based on the input slope and distance. I want to write the price to a raster as the rastervalue. How do I do that? OpenSource and ArcMap solutions would work.
slopeRaster = "slope.tif"
emptyRaster = "emptyraster.tif" # How do I create an empty raster?
road = "road.shp"
for cell in emptyraster:
# get slope from sloperaster at cell location
...
slope = ...
# get distance to nearest road from center of cell
...
distance = ...
# calculate price for cell
price = pricefunc(slope, distance)
# write price to cell as value # How do I write a value to a raster
You can do this pretty easily in
R
. I recommend you download and install it (it's free and Open Source). The only thing you will have to do is to work out how to code your price function in R which is why I suggested you post that code. Once you have your pricefunc defined you can then run these commands from the R command line.