star.gif 0.2 KLaboratory Exercise 6star.gif 0.2 K

Distance and Context Operators


As you recall, we discussed four general classes of raster-based GIS operations: reclassification, overlay, distance, and neighborhood characterization. We have already examined aspects of the former two in previous exercises. We now turn our attention to applications of the latter two. Distance operators can be Euclidean (as the crow flies) or weighted (non-Euclidean or as the intoxicated person walks). Also, we can think of distance not only in units of feet, meters, miles, kilometers, and so on, but also in terms of effective time or accumulated cost. Context operators examine neighborhoods of grid cells and summarize their values based on some mathematical or statistical function, such as minimum, maximum, mean, median, and so on.

In Idrisi there are several Distance- and Context-related operations. In this exercise, we will examine and apply two of those, respectively: DISTANCE and SURFACE. The former measures the Euclidean distance between each cell and the nearest of a set of target features. Distances are output in reference system units. Distances derived from images with rectangular cells are correctly calculated. DISTANCE first requires that you input the name of the feature image. This is the image containing the target features from which distance should be measured. This image must contain integer values with non-zero cells indicating the feature targets. Then input a new name for the output image, as well as the value units and a title. Related to DISTANCE is COST, which generates a distance/proximity surface (also referred to as a cost surface) where distance is measured as the least effort in moving over a friction surface. The unit of measurement is grid cell equivalents (gce). A grid cell equivalent of 1 indicates the cost of moving through a grid cell when the friction equals 1. A cost of 5 gce's might arise from a movement through 5 cells with a friction of 1, or 1 cell with a friction of 5. Costs are determined radially from a set of source targets to the edges of the image. We will deal with cost surfaces in a subsequent exercise.

A context operator, SURFACE calculates slope, aspect and shaded relief images from a digital elevation model. SURFACE requires that you first choose whether slope, aspect, slope and aspect, or analytical hillshading should be calculated. You are then required to input the name of the digital elevation model image and a name(s) for the output file(s). Choose whether you want the calculations in degrees or percent and enter the conversion factor (see Note 4). The default is set to 1. If you have chosen to calculate analytical hillshading, the calculations are always in degrees and you must input both the sun azimuth in degrees and the sun elevation angle in degrees. The defaults are set to 315 and 30 respectively. Finally, enter a title(s) for the output image(s).

SURFACE determines the slope by calculating the maximum slope around each pixel from the local slopes in X and Y. Only the neighbors above, below, and to either side of the pixel are accounted for in this procedure, called a "rook's case" procedure. Slopes are output in either decimal degrees or percents. Slope gradients in percents represent the tangent of the angle multiplied by 100. Therefore, a 45 degree angle = 100%, while a 90 degree angle will approach an infinite percent.

The aspect is the direction in which the maximum slope faces. Aspects are output in decimal degrees and use standard azimuth designations, 0 - 360, clockwise from north. In regions where the surface is perfectly flat with slope = 0, aspect is assigned a value of -1. The output data type is real.

Analytically shaded images are for purposes of illustration only and are best viewed with the Grey 16 palette. The numeric results represent only relative illumination and are not quantified to any external reference. The resulting image may benefit from a contrast stretch.

If an image's value units do not match the reference system units, SURFACE requires a conversion factor to calculate the slope. The conversion factor is the number with which you multiply values in one unit (e.g., the value units) to change them to the values in the other unit (e.g., the reference units). Check the documentation file to confirm the units before proceeding. For example, if the value units are "ft", but the reference units are "m", the conversion factor would be 0.3048; a conversion in the opposite direction (from "m" to "ft") would require a conversion factor of 3.28. Conversion in the case of "deg" or "rad" are more complicated, because the ground distance between degrees changes with latitude.

To perform the algorithms on the edge values, SURFACE temporarily adds an extra row and column around the edges of the image and assigns the cells the values of the adjacent cells.


This exercise, as described in the Idrisi for Windows Student Manual, is a suitability assessment problem in which we are to locate all areas meeting siting criteria and constraints for a light manufacturing plant. Site suitability criteria include acceptable terrain slope (< 2.5 degrees), size (contiguous suitable areas of at least 10 hectares), current land use (must be within currently forested area), and water protection (sites need to be more than 250 meters from reservoirs).

To solve this problem, you will need to use both DISTANCE and SURFACE, as well as some of the operators you have used previously, such as RECLASS, ASSIGN, OVERLAY, GROUP, AREA, and a couple others. This exercise is an excellent one for getting a real feel for cartographic modeling, or digital light table gymnastics. You might wish to start the exercise by overviewing the model flowchart provided.

With the supervision of your instructor or lab coordinator, use the Idrisi for Windows software to carry-out the directions for Tutorial 8 in the Student Manual.


The data for this tutorial are located in the Idrisi for Windows sample exercise data directory, typically C:\EXERCISE. The path may vary from PC to PC, so check with the instructor or lab coordinator.


For Tutorial 8 on Distance and Context Operators, answer questions 4, 5, and 6.

For map results, produce a hardcopy of SUITABLE, which is the final result of the cartographic model, as well as a hardcopy of an orthographic projection of a version of this suitability map draped over the terrain model named RELIEF. As before, please produce an electronic copy of each of these maps, using whatever graphics tools you prefer, in either a .BMP or .GIF format.

For University of Hartford students, submit your answers and digital maps (images) via e-mail to:

For students at UConn, submit your work to:

Sensitivity Analysis

If time permits, explore the ramifications of changing one or more of the siting criteria, varying only one criterion at a time (initially, anyway). For example, you might consider relaxing the slope constraint to allow the facility to be located on slopes up to 4 degrees. Or maybe allowing it to be located within 150 meters of reservoirs. Or maybe pushing it back to no closer than 350 meters. Perhaps the manufacturing plant can be situated on parcels that are only 5 hectares in extent. There are many variations one could implement in this if-then-what type of modeling. That's the real power of computer-based cartographic modeling!