Contents
How to add raster datasets in ArcPy?
If you’re raster datasets are open in ArcMap you can refer to them by their name in the table of contents, using quotes. import arcpy from arcpy import env from arcpy.sa import * #No need to assign paths to variables.
When to use raster in ArcGIS Spatial Analyst?
An ArcGIS Spatial Analyst extension is necessary to execute Map Algebra statements. The raster object created from existing data can be used in subsequent Map Algebra expressions and will have all the associated raster properties and methods.
How to add two rasters using map algebra?
I want to simply add two rasters within a python script using map algebra, which from what I understand is the equivalent to adding two rasters in the raster calculator. If I do this using raster calculator and simply type “Raster1 + Raster2”, it works perfectly.
How to make a raster object permanent in ArcGIS?
By calling the save method on the raster object. Call Make Permanent by right-clicking on the layer with an associated raster object in the TOC and specifying an output name. Saving the map project (.MXD, .3DD, and so on) that contains any layers with associated raster objects.
How is a raster object created in ArcGIS?
A raster object is a variable which references a raster dataset. A raster object can be created in two ways. You can create a raster object by supplying the path to an existing raster on disk, or it can be the result of any Map Algebra statement that results in a raster output.
How to pass rasters to map algebra in Python?
The reason the documentation you link shows the rasters being passed to map algebra statements in quotes is because they assume you are typing in the python console in ArcMap. If you’re raster datasets are open in ArcMap you can refer to them by their name in the table of contents, using quotes.
When does a raster object become permanent in Map Algebra?
When a Raster object is returned from a Map Algebra expression, by default, the object (the variable and associated dataset) is temporary. The temporary dataset associated with a raster object can become permanent by calling the raster object’s save method.