Select to view content in your preferred language

simple raster processing, fill with integer [python]

968
4
11-16-2010 12:58 AM
HugoAhlenius
Deactivated User
Hi, how do I just fill an extent with an integer value, like 1? I have defined cellsize and extent in the environment, but then I would like create a grid with all cells set to e.g. 1.

In ArcInfo Grid I would do:
newGrid = 1
0 Kudos
4 Replies
ChrisSnyder
Honored Contributor
In v9.3:

gp.extent = "0 0 1000 5000"
#or gp.extent = r"C:\temp\test.shp"
#optional gp.mask = r"C:\temp\test.shp"
gp.cellsize = "100"
# optional gp.snapraster = someOtherGrid
somaExp = "1"
outputGrd= r"C:\temp\test"
gp.SingleOutputMapAlgebra_sa (somaExp, outputGrd, "")
0 Kudos
DanPatterson_Retired
MVP Emeritus
what version of ArcMap?
have you ruled out the raster calculator? (placed in different locations depending upon versions)
have you ruled out the Constant Raster Tool in ArcToolbox, which can also be implemented via Python.
0 Kudos
HugoAhlenius
Deactivated User
This is ArcGIS 10 - and I didn't know about the Constant Raster tool - thanks for the pointer, although it seems like a convoluted way to do that!
0 Kudos
DanPatterson_Retired
MVP Emeritus
0 Kudos