Grids can also serve to represent the results of spatial analyses. In many cases, the calculation is easy to program and runs quickly. The trade-off between using a grid and using a vector representation (a shapefile, in ArcView) is interesting and important; we will explore it here by computing a distance grid and a proximity grid.
First, let's do an example. Here is how the distance grid was created from the freeway on-ramps in GTKAV Chapter 29.
Load the Spatial Analyst extension.
Go to the Project window. In the Project|Properties dialog, specify a "Work Directory". This will be the location where Spatial Analyst saves the grids you produce. It's a nuisance that you have to type this in, but it is worth it.
Create a new View. Add GTKAV/Data/Ch13/street3.shp as a theme. Give it a nice name (Theme|Properties), such as "Streets", because Spatial Analyst will use this name in the grids it derives from the theme.
Inspect the attribute table. You should be able to guess which field describes highway type. Use the Query button to select all on-ramp features. (The expression is provided further below.)
If you like, adjust the View's background color in the View|Properties dialog to match the picture. Here is what it should look like:
![]() |
(Actually, I cheated a little to make the selected on-ramps more visible. The legend is a unique value legend, keyed on the [Street_typ] field. The symbol for "ONRP" (the on-ramps) has been given a thickness of 2 pixels, rather than the thinner default, to provide visual emphasis.) |
Set the Analysis|Properties parameters. A good choice is to zoom to the selected features, then zoom out once or twice. Specify that the analysis extent be the same as the display. Round the four values (left, top, right, bottom) to multiples of 100--it can be helpful in later analyses for grid cells to line up, rather than originate at practically random locations. Choose a cell size around 25 to 50 (100 or more when first experimenting) for a reasonable compromise between performance and resolution.
Activate the streets3.shp theme. Press the Analysis|Find Distance item.
The new grid will appear at the top of the Table of Contents, where it will obscure everything when made visible. So first move it to the bottom of the Table of Contents by dragging it with the mouse. Then make it visible.
![]() |
This is the result. The lightest yellow areas are closest to the on-ramps. The solid contours are graduated buffers around the on-ramps at intervals of 1,467 feet in this picture. (Your intervals will be different unless you chanced to use exactly the same analysis extent. The reason is that the intervals will be one-thirteenth of the maximum distance from an on-ramp and that maximum depends on the analysis extent.) |
Sooner or later, you will need to know exactly what this calculation does. To see what is going on, I re-did it using a coarse cell size of 1000. This picture posts the cell values (to the nearest integer) on each cell:
|
You can see that the top middle cell, with a
value of 1000, is just next to an on-ramp (shown in bright yellow).
Evidently, Spatial Analyst does the distance computation in two steps:
For more information, see the ArcView help for "EucDistance" and click on the "Discussion" link at the top. |
By the way, the query expression in step 3 is ( [Street_typ] = "ONRP" ).
This detailed knowledge of the distance calculation lets us estimate the imprecision in the grid. The worst underestimate of distance occurs when a feature just meets one corner of a cell; that entire cell will have a value of zero, but the opposite corner will really be at 1.4142 (the square root of 2) times the cell size away from the feature. The worst overestimate of distance occurs when a feature just misses one corner of a cell; the overestimate can be as large as 1.4142 times the cell size. (This calculation ignores other causes of imprecision, such as distortions in the projection and errors in feature positions.)
The precision estimate provides an initial basis for determining a cell size appropriate to the calculation: to avoid making an error greater than X units, set the cell size no larger than X/1.4142 (X divided by the square root of 2).
This is only an initial estimate. Another consideration is the use of computing resources. For a given grid extent, halving the cell size will quadruple the number of cells. Many grid operations are directly proportional to the number of grid cells, so this also will quadruple computation times. Hence, using a very small cell size can have a disproportionate effect on disk storage needs and on computation time. This is not usually a problem for a single calculation, but in a more complex project, requiring sometimes hundreds of calculations, those extra hundreds of megabytes and extra minutes of computation really add up.
Finally, it is usually wise to use a cell size that is a nice multiple of your favorite distance units. This facilitates the kind of "back of the napkin" calculations you will constantly be making to estimate cell sizes, grid extents, and so on.
What is the relationship (if any) between land use and freeway access? This question calls for computing and evaluating the relationship between land use and distance.
Land use data are available in GTKAV/Data/Ch13/landuse.shp. Some fields in this theme's feature table will be particularly useful:
![]() | [Landuse_] appears to be a unique identifier. It probably corresponds to individual tracts or parcels. |
![]() | [Landuse] (note the absence of a following underscore) provides numeric codes to describe land use. |
![]() | [Exp] seems to be a short description of each land use code. Some codes share descriptions; for example, codes 16 and 600 are both "vacant." |
It will be handy to have a look-up table associating each value of [Landuse] with its description, so let's make one: Summarize the landuse.shp feature table on [Landuse]. Request the first occurrence of [Exp] in the summary. The resulting table, which I have named "usecodes.dbf", should have 98 records: one for each land use code. |
To pursue the question, we need data of distances to freeway on-ramps for each land use code. Such data must be statistical in nature, because parcels for any given land use code may be scattered all over. Some may be close to the freeway, others further away. We might use an average (mean) distance within the parcels. At the same time, to gauge how scattered the parcels are, we would also like a measure of variation of distances: greatest distance, least distance, standard deviations of the distances.
That's beginning to look like a lot of work, but it is not in ArcView. The operation should remind you of the Summarize operation, and indeed it is remarkably the same. The summarize operation computes statistics for each unique value of some key field in a set of table records. In the present case, we do not have a table, but we will have a grid: it will represent the [Landuse] theme features. The role of the table records will be played by the individual cells. The role of the table fields (which contain the data for each record) will be played by two grids (which contain the data for each cell). One grid will be the "key": there will be one summary record for each unique key value. The other grid will be the "data": its values will be used to compute the statistics.
The Spatial Analyst terminology for key values is "zones," because each key value defines a set of grid cells. These have a spatial extent and can be thought of as separate, non-overlapping zones.
For our calculation, we wish to compute statistics about distance, so the [Distance to streets] theme computed earlier will be the data grid. The statistics will correspond to land use codes, which appear in the [Landuse.shp] theme. As with the summarize operation, which begins by activating the key field in a table, this Summarize by zones operation begins by activating the zone theme. The rest is straightforward:
Activate the [Landuse.shp] theme. This is the zone theme.
Select Analysis|Summarize zones... in the View menu.
ArcView will present you with a list of fields
in the zone theme. Select [Landuse], because those values identify the
zones.
ArcView will then present you with a list of
grid themes. Select the [Distance to streets] grid, because it
contains the data we want to summarize. This is the data theme.
The summarize operation will take a few seconds, depending on the size of grids.
The result of the summarize zones operation is a table with the data we want. Unfortunately, it is keyed by [Landuse], which is not very informative. So
Join [Usecodes.dbf] to the summary table using the common [Landuse] field. This will associate the description ([First_Exp]) with each code.
As an example of how to use this information, sort the summary table by decreasing [Mean] distance value. Notice that two records have exceptionally large values. These are types of land use--"Vacant extractive" and "Airports"--that occur only very far from the freeway.
![]() |
You can use your ArcView skills to join the summary table to the [Landuse] theme to visualize the results, or you can simply query the [Landuse] theme to select the two most extreme landuse codes. |