

An efficient way to identify the elevation range is to use a Boolean evaluation. Once you have the minimum elevation set, you also need to identify the upper elevation limit, 3600 feet. Notice the second Con statement does not use the where_clause parameter explicitly, but specifies the condition directly to the in_conditonal_raster parameter instead.įunctionality: Defining ranges using Boolean evaluations (“&”) in a complex expression Any location with an elevation greater than 1800 feet (the where_condition) meets your criteria and will be assigned “1” (the in_true_raster_or_constant), while locations equal to or below 1800 feet are assigned a “0” (the in_false_raster_or_constant). While the preceding statement will work fine, writing it in the following way is preferred, since it allows for some optimizations to be made on execution and thus should run faster: outElev1 = Con(elev > 1800, 1, 0)īoth these statements would give you the same output. import arcpy from arcpy.sa import * elev = Raster("elevation.tif") # Creating a raster object from the elevation dataset outElev1wc = Con(elev, 1, 0, "Value > 1800") It is recommended to first create the raster object from the elevation dataset and then use the resulting object in the subsequent Con statement. To specify the input to the Con tool as a raster, create a raster object from the input dataset. To achieve the desired output, you will assign a “1” to the locations with elevations meeting this criterion and a “0” for elevations equal to or lower than 1800 (see Figure 1). To do this in the Con tool dialog, specify your elevation raster (elevation.tif) as the Input condition raster and the value greater than 1800 feet as the condition in the Expression. If a location meets the criteria, you want to assign the location a “1” (True) and locations not meeting the criteria, you want to assign a “0” (False). Where are the best locations to grow my coffee?įirst, you are interested in locations where the elevations are greater than 1800 feet. Now that you have the basics of how Con works, let’s start the analysis. It is also available from the sa module in arcpy and can also be accessed using the Raster Calculator tool. The Con tool is available in the Conditional toolset in the Spatial Analyst toolbox. Figure 1: Geoprocessing Dialog box for the Con tool. For more details, you can read the help page here.

The syntax for the Con tool is: Con(in_conditonal_raster, in_true_raster_or_constant, ). The basic premise of the tool is to create output based on some condition. So, you would like to identify areas that maximize the above-mentioned factors.īefore you start with the analysis, let’s quickly recap the Geoprocessing Con tool (see Figure 1). South facing aspects are desirable, but not mandatory. The ideal conditions for growing the plants that produce Arabica coffee beans include areas that are between 18 feet in elevation, are flat and open, and are near roads and streams.

To identify which areas to buy, you are considering various factors such as elevation, land use type, slope, aspect, and so on. Let’s go through a scenario to better understand how the tool works.Īssume you are a coffee grower and you wish to expand your growing operation by purchasing additional land. It allows you to vary how the output is determined based on the value of the input locations, which is key for building simple as well as complex models. ‘Con’, abbreviated for condition, is one of the most used and powerful tools in Spatial Analyst.
