157 - Perform a map algebra calculation using command line, form-based, and flow charting user interfaces

Perform a map algebra calculation using command line, form-based, and flow charting user interfaces

Concepts

  • [AM4-4] Neighborhood analysis
    Neighbourhood functions evaluate the characteristics of an area surrounding a feature’s location. A neighbourhood function “scans” the neighbourhood of the given feature(s), and performs a computation on it (them). Examples of proximity computations are: (1) Buffer zone generation (or buffering) is one of the best-known neighbourhood functions. It determines a spatial envelope (buffer) around a given feature or features. The buffer created may have a fixed width or a variable width that depends on characteristics of the area. (2) Thiessen Polygon generation. For raster images: (3) Computation of diffusion (4) Flow computation. For instance, our target might be a medical clinic. Its neighbourhood could be defined as: an area within a radius of 2 km distance as the crow flies; or an area within 2 km travelling distance; or all roads within 500 m travelling distance; or all other clinics within 10 minutes travelling time; all residential areas for which the clinic is the closest clinic. Finally, in the third step we indicate what it is we want to discover about the phenomena that exist or occur in the neighbourhood. This might simply be its spatial extent, but it might also be statistical information such as: how many people live in the area; what is their average household income; are any high-risk industries located in the neighbourhood. These are typical questions in an urban setting. When our interest is more in natural phenomena, different examples of locations, neighbourhoods and neighbourhood characteristics arise. The principle in this case is to find out the characteristics of the vicinity, here called neighbourhood, of a location. After all, many suitability questions, for instance, depend not only on what is at a location but also on what is near the location. Thus, the GIS must allow us “to look around locally”. To perform neighbourhood analysis, we must: 1. state which target locations are of interest to us and define their spatial extent; 2. define how to determine the neighbourhood for each target; and 3. define which characteristic(s) must be computed for each neighbourhood. Since raster data are the more commonly used in this case, neighbourhood characteristics often are obtained via statistical summary functions that compute values such as the average, minimum, maximum and standard deviation of the cells in the identified neighbourhood. To select target locations, one can use the selection techniques. To obtain characteristics from an eventually-to-be identified neighbourhood, the same techniques apply. So what remains to be discussed here is the proper determination of a neighbourhood. One way of determining a neighbourhood around a target location is by making use of the geometric distance function. Geometric distance does not take into account direction, but certain phenomena can only be studied by doing so. Think of the spreading of pollution by rivers, groundwater flow or prevailing weather systems. Diffusion functions are based on the assumption that the phenomenon in question spreads in all directions, though not necessarily equally easily in each direction. Hence it uses local terrain characteristics to compute local resistances to diffusion.
  • [AM4-5] Map algebra
    GISs that support raster processing - as most do - usually have a language to express operations on rasters. These languages are generally referred to as map algebra or, sometimes, raster calculus. They allow a GIS to compute new rasters from existing ones, using a range of functions and operators. Unfortunately, not all implementations of map algebra offer the same functionality. The discussion below is to a large extent based on general terminology; it attempts to illustrate the key operations using a logical, structured language. Again, the syntax often varies among different GIS software packages. When producing a new raster we must provide a name for it, and define how it is to be computed. This is done in an assignment statement of the following format: Output raster name := Map algebra expression. The expression on the right is evaluated by the GIS, and the raster in which it results is then stored under the name on the left. The expression may contain references to existing rasters, operators and functions; the format is made clear in each case. The raster names and constants that are used in the expression are called its operands. When the expression is evaluated, the GIS will perform the calculation on a pixel-by-pixel basis, starting from the first pixel in the first row and continuing through to the last pixel in the last row. In map algebra, there is a wide range of operators and functions available. Arithmetic operators Various arithmetic operators are supported. The standard ones are multiplication (×), division (/), subtraction (-) and addition (+). Obviously, these arithmetic operators should only be used on appropriate data values, and, for instance, not on classification values. Other arithmetic operators may include modulo division (MOD) and integer division (DIV). Modulo division returns the remainder of division: for instance, 10 MOD 3 will return 1 as 10 - 3 × 3 = 1. Similarly, 10 DIV 3 will return 3. Other operators are goniometric: sine (sin), cosine (cos), tangent (tan); and their inverse functions asin, acos, and atan, which return radian angles as real values. The assignment C1 := A + 10 will add a constant factor of 10 to all cell values of raster A and store the result as output raster C1. The assignment C2 := A + B will add the values of A and B cell by cell, and store the result as raster C2. Finally, the assignment C3 := (A - B) ∕ (A + B) × 100 will create output raster C3, as the result of the subtraction (cell by cell, as usual) of B cell values from A cell values, divided by their sum. The result is multiplied by 100. This expression, when carried out on AVHRR channel 1 (red) and AVHRR channel 2 (near infrared) of NOAA satellite imagery, is known as the NDVI (Normalized Difference Vegetation Index). It has proven to be a good indicator of the presence of green vegetation. Comparison and logical operators Map algebra also allows the comparison of rasters cell by cell. To this end, we may use the standard comparison operators (<, ⇐, =, >=, > and <>). A simple raster comparison assignment is C := A <> B. It will store truth values—either true or false—in the output raster C. A cell value in C will be true if the cell’s value in A differs from that cell’s value in B. It will be false if they are the same. Logical connectives are also supported in many raster calculi. We have already seen the connectives of AND , OR and NOT in raster overlay operators. Another connective that is commonly offered in map algebra is exclusive OR (XOR). The expression a XOR b is true only if either a or b is true, but not both. Conditional expressions The comparison and logical operators produce rasters with the truth values true and false. In practice, we often need a conditional expression together with them that allows us to test whether a condition is fulfilled. The general format is: Output raster := CON(condition, then expression, else expression). Here, condition stands for the condition tested, then the expression is evaluated if condition holds, and else the expression is evaluated if it does not hold. This means that an expression such as CON(A = “forest”, 10, 0) will evaluate to 10 for each cell in the output raster where the same cell in A is classified as forest. For each cell where this is not true, the else expression is evaluated, resulting in 0. Overlays using a decision table Conditional expressions are powerful tools in cases where multiple criteria must be taken into account. A small example may illustrate this. Consider a suitability study in which a land use classification and a geological classification must be used. Domain expertise dictates that some combinations of land use and geology result in suitable areas, whereas other combinations do not. In our example, forests on alluvial terrain and grassland on shale are considered suitable combinations, while any others are not. We could produce an output raster with a map algebra expression, such as Suitability := CON((Landuse = “Forest” AND Geology = “Alluvial”) OR (Landuse = “Grass” AND Geology = “Shale”), “Suitable”, “Unsuitable”) and consider ourselves lucky that there are only two “suitable” cases. In practice, many more cases must usually be covered and, then, writing up a complex CON expression is not an easy task. To this end, some GISs accommodate setting up a separate decision table that will guide the raster overlay process. This extra table carries domain expertise and dictates which combinations of input raster-cell values will produce which output raster-cell value. This gives us a raster overlay operator using a decision table. The GIS will have supporting functions to generate the additional table from the input rasters and to enter appropriate values in the table.