\title{Spatial Relationships In GIS - An Introduction}

\author{Landon Blake (A.K.A. The Sunburned Surveyor)}

\maketitle

\section{Introduction}
\label{sec:Introduction}
This article provides the reader with an introduction to spatial relationships in Geographic Information Systems (GIS). It presents a simple definition of spatial relationships and explains why spatial relationships are important in a GIS. This article is intended for a reader with a basic knowledge of GIS, and does not cover advanced concepts. To get the most benefit out of this article the reader should [1] understand what a ``feature'' is in the context of a GIS, [2] understand how features are commonly represented by vector geometry types like points, lines, and polygons, and  [3] have a basic knowledge of geometry and coordinate systems. 

\section{What are spatial relationships?}
\label{sec:What are spatial relationships?}

In GIS abstractions or simplifications of real world objects are called ``features''. For example, we might represent a network of roads in an urban area with a network of line segments. Features in a GIS typically have some type of spatial representation. We can use different ways to model the features shape and location in a GIS.  Spatial relationships describe how these features are located in relation to each other. By studying the relationship between these features, we can learn more about the real world objects they represent. 

\section{Article Scope}
\label{sec:Article Scope}
In this article we will deal specifically with the spatial relationships between features modeled with ``vector geometries''. For the purposes of this discussion we define ``vector'' geometries as shapes that can be expressed using distances, angles, or coordinates. This article does not consider spatial relationships in raster or surface data. Future articles may discuss spatial relationships between raster and surface data. 

The shape and location of features in a GIS are commonly described in two dimensions, but may be described in only one dimension, or in three or more dimensions. In this article we will concentrate on the spatial relationships between real world objects in only two dimensions. Future articles may consider the spatial relationships between features represented in three or more dimensions. 

\section{Definition of Spatial Relationship}
\label{sec:Definition of Spatial Relationship}
The definition of \emph{spatial relationship} we will use in this article is: ``A description of the one or more ways in which the location or shape of a feature is related to the location or shape of another feature.''

\section{What Are Vector Geometries?}
\label{sec:What Are Vector Geometries?}
Vector geometry employs mathematical descriptions of distances and angles or coordinate values to describe the ``shape'' of a feature. For example, you might represent a single tree as a point, a stream or creek as a line segment or series of connected line segments, and a group of trees or a tree stand as a polygon. In the next section we will consider the ways we can describe the spatial relationships between two or more vector geometries used to represent features in a GIS.

\section{How can we identify and describe spatial relationships?}
\label{sec:How can we identify and describe spatial relationships?}
We can describe the spatial relationship between two features represented by vector geometries in three main ways. You can learn to identify spatial relationships in your GIS data by considering different features and considering how they may be related in these ways.

\subsection{Three Ways To Identify Spatial Relationships Between Vector Geometries}
\label{subsec:XX}

[1] Compare the measurements of each feature's geometry or shape.
[2] Consider the measurements ``between'' the locations of two or more features geometries and shapes.
[3] Consider how one feature touches, overlaps, contains, or connects to another feature. (This is a special type of spatial relationship known as topology.)

In this article we will take a closer look at the first two ways we can describe a spatial relationship. Topology will be discussed in a future article. 

\section{An Example}
\label{sec:XX}

The best way to learn about the first two ways to describe a spatial relationship is with an example. In this example we will look at some of the spatial relationships between two features represented by line segments. A line segment is a portion of a line. In our example we will assume all line segments are straight and not curved. (If we adhere to the strict geometrical definition of a line, a line has no end points and stretches on forever in two directions. That is why we use the term ``line segment'', which has definite end points. This strict geometrical definition of ``line'' is not what most lay people think of when they read or hear the word ``line''.)

Diagram 001 shows two features. The blue feature on the left of the diagram is a creek or a stream represented by a series of connected line segments. The feature on the left of the picture is trail that runs along the creek. The trail is represented by a single straight line segment. I have numbered each point or node at the angle points and end points of the two feature geometries with a 3-digit identifier. 

What are some of the spatial relationships between the two features shown in Diagram 001 that fit into the first two categories listed above?

Think about how we can compare the measurements of each feature geometry to the measurements of the other feature geometry. In this case the obvious comparison that we can make is the total or overall length of each feature geometry. (Note that a ``feature geometry'' is not the same thing as a ``feature''. A feature represents a real world object, while a feature geometry represents the shape of a feature.) Our creek is longer than the adjacent trail feature, due to its wandering course. This is a relationship that we can quantify using measurement data about the two feature geometries. The total length of the creek  between point \#101 and point \#108 is 370 feet. The length of the trail feature is 345 feet. We know from this information that the creek is 25 feet longer than the trail, and that each foot along the trail corresponds to an average of 1.072 feet of creek. 

Now consider how we can describe the spatial relationships between the two features by using the measurements ``between'' the locations of the feature geometries. 

\begin{itemize}
\item We can measure the distance from each node on the creek to the trail along a direction perpendicular to the trail. 
\item We could also compare the angle between each line segment of the creek and the line representing the trail.
\item We could compute the area between each line segment of the creek and the line representing the trail.
\end{itemize}

\begin{figure}[htbp]
   \centering
   \includegraphics[scale=0.35]{topical/blake/Diagram_001}
   \caption{Diagram 001 - An Example}
   \label{fig:Diagram_001}
\end{figure}


\section{Why are spatial relationships important in a GIS?}
\label{sec:XX}
When we consider spatial relationships in a GIS they allow us to answer questions about features that we would be unable to answer otherwise. In this way spatial relationships are an aid to spatial analysis. Spatial analysis allows us to answer questions using data that cannot be answered in traditional information management systems such as a relational database. GIS enable this spatial analysis to take place because they track ``location'' information. You can think of spatial relationships as an important part of the foundation upon which spatial analysis is built. The ability to identify and quantify spatial relationships is consequently very important. 

Let's return to the example in Diagram 001 to consider how spatial relationships are an important part of spatial analysis. Think about the type of questions we can answer using the information that we collected about a few of the spatial relationships that exist between the creek and the trail:

\begin{itemize}
\item Which portion of the trail is the most susceptible to erosion from the adjacent creek? (This would be portions of the trail located the closest to segments of the creek. It would also be portions of the trail that are more perpendicular to the alignment of the creek.)
\item How far along the trail would one have to travel to travel � the length of the creek?
\item If we are planning to rehabilitate the land between the creek and the trail by planting new vegetation, how many acres of land will we need to cover? 
\end{itemize}

\section{Conclusion}
\label{sec:XX}
In this article we defined a spatial relationship as ``a description of the one or more ways in which the location or shape of a feature is related to the location of shape of another feature.'' We discussed the three ways you can identify the spatial relationships between two features represented by vector geometries. We can do this [1] by comparing the measurements of one feature's geometry or shape to the geometry or shape of another feature, [2] by considering the measurements ``between'' the locations of the one feature's geometry or shape to the geometry or shape of another feature, and [3] by considering how the geometry or shape of one feature touches, overlaps, contains, or connects to geometry or shape of another feature. We finished the article by considering a brief explanation of why spatial relationships are an important part of spatial analysis and GIS.


% ?
%End of text.

\address{Landon Blake\\
  The SurveyOS Project \& The JUMP Pilot Project\\
  \url{http://openjump.blogspot.com/}\\
  \email{sunburned.surveyor AT gmail.com}}
