This paper provides a new representation for fields (continuous surfaces) in Geographical Information Systems (GIS), based on the notion of spatial functions and their combinations. Following Tomlin’s (1990) Map Algebra, the term “Map Calculus” is used
and, in effect, implements the Lambda Calculus (Dominus, 1999). It is this property that
enabled the use of Perl to imitate the implementation of Map Calculus-enabled GIS. It
must be stated that the prototype uses very simple spatial functions (based on distance)
and allows only three arithmetic operations (addition, subtraction and multiplication)
between pairs of existing layers.
The implementation is based on two scripts, the first runs within Manifold and handles
the GUI, while the second runs outside acting as a server. This client/server architecture
was selected because it enables the installation of the server script on more powerful
machine than that of the client. Furthermore, the server script is more sophisticated and
contains some of the functionality that was mentioned in the previous sections. The
interface is made up of three separate forms, shown in Figure 2. The first interface
(Figure 2a) allows the user to create a new functional layer by selecting a spatial object
(point or pair of points) and selecting one of several basic spatial functions. This
interface is also used to delete a function from the database. The second interface (Figure
2b) allows the user to define map-algebra operations. The “Map Algebra” dialogue area
enables the creation of binary linear combinations of existing layers. Finally, the “display”
interface (Figure 2c) can be used to calculate the raster representation that is relevant to
the area currently displayed in the main window. The following part will demonstrate
some code segments that explain the implementation within the system. Some syntactic
“sugar” is used to make the code more readable.
The process of creating a layer is a simple one – the client sends a message to the server
that contains the layer identification (a name), the type, and a set of parameters that the
server must store in order to recalculate the function. In the case of a distance from a
point function, the stored data structure is defined as:
$new_layer->{layertype} = 1;
$new_layer->{layerid} = $LayerID;
$new_layer->{xcoord} = $x;
$new_layer->{ycoord} = $y;
As we are interested in Euclidean distance the only parameter that is needed is the
location of the point from which the measurement is carried out. A map-algebra layer is
defined by three parameters – the two layers that are used for calculation, and the
mathematical operation: