Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/220387767

Topology in Raster and Vector Representation

Article  in  GeoInformatica · March 2000


DOI: 10.1023/A:1009828425380 · Source: DBLP

CITATIONS READS

56 720

2 authors:

Stephan Winter Andrew U. Frank


University of Melbourne TU Wien
275 PUBLICATIONS   4,587 CITATIONS    312 PUBLICATIONS   6,935 CITATIONS   

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Access to Spatial Data (CRC-SI, 2004-2007) View project

Making human place knowledge digestible by computers View project

All content following this page was uploaded by Andrew U. Frank on 20 April 2016.

The user has requested enhancement of the downloaded file.


GeoInformatica 4:1, 35±65 (2000)
# 2000 Kluwer Academic Publishers. Printed in The Netherlands.

Topology in Raster and Vector Representation


STEPHAN WINTER AND ANDREW U. FRANK
Department of Geoinformation, Technical University Vienna, Gusshausstr. 27±29, 1040 Vienna, Austria,
E-mail: {winter, frank}@geoinfo.tuwien.ac.at

Received January 5, 1999; Revised October 5, 1999; Accepted October 25, 1999

Abstract
Egenhofer's nine-intersection, well-known for vector representations, is de®ned here on a raster, using a hybrid
raster model, and then systematically transformed to yield functions which can be used in a convolution operation
applied to a regular raster representation. Applying functions, the hybrid raster elements need not be stored. It
becomes thus possible to determine the topological relation of two regions, given in raster representation, with the
same reasoning as in vector representations.
This contributes to the merging of raster and vector operations. It demonstrates how the same conceptual
operations can be used for both representations, thus hiding in one more instance the difference between them.

Keywords: vector/raster integration, interoperability, topology, formal speci®cation

1. Introduction

GIS use either a raster or a vector representation for the spatial data [25], [21], [28]. For
years the integration of these two representations in a single GIS has been demanded [8],
[42]. Commercial hybrid GIS have been built, where data can be represented in the one or
the other form. These systems have been constructed by extending a GIS using one
representation with a second set of routines to process the other representation, and they
have the ability to show both representations on a single screen (®gure 1). It has been
pointed out that this is not a full integration, as the different representations are visible to
the user and the set of operations applicable to one or the other is different. Typically
operations other than visualization on the screen to combine data from the two
representations are missing.
The mathematically obvious solution to transform all data to one representation has not
been considered practical, as translation between raster and vector representation leads
always to much increased data sets (or loss of information) and in consequence, much
longer processing time. Nevertheless, transformation still remains necessary in cases
where data sets are involved which are stored in different representations.
By integrated vector and raster GIS we understand a GIS where one single set of
operations can be applied to data represented in either format. The user should not be
aware of the data formatÐat least not at the level of operation selection. In special
situations it may remain necessary to consider error propagation, which may be different
for vector or raster operations, but error propagation must be considered for each data set
separately anyhow [22].
36 WINTER AND FRANK

Figure 1. Raster is often background visualization for vector data (Courtesy of Intergraph (left) and Institute of
Photogrammetry, Bonn (right)).

The construction of operations that can be applied to raster and vector data alike has
been hindered by differences in the interpretation of space that underlies a vector and a
raster representation. Avector representation is based on the general topology of point sets
[1], [27], [14], whereas a raster can be based on a discrete (`digital') topology [40] only.
The difference most prominently features two well-known problems regarding
fundamental geometric properties:

* Jordan's closed curve theorem [1] is not guaranteed for a raster [39].
* Topological relations between regions in a raster representation [19] are not the same
as the universally accepted and cognitively justi®ed Egenhofer relations [16], [18].

We show in this paper a theoretically sound and practically usable method to overcome
these two limitations. With the method proposed here, integrated GIS can be built, where
the same operations with the same properties can be applied to data independent of the
format it is stored in.
The method does not require a new data storage structure for raster representations, but
it is based on a different interpretation of a raster and should work with all types of raster
data, independent of the details of the storage structure (e.g., run length encoding,
quadtrees, etc.); it does not require conversion of existing data. The topologically
completed interpretation of a raster has been proposed several times [31], [45], but was
never seriously considered as it was assumed that it would require much more storage. We
show here that this is not the case; raster images in current formatsÐi.e., with the same
storage space requirementsÐcan be processed with this topologically extended
(completed) interpretation, at the price of somewhat more complex operations, but
which should not extend actual processing time signi®cantly.
The method is developed using a functional programming language and was then
translated to C‡‡ code. Results of processing time are also reported here. They indicate
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 37

that the new method requires about two times more CPU time than regular raster (with its
limited expressiveness), but has the same I/O requirement. Given that I/O typically
dominates GIS operations and CPU speed increases by nearly a factor of 2 per year, this is
not a serious drawback. Examples for the computation of topological relations and line
intersections of raster images are given.
By interpreting a raster representation following these ideas regions are restricted
naturally to regular closed sets [49], and some cases are excluded that are particular to
vector representation, like spikes, or punctuated regions. However, these restrictions do
not exclude practically relevant cases.
The article is a signi®cantly revised and improved version of Functional Extensions of a
Raster Representation for Topological Relations. In: Andrej Vckovski, Kurt E. Brassel,
and Hans-JoÈrg Schek, editors, Interoperating Geographic Information Systems, volume
1580 of Lecture Notes in Computer Science, pages 293±304, Berlin, Springer.ÐThe
complete code for this paper is available at ftp://gi27.geoinfo.tuwien.ac.at/winter.
This article is structured as follows. In Section 2 the topology of vector representations
is contrasted by the topology of raster representations. However, completing raster
representations by an implicit boundary yields identical topological behavior with vector
representations. In Section 3 the completed raster (hybrid raster) is speci®ed, and in
Section 4 it is speci®ed how to determine the topological relations in the hybrid raster. All
the speci®ed code is investigated for optimizations in Section 5. In Section 6 the
speci®cation is tested with synthetical regions. Finally, in Section 7 the translation of the
speci®cation into a standard programming language is discussed. We conclude with an
outlook on future work (Section 8) and a discussion of the results (Section 9).

2. Topology

2.1. Topology for vector and raster representation

Topology for vector representation follows the general topology of point sets in a 2-D
space [1], [27], [14]. Here, open and closed sets can be distinguished, and a metric can be
added. In the Euclidean plane this is the Euclidean distance. The metric is useful to de®ne
the interior …w0 †, the boundary …qw†, and the exterior …wc † of 2-D point sets (regions) w. The
de®nition takes a ball of radius e, e?0: if all points covered by the ball belong (not) to the
set, the center point belongs to the interior (exterior), and if the ball covers interior points
as well as exterior points for all e, then the center point belongs to the boundary.
Boundaries of planar sets form 1-D closed curves (Jordan curves). Adding the Euclidean
distance as a speci®c metric to general topology, re®nes to Euclidean topology.
A raster representation is a 2-D array of elements with integer coordinates. Interpreting
the raster elements as ®eldsÐinstead of lattice points, which is an alternative and
frequently used raster interpretationÐ, the raster is a regular subdivision of space into
squares of equal size, pixels (short form for `picture elements'Ðin contrast to resels
(resolution elements), which are arbitrary subdivisions [44]).ÐFor the general principle it
does not matter how the raster is implemented (see e.g., [41]). But a comparison with
38 WINTER AND FRANK

vector representations directly shows that only (open) 2-D elements exist, and one- and
0-D elements are missing [40], [30]. Boundaries of regions cannot be de®ned by in®nite
balls as in the Euclidean space. Raster representations do not follow general topology.
Regions in raster representation are sets of pixels. The pixels can be classi®ed into those
belonging to the (interior of a) region w and those outside by a location function:

1 if …r; c† [ w
f …r; c† ˆ …1†
0 if …r; c†6 [ w

with ˆ …r; c† 6 [ Z2 . In principle, with the raster representation one changes from an object
view (the where in vector representation) to a location view (the what) [8], [46]. If one is
only interested in location, then it is suf®cient to distinguish space between ``region''
( foreground, 1) and ``no region'' (background, 0). The function needs no concept of
neighborhood. Therefore, open and closed sets cannot be distinguished in a raster
representation.
To overcome the dif®culty to de®ne boundaries in raster so far three different
approaches were applied:

1. omitting boundaries, having only regions as (open) sets (e.g., [37], [7], [5]);
2. de®ning substitutes for a 1-D boundary by selecting speci®c (2-D) raster elements,
depending on a neighborhood de®nition. With regard to these substitutes, Rosenfeld
speaks of digital topology [40], [30];
3. de®ning implicit boundaries. This approach goes back to the so-called crack edges [2],
which are (implicit) boundary edges between two raster cells where both cells belong
to different regions.

The ®rst two approaches deal purely with raster elements. In these cases the difference
between vector and raster topology can be shown prominently in two places which are
important for GIS: the closed curve theorem, and topological relations between
represented entities.ÐThe third approach is (in terms of general topology) incomplete,
because sequences of edges are not connected to curves. Without having curves one cannot
apply the closed curve theorem.

2.2. Closed curve theorem

The closed curve theorem is as follows ([1], p. 2):


Jordan curve: A simple closed curve (i.e., the topological image of a circle) lying in the
plane divides the plane into precisely two regions and forms their common boundary.

Inside the general topology of vector representations the theorem follows from the
de®nition of the boundary, which must be 1-D. In the digital topology of raster
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 39

Figure 2. A singular connected region bound by a multiple connected digital curve.

representations the theorem is not guaranteed [39], [34]. 2-D boundaries cause some well-
known problems [30]. For the discussion we apply the 4-connectedness and the 8-
connectedness for pixels [30].
The most trivial contradiction may be that a 2-D boundary must fall into the interior or
the exterior of a region in terms of general topology. Therefore, one speaks of interior or
exterior boundary [30]. Moreover, an arbitrary shaped region generally is not bound by a
simple closed chain of pixels; ®gure 2 gives an example of a singular connected region that
is bound by a digital curve that is multiple connected (interior boundary in 4-
connectedness).
Famous is also the 4-8-paradoxon caused by such curve de®nitions [30]. In special
con®gurations, a curve given in any connectedness does not divide the plane into two
parts, as the Jordan theorem demands. See ®gure 3. In a 4-connected raster, the
background (white) is not connected, i.e., the background is divided into two parts.
However, the curve is a simple one: it divides foreground from background, but it is not
(4-)connected at the corner where the background is divided. There is no closed curve that
divides the background island from the plane. The problem does not disappear by
exchanging 4- and 8-connectedness: although an 8-connected curve divides at that corner
the background, the background keeps in 8-neighborhood connected. For that reason,
usually one assumes different types of connectedness for foreground and background. But
even then contradictions occur if in another context foreground becomes background and
background becomes foreground.ÐWe conclude that, with regard to the closed curve
theorem, vector and raster representation have a different behavior.

2.3. Topological relations in vector representations

Topological relations are relations that remain invariant under continuous transformations.
From the many possible relations of simple regionsÐa simple region is a singular
connected, regular closed regionÐin a plane, Egenhofer has singled out eight relations
that can be easily identi®ed [10]. They are differentiated by considering the intersection
sets of point sets [14], [15], [13]. Distinguishing the interior, the boundary, and the exterior
of a point set X, two point sets a and b may have nine intersection sets, which form a
40 WINTER AND FRANK

Figure 3. The 4-8-paradoxon of digital curves (see text).

partition of the plane. Topologically characterizing is the state of the intersection set
(being empty, or not), and the size of the intersection sets remains irrelevant. Ordering this
binary information about the nine intersection sets in a 363-arrayÐthe nine-intersection
I9Ðallows to distinguish topological relations by characteristic arrays. With a function m
that maps this binary information to the numbers {0, 1} by

0 if w ˆ ;
m…w† ˆ …2†
1 else

one can write:


0 1
m…a0 \ b0 † m…a0 \ qb† m…a0 \ bc †
B C
I9 ˆ @ m…qa \ b0 † m…qa \ qb† m…qa \ bc † A …3†
c 0 c c c
m…a \ b † m…a \ qb† m…a \ b †

For regular closed and singular connected setsÐsimple regionsÐeven four intersection
sets are suf®cient, because the omitted ®ve intersection sets do not vary. The sets can be
ordered in a 262-array, the four-intersection I4:
 
m…a0 \ b0 † m…a0 \ qb†
I4 ˆ …4†
m…qa \ b0 † m…qa \ qb†

Using this schema, between two simple regions eight relations can be distinguished
(Table 1).
The found relationships were investigated and applied to spatial reasoning [11], [26],
with the interest to de®ne precisely and optimize spatial queries in GIS or in AI. Mark,
Egenhofer et al. have also shown that the relations that can be differentiated by the nine-
intersection are cognitively salient, and they have deduced experimentally a hierarchy of
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 41

Table 1. The eight distinct four-intersections for simple regions, and the names of the characterized topological
relations.
       
0 0 0 0 1 1 1 0
0 0 0 1 1 1 0 1
DISJOINT MEET OVERLAP EQUAL
       
1 1 1 0 1 1 1 0
0 1 1 1 0 0 1 0
COVER COVEREDBY CONTAIN CONTAINEDBY

relations [17], [33]. In their paper they investigated line-region relations, however, we
have no evidence not to generalize the results for region-region-relations. The
observations match with Galton's hierarchization by dominance [24]: in a dynamic
world of continuous motion or deformation, dominant are such relations that hold only for
one moment (®gure 4).

2.4. Topological relations in raster representations

The model of Egenhofer can be applied to regions in raster representation, too. In the
following, two approaches are considered: omitting any boundary, and substituting a
boundary by raster elements. The third approach mentioned in Section 2.1Ðde®ning
implicit boundariesÐis elaborated in detail in the next section.

2.4.1. Relations omitting any boundary. The location function (Eq. 1) distinguishes
two sets, the interior …f …r; c† ˆ 1† and the exterior …f …r; c† ˆ 0† of a region w. The
complement, f c , yields the complement of w, i.e., wc . Then for two regions a and b a set
of four intersection sets can be derived:

…a0 \ b0 †; …a0 \ bc †; …ac \ b0 †; …ac \ bc † …5†

Figure 4. The eight relations between two simple regions a and b can be ordered in a neighborhood graph,
representing saliency or dominance by the direction of the edges.
42 WINTER AND FRANK

This is another subset with four elements out of the nine-intersection (Eq. 3). With
discrete location functions f, characterizing a region a, and g, characterizing a region b,
the emptiness/non-emptiness of these intersection sets (Eq. 2) can be reformulated,
associating true with 1, and false with 0, by:
!
XX
0 0
m…a \ b † ˆ f …r; c† g…r; c† ˆˆ 0
r c
!
XX
0 c c
m…a \ b † ˆ f …r; c† g …r; c† ˆˆ 0
r c

etc.

The special four-intersection of the raster representation is then (cf. Eq. 4):
!
m…a0 \ b0 † m…a0 \ bc †
I4r ˆ …7†
m…ac \ b0 † m…ac \ bc †

With unlimited functions f and g in Z2 on ®nite regions, m22 ˆ m…ac \ bc † is always 1, so


no information is contributed by the fourth intersection set. To evaluate the remaining
three intersection sets it is always suf®cient to limit Z2 to the minimum bounding rectangle
(MBR) containing a and b. The size of the MBR of …a [ b† is given by:

MBR ˆ MBR ……rmin min ; cmin min †; …rmax max ; cmax max ††

with

rmin min ˆ min …rmin …a†; rmin …b††

and so on. The three intersection sets m11 , m12 , and m21 could be combined to 23 ˆ 8
combinations. But with the presumption that neither a nor b may be empty sets, the
intersection sets are dependent from each other: with a ˆ …a0 \ b0 † [ …a0 \ bc † and
b ˆ …a0 \ b0 † [ …ac \ b0 †, at least one term in each union must be not empty. Then no
pair of …m11 ; m12 † and …m11 ; m21 † can be (0, 0). That dependency excludes three of eight
possible combinations of I9r . The remaining ®ve four-intersections correspond to the
separable topological relations in Table 2. The meaning of the relation names are now:

Table 2. The ®ve distinct four-intersections for simple raster regions, and the names of the characterized
topological relations.
         
0 1 1 1 1 0 1 1 1 0
1 1 1 1 0 1 0 1 1 1
DISJOINT / MEET OVERLAP EQUAL CONTAINS / COVERS CONTAINEDBY / COVEREDBY
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 43

* DISJOINT / MEET: a and b have no part in common;


* OVERLAP: a and b have parts in common and parts not in common;
* EQUAL: all parts of a are parts of b and vice versa;
* CONTAINS / COVERS: all parts of b are part of a, and a has additional parts;
* CONTAINEDBY / COVEREDBY: all parts of a are part of b; and b has additional parts.

The classi®cation here works also for complex regions, i.e., multiple connected regions, or
regions with many components [20]. Merging some of the relations from vector
representations, cognitive salient relations can no longer be distinguished.
The topological relations derived here represent only a subset of the Egenhofer relations
for simple regions in the Euclidean plane in table 1. Properly speaking, some of his
relations are fused here to more general ones; the relation names do not correspond
exactly. Consequently, ®gure 5 is a generalization of his conceptual neighborhood graph
(®gure 4). This graph is also derived by a formal logic approach in the region connection
calculus (RCC-5) [7].
We conclude that the raster representation without a concept of a boundary cannot
express topological relations with the granularity of the vector representation. This is
particularly limiting because the salient or dominant relations are lost, as indicated by the
undirected edges in ®gure 5.

2.4.2. Relations with boundary substitutes. Using raster elements for boundary
representations generates 2-D boundaries, consisting of pixel chains. In this case, one has
to choose between 4- and 8-neighborhood for the pixel chain, and between the interior or
the exterior boundary (pixels inside of the region that neighbor to exterior pixels, or pixels
outside of the region that neighbor to interior pixels) [30]. These de®nitions determine the
result of intersecting the sets of interior, boundary and exterior raster elements, which is
counter-intuitive because the selection is arbitrary. Even worse is the possibility for simple
regions to form other than the eight four-intersections characterized in table 1 [19]. For
example, now it can happen that the boundary of a intersects the interior of b, but the two
interiors do not intersect (®gure 6). These additional four-intersections have no common-

Figure 5. The topological relations between two regions in raster representation, related by conceptual
neighborhood.
44 WINTER AND FRANK

Figure 6. Pixels substituting a boundary cause intersections that cannot appear in vector representations.

sense meaning; they appear as variations of the eight presented intersections and need
special care.

3. The hybrid raster representation

It has been proposed to complete the raster with edges and nodes to become a regular cell
complex [31], [45]. The only specialty of this cell complex compared to arbitrary cell
complexes in the Euclidean plane is its regular structure (®gure 7).
In topology, all elements of a cell complex (2-D-, 1-D-, 0-D-elements) are called cells,
but we will speak in the following of 2-D cellsÐidentical with the pixels in rasterÐ, 1-D
edges and 0-D nodes. The union of edges and nodes will be called the skeleton of the cells.
In this hybrid raster representation, topological relations relate again to general
topology in Euclidean space, and the four- or nine-intersection can be applied in full
accordance to vector representations [45]. In vector representations these tests are
expensive, requiring polygon intersection. In a hybrid raster representation the tests are
simple to evaluate:

* the two regions are represented in two hybrid rasters (of the same resolution, same
size, and common origin), with cells, edges and nodes labeled by three values for
interior, boundary and exterior;

Figure 7. A (regular shaped) cell complex, replacing a raster element of usual raster representations in the
hybrid raster: each cell is closed by four edges and four nodes.
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 45

* the two rasters are overlaid (an6-operator is equivalent to \ in set denotation);


* the nine possible combinations can be accumulated in a 363-matrix; afterwards the
accumulation can be binarized ( ˆ 0, > 0).

In a more sophisticated algorithm one would consider the dimension of the intersection
sets, and reduce the overlay to the cells of the relevant dimension [16], [35]. For example,
the set a0 \ b0 is 2-D (or empty): it is suf®cient to overlay the cells for that position of
the nine-intersection. In contrast, the set qa \ qb is 1- or 0-D (or empty); in a cell
complex an intersection of edges requires an intersection of nodes at the same time, so this
position of the nine-intersection is treated suf®ciently by overlaying the nodes only.
Winter presented also a data structure to store and access the cells and their skeleton
[45]. A raster of size n6m requires in the hybrid form additionally …n ‡ 1†  m horizontal
edges, n  …m ‡ 1† vertical edges, and …n ‡ 1†  …m ‡ 1† nodes. The required storage space
for a hybrid raster would be four times as large as for a regular raster, and processing
timesÐwhich are for most operations linear in the size of the storageÐwould be as much
longer as well. Therefore, this solution was never really practically considered. A quadtree
structure would be applicable [3]. However, we will show that it is not necessary to store
the full hybrid raster.

Figure 8. Highlighted are all elements with the index (i, j): the cell cij , the horizontal edge hij , the vertical edge
vij , and the node nij .
46 WINTER AND FRANK

3.1. Identifying the hybrid raster elements

Before specifying rules, a schema for identifying each single element in a hybrid raster is
required. We de®ne here the following indexing schema (®gure 8):

Cell index: Cells are identi®ed by two indexes, like ordinary pixels.
Vertical edge index: Vertical edges are identi®ed with the same indexes as the cell to
their left.
Horizontal edge index: Horizontal edges are identi®ed with the same indexes as the
cell above.
Node index: Nodes are identi®ed with the same index as the cell left above.

With ®gure 8 at hand it is easy to see that this indexing schema is indeed complete: it gives
for each element of the hybrid representation a unique index, with the exception of the
edges and nodes at the left and upper border of any ®nite subset of the Euclidean plane. For
that reason it is presumed that the subsets containing regions are chosen with a border of at
least one pixel width around the represented region. (In consequence, the intersection set
ac \ bc is by de®nition never empty.)
The rules are independent from the orientation of the coordinate system. To hide the
reference to any coordinate system further, we additionally introduce names for the eight
neighbored cells of cij , using the cardinal directions N, NE, E, SE, S, SW, W, and NW
(®gure 9). Only at this stage the reference must be made explicit. For example, in a
conventional (row, column)-system as used in image processing the cells are found by the

Figure 9. The names of pixels/cells in a 363-window at cell cij .


TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 47

following functions:
c0 ˆ ci; j
cN ˆ ciÿ1; j
cNE ˆ ciÿ1; j‡1
cE ˆ ci; j‡1
cSE ˆ ci‡1; j‡1
cS ˆ ci‡1; j
cSW ˆ ci‡1; jÿ1
cW ˆ ci; jÿ1
cNW ˆ ciÿ1; jÿ1 …8†

3.2. Topologically completed raster interpretation

Each (connected) set of pixels in a raster represents a region; therefore, the hybrid raster as
a topological completion of raster representations only represents regions, too. The
additional elements of the hybrid raster are totally redundant to the cells. The skeleton can
be excluded from explicit storage, applying rules instead, which represent the local
dependency and can be computed on the ¯y. This idea is investigated here in natural
language as well as formally, and later a functional approach is used to specify and test the
rules and their application.
Assume an arbitrary region in a regular raster, given as the set of pixels with value `In',
and the background pixels have the value `Out'. These two values are mapped to the
Boolean values true and false, to allow the regular logical operations. Without loss of
generality let us con®ne ourselves to singular connected regions, for the simple advantage
having to deal with the four-intersection only (Eq. 4). Let us further denote raster elements,
pixels, by p, and hybrid 2-D cells by c, to distinguish the actual interpretation.
Cells: Cell labels are identical to pixel labels:

`interior' if p0 [ w0
c0 ˆ
`exterior' if p06 [ w0
In binary images the case c0 ˆ `boundary' never occurs.
Vertical edges: A vertical edge belongs to the interior of the region if the adjacent left
and right cells are labeled as `In'. It belongs to the exterior of the region if the adjacent
left and right cells are labeled as `Out'. It belongs to the right boundary if the adjacent
left cell is `In' and the right cell is `Out', otherwise it belongs to the left boundary
(®gure 10).
8
< `interior'
> if …p0 [ w0 †6…pE [ w0 †
v0 ˆ `exterior' if …p06 [ w0 †6…pE6 [ w0 †
>
:
`boundary' else
48 WINTER AND FRANK

(a) (b) (c) (d)

Figure 10. Classi®cation of edges by the two adjacent cells are bright cells outside of the region, dark cells are
elements of the region). An edge belongs (a) to the exterior or (b) to the interior if both raster elements are
homogeneous; it belongs to the boundary if the values of the raster elements are different ((c), (d)).

Horizontal edges: A horizontal edge belongs to the interior of the region if the adjacent
upper and lower cells are labeled as `In'. It belongs to the exterior of the region if the
adjacent upper and lower cells are labeled as `Out'. It belongs to the lower boundary if
the adjacent upper cell is `In' and the lower cell is `Out', otherwise it belongs to the
upper boundary.

8
< `interior'
> if …p0 [ w0 †6…pS [ w0 †
h0 ˆ `exterior' if …p0 6 [ w0 †6…pS 6 [ w0 †
>
:
`boundary' else

Nodes: A node belongs to the interior of the region if all four adjacent cells are labeled
as `In'. It belongs to the exterior of the region if all four adjacent cells are labeled as
`Out'. Otherwise the node belongs to the boundary (®gure 11).

8
< `interior'
> if …p0 [ w0 †6…pE [ w0 †6…pSE [ w0 †6…pS [ w0 †
n0 ˆ `exterior' if …p0 6 [ w0 †6…pE 6 [ w0 †6…pSE 6 [ w0 †6…pS 6 [ w0 †
>
:
`boundary' else

(a) (b) (c) (d)

Figure 11. Classi®cation of nodes by the four adjacent raster elements (bright pixels are outside of the region,
dark circles are elements of the region). A node belongs to the exterior if all pixels are outside (a), to the interior
if all pixels are elements of the region (b), and to the boundary if the four pixels are not homogenous; the given
example ((c), (d)) are not complete.
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 49

In the de®nitions above, for each cell the actual pixel (with regard to the indexing of Eq.
8), the pixel to the right, the lower pixel, and the lower right pixel are used. We subsume
these four pixels in a 262-window. Obviously, a ¯oating lower right 262-window is
suf®cient to determine the labels of all pixels and skeleton elements. This window is
marked for c0 in ®gure 9.

3.3. Functional speci®cation of the hybrid raster

The rules of the previous section are now transformed into a formal model that can be
tested. The model is speci®ed in the functional programming language Haskell [29], [36],
[43], [4]. Although Haskell provides a library for arrays, we avoid its usage for clarity
reasons. Instead, we prefer a representation by a list of lists. The names introduced above
are used again.

data BinPixel ˆ In j Out


type Image ˆ ‰‰BinPixelŠŠ

Considering the 262-window at c0 , a data type labeled `lower right 262' (LR22) is
introduced. This type LR22 is a collection of four pixel values ( for any image type).
Additionally, a class ConvKernel provides four functions to access the actual value of
each window pixel. In this case the image type is ®xed to BinPixel, i.e., it is a binary
image with the boolean pixel values In and Out. For that reason, LR22s is instantiated
by BinPixel. Each access function in this instantiation returns true if the corresponding
pixel is in the region.

data LR22s a ˆ LR22 a a a a


class ConvKernel l where
p0, pEast, pSouth, pSouthEast :: l ? Bool
instance ConvKernel (LR22s BinPixel) where
p0 (LR22 c1 c2 c3 c4) ˆ c1 ˆˆ In
pEast (LR22 c1 c2 c3 c4) ˆ c2 ˆˆ In
pSouth (LR22 c1 c2 c3 c4) ˆ c3 ˆˆ In
pSouthEast (LR22 c1 c2 c3 c4) ˆ c4 ˆˆ In

With access to these pixels, one can apply the rules labeling the hybrid cells at (i, j).
Generally, we need a class Pixels that provides labeling functions for each type of cells.
The class will be abstract, to allow to derive instances for different image types or
convolution windows.
50 WINTER AND FRANK

class Cells l where


cInterior, cExterior, cBoundary,
vInterior, vExterior, vBoundary,
hInterior, hExterior, hBoundary,
nInterior, nExterior, nBoundary :: l ? Bool

Instantiating that class for the binary image type, the required functions can be
implemented, using the rules given above. Herein, the operator &&&& is the logical and
(6) for functions of Boolean type:

…&&&&† :: (a ? Bool) ? (a? Bool) ? a? Bool


…f &&&& g† x ˆ …f x†&&…g x†
instance Pixels (LR22 BinPixel) where
cInterior ˆ p0
cExterior ˆ not.cInterior
cBoundary ˆ False
vInterior ˆ p0 &&&& pEast
vExterior ˆ (not.p0) &&&& (not.pEast)
vBoundary ˆ (not.vInterior) &&&& (not.vExterior)
hInterior ˆ p0 &&&& pSouth
hExterior ˆ (not.p0) &&&& (not.pSouth)
hBoundary ˆ (not.hInterior)&&&& (not.hExterior)
nInterior ˆ p0 &&&& (pEast &&&& (pSouth &&&& pSouthEast))
nExterior ˆ (not.p0) &&&& ((not.pEast) &&&&
((not.pSouth) &&&&(not.pSouthEast)))
nBoundary ˆ (not.nInterior) &&&& (not.nExterior)

Note that this speci®cation could be written nearly identical to the mathematical rules
de®ned above. The result of each function con®rms or falsi®es the rule name; e.g., if
vBoundary returns true then the vertical edge v0 belongs to the boundary. The pixel p0
cannot belong to the boundary for dimensionality reasons; for that reason a function
cBoundary could be omitted. That means, while the cells are binary (In or Out), the
skeleton elements are ternary. We de®ne a data type for the three topological sets:

data TopSet ˆ I j B j E

With the functions speci®ed in this section, the elements of a hybrid raster can be derived
from a raster on demand at any raster position. That ability allows the construction of the
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 51

hybrid raster on the ¯y during the overlay of two raster images. No data type needs to be
speci®ed for storing the results of the functions.

4. Computation of topological relations in the hybrid raster

The computation of the topological relations is based on the four- or nine-intersection. For
two hybrid raster images A and B (of the same resolution, the same orientation, and the
same origin), only cells intersect with cells, only edges intersect with edges, and only
nodes intersect with nodes. That is a consequence of the regular decomposition of the
plane, and exceeds the usual properties of vector representations. Taking advantage from
these properties, the four intersection sets of Equation 4 can be calculated locally at each
position (i, j), and then accumulated by convoluting the two images.ÐExtension of such a
procedure to the nine-intersection is straight forward.
Required is a class IIntersect that provides the methods to evaluate the four- or the
nine-intersection:

class IIntersect i where


fourIntersect :: i ? i ? IArray
nineIntersect :: i ? i ? IArray
evalIntersect :: [(TopSet,TopSet)] ? i ? i ? IArray

Herein, IArray is a data type representing the array of four or nine booleans for
intersection sets (Eqs. 4, 9):

data IArray ˆ IArray [Bool]

The length of lists of this type is determined when values of this type are instantiated.
For four intersection sets four elements will be created, and for nine intersection sets nine
elements will be created. So one can use the same data type for both calculations, the four-
and the nine-intersection. The order of the list elements will be related to the order of
intersection sets (see below).
Now for the class IIntersect two instances can be de®ned, one for lower right
windows as arguments, to determine the relation between single pixels, and one for
complete images as arguments, to determine the relation between regions.

4.1. Topological relations between pixels

For each pair of homologous positions (i, j) in two images, one can extract the
corresponding lower right windows p1 ( from one image) and p2 ( from the other image).
The interest is to evaluate the Boolean status of the four or nine intersection sets at this
52 WINTER AND FRANK

position. The intersection sets are described by combining the considered topological sets
TopSet into a list of pairs iSets:

intersectVals :: [TopSet] ? [(TopSet,TopSet)]


intersectVals iSets ˆ [(x,y) j x / iSets, y / iSets]

With [I,B] one ®nds [(I,I),(I,B),(B,I),(B,B)], and with [I,B,E] the


respective list of nine pairs. The four (or nine) values corresponding to these intersection
sets can be computed by instantiating the class IIntersect with a lower right window,
providing a local function evalIntersect:

instance IIntersect (LR22s BinPixel) where


evalIntersect iSets p1 p2 ˆ IArray (map (xi p1 p2) iSets)
where
xi :: (LR22s BinPixel) ? (LR22s BinPixel) ?
(TopSet,TopSet) ? Bool
xi p1 p2 (a,b) ˆ xIntersect a b p1 p2

It remains to specify a function xIntersect that overlays two windows using the
construction rules for all types of hybrid cells. Those rules were methods in a class Cells;
that recommends to put the new function into the class, too:

xIntersect :: TopSet ? TopSet ? l ? l ? Bool


xIntersect I I a b ˆ (cInterior a && cInterior b) k
(hInterior a && hInterior b) k
(vInterior a && vInterior b) k
(nInterior a &&nInterior b)
xIntersect I B a b ˆ (cInterior a && cBoundary b) k
(hInterior a && hBoundary b) k
(vInterior a && vBoundary b) k
(nInterior a && nBoundary b)
xIntersect B I a b ˆ (cBoundary a && cInterior b) k
(hBoundary a && hInterior b) k
(vBoundary a && vInterior b) k
(nBoundary a && nInterior b)
xIntersect B B a b ˆ (cBoundary a && cBoundary b) k
(hBoundary a && hBoundary b) k
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 53

(vBoundary a && vBoundary b) k


(nBoundary a && nBoundary b)

The rules are self-evident (but to a certain degree redundant; see the optimization in
Section 5). The logical `&&' refers to the ` \ ' in set denotation. An intersection set is not
empty if any homologous pair of the hybrid cells (cell, horizontal or vertical edge, or node)
match in their topological properties. The resulting four Booleans are stored in a data type
IArray.

4.2. Topological relations between regions

To compute the topological relations between regions, the relations between any two
homologous positions are computed and then combined with or. For that reason the class
IIntersect is instantiated now for images:

instance IIntersect Image where


fourIntersect a b ˆ evalIntersect (intersectVals) [I,B]) a b
evalIntersect iSets a b ˆ
or' (concat (convLR22 ei (zipzip pair a b)))
where
ei :: LR22s (BinPixel, BinPixel) ? IArray
ei (LR22 (a,b) (c,d) (e,f) (g,h)) ˆ
evalIntersect iSets (LR22 a c e g) (LR22 b d f h)

The evaluation is speci®ed with a higher order function which executes a convolution
throughout the images. The convolution window is the lower right window of four pixels
(®gure 9) from two images at the same time. To keep a general convolution function, with
exactly one window as argument, the two windows are zipped to one window of value
pairs. The convolution function applied is the above given local method
evalIntersect. Overloading allows to use the same method name again for the
global operation. The function convLR22 is realized as a recursion through the two lists
of lists. It appends, where required, `Out' elements to the given lists, as well as `Out' lists
outside of the lists. This is necessary in our case to perform the convolution also at the right
and the bottom border of the images. It only states that outside of the regions is exterior
(`Out'). The convolution yields a list of local iArray's. Connecting them by or' (a
modi®ed or for Boolean lists) yields the overall four- or nine-intersection in form of a
iArray.
If a more comprehensive output is desired, the array should be translated into natural
language:

data TopRel ˆ DJ j ME j OL j CV j CVB j CT j CTB j EQ j UNK


54 WINTER AND FRANK

de®nes an enumeration type of all possible results, including UNK for intersection arrays
with an unknown interpretation. Then an assignment of intersection arrays and the result
types is necessary:

assignTR :: IArray ? TopRel


assignTR iarray
j iarray ˆˆ (IArray [False, False, False, False]) ˆ DJ
j iarray ˆˆ (IArray [False, False, False, True ]) ˆ ME


which can ®nally translated into common English:

showTR :: TopRel ? String


showTR t
j t ˆˆ DJ ˆ ``A is disjoint from B00
j t ˆˆ ME ˆ ``A meets B00


With all this, a higher order function tr that evaluates a topological relation between two
regions, in form of two binary images i1 and i2, looks like:

tr :: Image ? Image ? String


tr i1 i2 ˆ showTR (assignTR (fourIntersect i1 i2))

5. Optimization of the speci®ed computation

The code given above speci®es the problem correctly, but is not ef®cient. In a next step it
can be optimized. In functional languages, optimization can be easily performed, but it is
not even necessary. Languages like Haskell are lazy; they evaluate functions only when
needed, and, if possible, only as far as needed. While the lazy evaluation optimizes Haskell
code automatically, only explicit optimization will be transferred with translation to
standard programming languages.

5.1. Optimization of the local computation of the four-intersection

The computation of the four-intersection at each position was de®ned by testing each pair
of homologous cells: the (2-)cells, the horizontal and vertical edges and the nodes at (i,j).
Optimization can take advantage from the redundancy between the cells. Here the detailed
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 55

four-intersection [12] plays a role: the intersection sets must be of de®nite dimensions if
they are not empty. These dimensions are, in the order of Equation 3:
0 1
f;; 2g f;; 1g f;; 2g
B C
dim …I9† ˆ @ f;; 1g f;; 0; 1g f;; 1g A …9†
f;; 2g f;; 1g f;; 2g

If, for example, the intersection set a0 \ b0 must be 2-D (or empty), then it is suf®cient to
look at the 2-D cells for the existence of an intersection set. Continuing this argumentation,
for the complete four-intersection the following conditions are suf®cient to observe:

xIntersect :: TopSet ? TopSet ? l ? l ? Bool


xIntersect I I a b ˆ (cInterior a && cInterior b)
xIntersect I B a b ˆ (hInterior a && hBoundary b) k
(vInterior a && vBoundary b)
xIntersect B I a b ˆ (hBoundary a && hInterior b) k
(vBoundary a && vInterior b)
xIntersect B B a b ˆ (nBoundary a && nBoundary b)

The last condition holds because a 1-D boundary intersection implies that the boundaries
intersect also 0-dimensionally, which follows from the topological structure of cell
complexes.
This optimization of code reduces the redundancy between the hybrid cells to the
minimum. From originally 16 Boolean test only six tests remained (38%). One would
expect that the required number of reductions for the optimized code would decrease
proportionally. But a test of the optimized code showed that still 66% of the reductions are
needed, and 84% of the memory. That con®rms the effectiveness of Haskell's laziness:
Haskell does recognize and eliminate automatically a major part of the redundant Boolean
evaluations in the non-optimized code. Nevertheless, performing optimization explicitly
has some advantages. One reason is that the language permits to test the optimization
whether the simpli®ed code has the same behavior as the non-optimized one. Another
reason is that translation to standard programming languages pro®ts from having
simpli®ed speci®cations, because these languages do not provide a concept of lazy
evaluation.
The function xIntersect could be optimized further. The conditions are complex
Boolean expressions with 264 Boolean values as inputs: the two windows. In each
condition the Boolean functions can be replaced by their original de®nitions. Then they
can be simpli®ed using standard rules for the simpli®cation of Boolean expressions.
Carrying out showed that the code will be nearly unreadable for their numerous nested
expressions, and the savings in reductions are comparably small, for the same reasons as
above. We do not present that code here, because this optimization does not preserve the
56 WINTER AND FRANK

clear semantics we had up to now (and which is our ®rst interest here). One should rely on
the optimization methods used by the compiler and pass the code as given above for
compilation.

5.2. Optimization of the global computation of the four-intersection

The most interesting optimization here is the simpli®cation of the or-expression,


evaluating (in our context: usually long) lists. Using the observation that the occurrence of
the ®rst Boolean value `true' determines the result of the whole expression to `true' means
that one can stop evaluation after any found `true': True V any-value ˆ True ( for a
left-bindingV). One would write this in Haskell like:

class Compare p where


…~ k† :: p ? p ? Bool
instance Compare BinPixel where
In~k ˆ True
~k In ˆ True
~k ˆ False

which means that the undetermined expressions no longer need to be evaluated. A


compiler may automatically use such abbreviations and no special code is necessary; also
standard programming language compilers optimize here (short circuit evaluation).
Once optimization is done (and tested), the code can be translated into standard
programming languages, like Pascal, C ‡‡ , or Java.

6. Test of the speci®cation

In contrast to other object-oriented modeling languages, like, e.g., UML [38], Haskell can
be compiled or even used in an interpreter environment. One can run the written code
immediately with test cases. That is done here for several different synthetic cases to show
that the speci®cation ful®lls the discussed properties.

6.1. Test with synthetic situations

Consider the two simple regions of ®gure 12. Formulating the query:

? tr imgA imgB

yields the result: A meets B, or, in terms of the intersection array of Equation 4 (in linear
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 57

Figure 12. The regions A (in the left raster image) and B (in the right raster image) meet along on implicit 1-D
common boundary.

order): [False, False, False, True]. That means the only intersection set that is
not empty is the intersection between the two (1-D!) boundaries. The topological relation
between the regions a and b must be MEET therefore.
Such tests were made for all situations characterized in ®gure 4, applying the four-
intersection to synthetical images. We could observe no contradiction to the set of de®ned
results in table 1. The same procedure was applied to more general situations, with
multiple connected or disconnected regions. Of course the expressiveness of the four-
intersection is poor in these cases, but no contradiction to the model occurred. Using the
nine-intersection (Eq. 3) instead should capture these situations well. The nine-
intersection can be speci®ed naturally by:

instance IIntersect Image where


nineIntersect a b ˆ evalIntersect (intersectVals [I,B,E]) a b

Again, we detected no contradictions to the expected results [13].


Additionally, we tested the behavior of the speci®cation for regions on image borders.
That concerns especially the work of convLR22 that should handle these situations by
adding a band of `Out' cells beyond each image border. Also in these cases no
contradictions occurred.
So far, the advantage of a functional speci®cation is two-fold: ®rstly, we understand the
model description and reach consensus about the model; secondly, we can prove the
speci®cation for any given situation (but not in general).

6.2. Comparison of raster and hybrid execution

We performed also an evaluation of the costs of evaluating topological relationships in the


hybrid model compared to simple raster. From Equation 7 we derived that the simple raster
is limited in its expressiveness to ®ve families of topological relations (®gure 5). So one
58 WINTER AND FRANK

cannot expect the same results from simple raster as from hybrid raster. However, the only
interest here is how many resources are required to solve Equation 7 in comparison to
Equation 4, or: how costly is the introduction of additional hybrid cells. The test can be
made easily by replacing the investigated sets [I,B] in the four-intersection by [I,E]:

instance IIntersect Image where


fourIntersect a b ˆ evalIntersect (intersectVals [I,E]) a b

Note that the rules applied now are simpler than the rules for the hybrid skeleton; they
represent simply an overlay:


xIntersect I E a b ˆ (cInterior a && cExterior b)
xIntersect E I a b ˆ (cExterior a && cInterior b)
xIntersect E E a b ˆ (cExterior a && cExterior b)

Additionally one has to exchange the interpretation of the resulting four-intersection


according to table 2 instead of the interpretation given above which follows table 1.
Some test runs showed that about 60% of the evaluations and 88% of the storage space
of the hybrid raster execution are required. In other words: the additional effort to handle a
raster in a hybrid interpretation is relatively small; as demonstrated, the increase of the
numbers of cells by a factor of 4 increases the costs by a factor smaller than 2. Any
optimization for the hybrid speci®cation would affect also the execution of the function
fourIntersect with the modi®ed parameters, because the same functions are called in
both cases. So one can expect that the given ratios remain constant (in magnitude) also in
optimized Haskell code versions.

7. Coding in standard programming languages

The developed system can be translated to code in any standard programming language.
That is reasonable now for the ®rst time, after specifying and testing the design, and it may
be required if one is interested to add the hybrid representation into existing programs.
Nevertheless, also the Haskell code can be compiled to ef®cient executables (see, e.g.,
www.haskell.org/practice.html).
With the procedure carried out in this paper, programming is decomposed into two
steps:

1. The ®rst step consists of constructing and describing a model. Functional languages
like Haskell are an adequate tool to do that, because they are near to the mathematical
formulation, as demonstrated above several times. They can be read like mathematical
functions, and therefore they are suited to communicate the model. In contrast,
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 59

standard languages like C‡‡ do not have this capabilityÐthe model of a C‡‡ -
program is in the mind of its creator, but not in the code. Only this ®rst step requires an
expert.
2. The second step is the translation between languages. No further modeling is
necessary, and therefore this task does not require a domain expert. Instead, it is work
for a program language expert who is better at this task.

Both steps are not easy, and to perform this process may not even be ef®cient (i.e., it is
not necessarily faster than programming directly in a standard language). But we see an
important advantage in the explicit model that is readable, testable, that can be
communicated, re-used, improved, completed, adapted, and so on, without all the
disadvantages of a growing complexity of an algorithmic code. Our model in Haskell takes
little more than two A4 pages.
We translated the Haskell speci®cation into C‡‡ . We have found that the effort
necessary to develop the functional working prototype (and its testing) was indeed
recovered in the coding in C‡‡ . We estimate that it took us one week to write the
functional speci®cation, and two days to translate it into C‡‡ . For several reasons one
will change some speci®ed concepts during translation, mostly because of the conceptual
difference between a functional language and an algorithmic language. The former is
based on lists and recursion, while the latter commonly deals with arrays and loops.
Adapting the speci®cation is in principle no problem, but then the translator has to
guarantee that his code complies with the speci®ed behavior. That means that the tests of
the speci®cation must be considered as part of the speci®cation: they de®ne the behavior
that the translated code must follow.

8. Future work

8.1. Hybrid quadtrees

We expect that the hybrid representation can be transferred to any hierarchical, tree-like
data structures for raster images. There is already some work done in ®nding (1-D)
boundaries of regions in quadtrees [9], [23], however, they have not the strong topological
model of cell complexes in mind. It turns out that the only additional dif®culty of the
transfer is the missing regular skeleton structure in trees. In trees one has to consider more
carefully where to set the nodes: tree cells that are neighbored to smaller cells need a
skeleton of more than four nodes and four edges. However, creating the hybrid skeleton of
a tree represents a generalization from the skeleton of the hybrid raster, performing simply
graph contraction. This generalization follows similar considerations than the construction
of the tree itself.

8.2. Lines and points in a hybrid raster

A regular raster is interpretedÐas described aboveÐas a topologically completed set of 2-


60 WINTER AND FRANK

D cells. Reverting the rules above, a raster image can also be interpreted as a set of points,
representing the hybrid nodes, or even lines, representing the hybrid edges (®gure 13,
center and right). It could be necessary, therefore, to pre®x a raster with the intended
dimension of the ®gures represented.
In ®gure 13 both types of edges are stored in one matrix. The idea looks elegant,
however, access demands extensive index calculations. An alternative could be to store
horizontal and vertical edges separately, with the advantage of keeping the original
indexes.
We leave open the reformulation of the rules for lines and points. But with this
extension, for example, the intersection of two lines can be computed in regular raster, and
the result will be a point or a line. The closed curve theorem will be respected. Topological
relations can be determined for lines and points, too, with the same schema as in vector
representations, as shown in the following for regions in detail. More complex, but also
possible, should be the determination of the relation between regions and lines, given two
raster of different intended dimensions.
Another requirement could be to represent curves by directed lines. That could be
realized by a natural orientation of edges, de®ned from the node with lower index to the
node with higher index. Then only a binary attribute for the sign is needed to store the
actual orientation.

8.3. Other operations

Having presented the hybrid representation mostly for reasons of determining topological
relations, one could ask whether the representation is also suited for other spatial
operations in GIS.
Providing general topology to raster, the hybrid representation is promising in all kinds
of image processing. Feature detection and extraction could be easily modi®ed for hybrid
representations, allowing to work with closed features, common boundaries between
features, 1-D linear features, and so on. To our knowledge this idea is not applied (except

Figure 13. A regular raster can represent hybrid 2D-cells (left), hybrid 1-D cells (center, rotated by 45
degrees), or hybrid 0-D cells (right).
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 61

with [32]). It needs a deep analysis of the consequences for all existing image processing
methods.
With the same topological properties as vector representations, we see no principal
differences between vector and hybrid methods. Differences in results will be caused by
resolution only. But no further advantage of a hybrid representation is expected.

8.4. Mixed pixels and egg-yolk regions

Our understanding of the raster has been up to here a binary one, distinguishing pixels
belonging to a region from pixels which do not (Eq. 1). But a lot of application areas have
to deal with uncertainty in location or classi®cation, as, e.g., remote sensing and image
processing. If a sensor pixel covers a non-homogeneous ®eld in the observed world, the
resulting signal will be a mixture of the responses for each single object. Thus, if a sensor
element covers a ®eld divided by a boundary between two regions, a so-called mixed pixel
is registered, which cannot be classi®ed clearly to the interior or the exterior of one of the
regions. The binary location function fails, and another model is required, either a multi-
value function or a continuous function.
A minimal representation for this kind of uncertainty would be a vague region concept,
differentiating an area which belongs certainly to the interior of a region …w0 †, an area
which is certainly outside …wc †, and the area in between, called `Maybe' or `Partly' …w †.
The interior is always a proper part of w ; for that reason the concept is also called egg-yolk
model [7], [48]. Conceptually, this is not different to the situation in ®gures 2 or 6, where
regions with 2-D boundaries are shown [6]. However, if we apply the regular hybrid
structure also to vague regions, there is a signi®cant difference at the semantical level: then
a region has two (1-D) boundaries, one is separating w0 and w , and one is separating w and
wc . Dealing with two areas per region, one has to apply Egenhofer's four- or nine-
intersection separately for each combination. The results will have a richer semantic, too:
for example, an overlay of the two certain interiors will have a stronger meaning than an
overlay of two `Maybe' areas (mixtures are also possible).
This extension is elaborated elsewhere [47]. For more than three values it should work
similarly. However, for continuous location functions the extension to cell complexes
seems to be a misinterpretation. A raster with continuous values represents a ®eld view of
space, and not an entity view [8].

9. Conclusions

With this extension of the widely used Egenhofer topological relations to raster images we
have solved an important part of the long time standing problem of different topological
relations for raster and vector data in a GIS and the dif®culties for line intersection in raster
representations. It can be achieved using the conceptual transformation of the raster
representation into the hybrid raster. This seems not practical, but a careful examination
shows that no explicit representation for the hybrid raster representation must be
62 WINTER AND FRANK

constructed, and the necessary parts can be computed on the ¯y from a regular raster
representation.
The approach to specify in a functional language yields a semantically clear piece of
code that can be run with test application to demonstrate the correctness in the investigated
test cases. The systematic development and the application of standard methods of
program simpli®cation and optimization leads from a conceptually simple and correct
formalization to ef®cient operations, which can be coded in various languages. For
example, a translation into C‡‡ took only few hours including testing. Differences
between Haskell speci®cation and C‡‡ implementation concern the conceptual change
to an algorithmic language, and some adaptations to speci®c ef®ciency properties for the
target language. It is interesting to compare the codes.
In this paper effects are not investigated that originate in resolution of vector-raster
conversion. We do not claim that an operation on a pair of vector regions results in the
same topological relation that applied on the rastered regions. Instead we claim in this
paper that the behavior of vector and raster representation can be assimilated, by extending
the raster with its skeleton. So far, the paper contributes to the merging of raster and vector
operations. With the use of the same conceptual operations in both representations, the
difference between both can be hidden in one more instance. The user has to consider the
format only with respect to error propagation (but this he has to do in a non-integrated
vector or raster GIS as well).
It is to expect that in principle the ideas are applicable to quadtrees, too. But one has to
take care of neighbored quadtree leaves of different size. The construction of that skeleton
is open to formalization. Furthermore, translation of the given speci®cations into standard
programming languages is open for further elaboration. Only then evidence can be given
for time consumption of the algorithms. We expect that the requirements are acceptable,
because the complexity of the problem is O…n  m† with the number n  m of raster
elements.

References

1. P. Alexandroff. Elementary Concepts of Topology. Dover Publications, New York, USA, 1961.
2. D.H. Ballard and C.M. Brown. Computer Vision. Prentice Hall, Englewood Cliffs, NJ, 1982.
3. H. Bieri and I. Metz. ``A Bintree Representation of Generalized Binary Digital Images,'' in U. Eckhardt,
A. HuÈbler, W. Nagel, and G. Werner, (Eds.), Geometrical Problems of Image Processing, Akademie Verlag,
Berlin, 72±77, 1991.
4. R. Bird. ``Introduction to Functional Programming Using Haskell''. Series in Computer Science. Prentice
Hall Europe, Hemel Hempstead, UK, 1998.
5. T. Bittner and A.U. Frank. ``On Representing Geometries of Geographic Space,'' in T.K. Poiker and
N. Chrisman, (Eds.), 8th International Symposium on Spatial Data Handling, 111±122, Vancouver, 1998.
International Geographical Union.
6. E. Clementini and P. Di Felice. ``An Algebraic Model for Spatial Objects with Indeterminate Boundaries,''
in P.A. Burrough and A.U. Frank, (Eds.), Geographic Objects with Indeterminate Boundaries, volume 2 of
ESF GISDATA, 155±169, Taylor & Francis, 1996.
7. A.G. Cohn, B. Bennett, J. Goodday, and N. Gotts. ``Qualitative Spatial Representation and Reasoning with
the Region Connection Calculus,'' Geoinformatica, Vol. 1(3):1±44, 1997.
8. H. Couclelis. ``People Manipulate Objects (but Cultivate Fields): Beyond the Raster-Vector Debate in
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 63

GIS,'' in A.U. Frank, I. Campari, and U. Formentini, (Eds.), Theories and Methods of Spatio-Temporal
Reasoning in Geographic Space, volume 639 of Lecture Notes in Computer Science, 65±77, Springer-
Verlag, Berlin, 1992.
9. C.R. Dyer, A. Rosenfeld, and H. Samet. ``Region Representation: Boundary Codes from Quadtrees,''
Communications of the ACM, Vol. 23(3):171±179, 1980.
10. M.J. Egenhofer. Spatial Query Languages. Ph.D. thesis, University of Maine, 1989.
11. M.J. Egenhofer. ``Reasoning about Binary Topological Relations,'' in O. GuÈnther and H.-J. Schek, (Eds.),
Advances in Spatial Databases (SSD '91), 143±160, Springer, 1991.
12. M.J. Egenhofer. ``A Model for Detailed Binary Topological Relationships,'' Geomatica, Vol. 47(3 &
4):261±273, 1993.
13. M.J. Egenhofer, E. Clementini, and P. di Felice. ``Topological Relations between Regions with Holes,''
International Journal of Geographical Information Systems, Vol. 8(2):129±142, 1994.
14. M.J. Egenhofer, A.U. Frank, and J.P. Jackson. ``A Topological Data Model for Spatial Databases,'' in A.
Buchmann, O. GuÈnther, T. R. Smith, and Y.-F. Wang, (Eds.), Design and Implementation of Large Spatial
Databases, volume 409 of Lecture Notes in Computer Science, 271±286, Springer, New York, 1989.
15. M.J. Egenhofer and R.D. Franzosa. ``Point-Set Topological Spatial Relations,'' International Journal of
Geographical Information Systems, Vol. 5(2):161±174, 1991.
16. M.J. Egenhofer and J.R. Herring. ``A Mathematical Framework for the De®nition of Topological
Relationships,'' in 4th International Symposium on Spatial Data Handling, 803±813, ZuÈrich, 1990,
International Geographical Union.
17. M.J. Egenhofer and D.M. Mark. ``Modeling Conceptual Neighborhoods of Topological Line-Region
Relations,'' International Journal for Geographical Information Systems, Vol. 9(5):555±565, 1995.
18. M.J. Egenhofer and D.M. Mark. ``Naive Geography,'' in A.U. Frank and W. Kuhn, (Eds.), Spatial
Information Theory, volume 988 of Lecture Notes in Computer Science, 1±15, Springer, Berlin, 1995.
19. M.J. Egenhofer and J. Sharma. ``Topological Relations between Regions in IR2 and Z2 ,'' in D. Abel and
B. Ooi, (Eds.), Advances in Spatial Databases, volume 692 of Lecture Notes of Computer Science, 316±336,
Springer, New York, 1993.
20. M.J. Egenhofer, J. Sharma, and D.M. Mark. ``A Critical Comparison of the 4-Intersection and 9-Intersection
Models for Spatial Relations: Formal Analysis,'' in R.B. McMaster and M.P. Armstrong, (Eds.), Auto-Carto
11, 1±11, Minneapolis, Minnesota, 1993. ASPRS/ACSM.
21. A.U. Frank. ``Spatial Concepts, Geometric Data Models and Data Structures,'' in D. Maguire, (Eds.), GIS
Design Models and Functionality, Leicester, UK, 1990. Midlands Regional Research Laboratory, University
of Leicester.
22. A.U. Frank. ``Metamodels for Data Quality Description,'' in R. Jeansoulin and M. Goodchild, (Eds.),
Data Quality in Geographic Information: from Error to Uncertainty, 15±30. Editions HermeÂs, Paris,
1998.
23. M. Gahegan and R. Iverach. ``A Hybrid Edge and Region Quadtree,'' in T. K. Poiker and N. Chrisman,
(Eds.), 8th International Symposium on Spatial Data Handling, 701±712, Vancouver, 1998. International
Geographical Union.
24. A. Galton. ``Towards a Qualitative Theory of Movement,'' in A.U. Frank and W. Kuhn, (Eds.), Conference
on Spatial Information Theory, volume 988 of Lecture Notes in Computer Science, 377±396, Berlin, 1995.
Springer.
25. M.F. Goodchild. Geographical Data Modeling. Technical Report 90-11, National Center for Geographic
Information and Analysis, 1990.
26. D. HernaÁndez. Qualitative Representation of Spatial Knowledge, volume 804 of Lecture Notes in Arti®cial
Intelligence. Springer, Berlin, 1994.
27. J.R. Herring. ``Tigris: Topologically Integrated Geographic Information System,'' in Auto-Carto 8, 282±
291, Baltimore, 1987. ACSMÐASPRS.
28. J.R. Herring. ``The Mathematical Modeling of Spatial and Non-Spatial Information in Geographic
Information Systems,'' in D.M. Mark and A.U. Frank, (Eds.), Cognitive and Linguistic Aspects of
Geographic Space, volume 63 of Nato ASI Series D, 313±350, Kluwer, Dordrecht, 1991.
64 WINTER AND FRANK

29. P. Hudak, J. Peterson, and J.H. Fasel. ``A Gentle Introduction to Haskell,'' Version 1.4. http://
haskell.cs.yale.edu/tutorial/, Yale University, April 7, 1997.
30. T.Y. Kong and A. Rosenfeld. ``Digital Topology: Introduction and Survey,'' Computer Vision, Graphics,
and Image Processing, Vol. 48:357±393, 1989.
31. V.A. Kovalevsky. ``Finite Topology as Applied to Image Analysis,'' Computer Vision, Graphics, and Image
Processing, Vol. 46:141±161, 1989.
32. V.A. Kovalevsky. ``A New Concept for Digital Geometry,'' in O. Ying-Lie, A. Toet, D. Foster, H.J.A.M.
Heijmans, and P. Meer, (Eds.), NATO Advanced Research Workshop Shape in Picture (1992). Springer,
1994.
33. D.M. Mark, D. Comas, M.J. Egenhofer, S.M. Freundschuh, M.D. Gould, and J. Nunes. ``Evaluating and
Re®ning Computational Models of Spatial Relations through Cross-Linguistic Human-Subjects Testing,'' in
A.U. Frank and W. Kuhn, (Eds.), Spatial Information TheoryÐA Theoretical Basis for GIS, volume 988 of
Lecture Notes in Computer Science, 553±568. Springer, Berlin, 1995.
34. J. Nievergelt and P. Schorn. ``Das RaÈtsel der verzopften Geraden,'' Informatik-Spektrum, Vol. 11:163±165,
1988.
35. OGC. OpenGIS Simple Features Speci®cation for SQL. Technical Report, Open GIS Consortium, Inc.,
March 13, 1998.
36. J. Peterson and K. Hammond. Report on the Programming Language Haskell. http://haskell.cs.yale.edu/
haskell-report/haskell-report-1_4.pdf, Yale University, April 7, 1997.
37. D.A. Randell, Z. Cui, and A. Cohn. ``A Spatial Logic Based on Regions and Connection,'' in R. Brachmann,
H. Levesque, and R. Reiter, (Eds.), Third International Conference on the Principles of Knowledge
Representation and Reasoning, 165±176, Los Altos, CA, 1992. Morgan-Kaufmann.
38. Rational. Uni®ed Modeling Language. Technical report, Rational Software Corp., 1996.
39. A. Rosenfeld and J.L. Pfaltz. ``Sequential Operations in Digital Picture Processing,'' J. Assoc. Comput.
Mach., Vol. 13:471±494, 1966.
40. A. Rosenfeld. ``Digital Topology,'' Am. Math. Month., Vol. 86:621±630, 1979.
41. H. Samet. The Design and Analysis of Spatial Data Structures. Addison-Wesley, Reading, Massachusetts,
1990.
42. J.L. Star, J.E. Estes, and F. Davis. Integration of Remote Sensing and Geographic Information Systems.
Research initiative 12 closing report, NCGIA, 1995.
43. S. Thompson. HaskellÐThe Craft of Functional Programming. International Computer Science Series.
Addison-Wesley, Harlow, UK, 1996.
44. W. Tobler. ``Application of Image Processing Techniques to Map Processing,'' in International Symposium
on Spatial Data Handling, 140±145, Zurich, Switzerland, 1984.
45. S. Winter. ``Topological Relations between Discrete Regions,'' in M.J. Egenhofer and J.R. Herring, (Eds.),
Advances in Spatial Databases, volume 951 of Lecture Notes in Computer Science, 310±327. Springer,
Berlin, 1995.
46. S. Winter. ``Bridging Vector and Raster Representation in GIS,'' in R. Laurini, K. Makki, and N. Pissinou,
(Eds.), Proceedings of the 6th International Symposium on Advances in Geographic Information Systems,
57±62, Washington, D.C., 1998. ACM Press.
47. S. Winter and T. Bittner. ``Hierarchical Topological Reasoning with Vague Regions,'' in W. Shi, M.F.
Goodchild, and P.F. Fisher, (Eds.), Proceedings of the International Symposium on Spatial Data Quality,
555±565, Hong Kong, 1999. Department of Land Surveying and Geo-Informatics, The Hong Kong
Polytechnic University.
48. M.F. Worboys. ``Imprecision in Finite Resolution Spatial Data,'' GeoInformatica, Vol. 2(3):257±279, 1998.
49. M.F. Worboys and P. Bofakos. ``A Canonical Model for a Class of Areal Spatial Objects,'' in D. Abel and
B.C. Ooi, (Eds.), Advances in Spatial Databases, volume 692 of Lecture Notes in Computer Science, 36±52,
Berlin, 1993. Springer.
TOPOLOGY IN RASTER AND VECTOR REPRESENTATION 65

Stephan Winter is assistant at the Department of Geoinformation, Technical University Vienna, Austria. He
studied geodesy in Bonn, Germany, and got his Ph.D. in 1996 with a thesis about uncertain topological relations.
In 1997 he moved to Vienna where he is working on the integration of raster and vector representations.

Andrew U. Frank is Professor of Geoinformation at the Technical University Vienna since 1991. Prior to that
he was Professor of Land Information Studies in the Department of Surveying Engineering at the University of
Maine. He was also head of the National Center for Geographic Information and Analysis (NCGIA). He received
his Ph.D. from the Swiss Federal Institute of Technology (ETH) Zurich in 1982. His current research interests
focus on problems of spatial cognition, formalization of space and of spatial problems, and the economic value of
spatial information.

View publication stats

You might also like