Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
share|improve this question
Precisely what solutions don't work? This sounds like a straightforward map algebra calculation, which is supported by ArcGIS (the Spatial Analyst extension), GRASS (open source), and all GISes with raster capabilities. – whuber Mar 14 '13 at 0:07
Well how do I create an empty raster for example with ArcMap and how do I write a value coming from my function to the cells? – ustroetz Mar 14 '13 at 0:09
There is no need ever to create an empty raster. As for the rest, might I suggest you start by looking over the Spatial Analyst help pages. – whuber Mar 14 '13 at 1:58
In particular, look at the raster calculator and the Slope and EucDistance functions. – Luke Mar 14 '13 at 5:15
Thanks guys for the helpful hints. I will look into it. – ustroetz Mar 14 '13 at 16:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.