CARTOGRAPHIC DISPLAY OPERATIONS ON -...
Transcript of CARTOGRAPHIC DISPLAY OPERATIONS ON -...
CARTOGRAPHIC DISPLAY OPERATIONS ON
SURFACE DATA COLLECTED I N AN
IRREGULAR STRUCTIJRE
Douglas Cochrane
B.Sc., Simon F rase r Un ive r s i t y , 1973
A THESIS SUBMITTED I N PAXTIAL FULFILLMENT OF
THE REQUIREMENTS FOR THE DEGREE OF
MASTER OF ARTS
i n the Department
0 f
Geography
0 DOUGLAS COCHRANE 1974
SIMON FRASER UNIVERSITY
J u l y 1974
A l l r i g h t s r e se rved , This t h e s i s may n o t be
reproduced i n whole o r i n p a r t , by photocopy
o r o t h e r means, without permission of t h e au tho r .
APPROVAL
Name :
Degree :
T i t l e of Thesis :
Douglas Cochrane
Master of A r t s
Cartographic Display Operations on Surface Data Col lec ted i n an I r r e g u l a r S t r u c t u r e
Examining Committee:
Chairman: M.C. Kellman
Thomas K. Peucker - Senior Supervisor
-
Robert B. ~ o r s f a g
Theodor D. S t e r l i n g
Car l %arm Ass i s t an t o fe s so r
Univers i ty of Washington S e a t t l e
PARTIAL COPYRTClIT LICENSE
I hereby g r a n t t o Simon F rase r Univers i ty t he r i g h t t o lend
my t h e s i s o r d i s s e r t a t i o n ( t h e t i t l e of which i s shown below) t o u se r s
of t he Simon F r a s e r Un ive r s i t y Library , and t o make p a r t i a l a r s i n g l e
copies only f o r such u s e r s o r in response t o a reques t from the l i b r a r y
of any o t h e r u n i v e r s i t y , o r o ther educa t iona l i n s t i t u t i o n , on i t s 'own
behal f o r f o r one of i t s u s e r s . I f u r t h e r agree t h a t permission f o r
mu l t ip l e copying of t h i s t h e s i s f o r s c h o l a r l y purposes may be granted
by me or t he Dean of Graduate S tudies . It is understood t h a t copying
o r pub l i ca t ion of t h i s t h e s i s f o r f i n a n c i a l ga in s h a l l no t be allowed
without my w r i t t e n permission.
T i t l e of Thesis / ~ i s s e r t a t i o n :
Cartographic display operations on surface data collected i n an
irregular structure.
Douglas Cochrane
(name )
November 1, 1974
( d a t e )
ABSTRACT
Cartography is the art of displaying scaled reproductions of geographic
areas or spatial phenomena. The procedure, or methodology, by which
cartography is performed may be broken down into three basic steps;
data collection, data storage and data display. Each step involves
the manipulation of information; information degcribing that which
the cartographer has attemped to reproduce. Information must flow
through the process from the encoding of the original geographic area
or spatial phenomena to the cartographic display. The process in its
totality must be capable of maximum information retention, and, since
the process is only as strong as its weakest step, each step must in
turn be capable of maximum information retention,
The research involved in this thesis has been carried out for the
purposes of maximizing both the information capacity and the efficiency
of the cartographic process for computer cartography. A relatively
new geographic data structure has been designed for the storage of
information representative of surfaces. Specific points chosen for
their ability to characterize both changes and similarities of a surface
are collected and stored in triangular networks. The author's major
contribution is a system of computer programs for the displayof the
new data structure. Three basic routines were developed; a contour
plotting routine, a perspective view routine and a routine for
construction of shaded relief maps. The objective of each routine was
the display of all information contained by the data structure, and for
a properly designed data structure this should be all the information
collected from the surface. Sample runs of the system have been made
and one such run is included accompanied by the programs and subroutines
of the system. Sample displays of the test surface seem to imply that
the data structure and display routines do indeed retain the majority
of the information collected.
(iii)
ACKNOWLEDGEMENTS
I wish t o thank my sen io r supe rv i so r , D r . T.K.Peucker, f o r suggest ing
the top ic of t h i s t h e s i s and f o r h i s a s s i s t a n c e i n t h e r e sea rch , A g r e a t
d e a l of thanks goes a l s o t o D r . R.B.Horsfal1 f o r h i s encouragement
throughout t h e r e sea rch and f o r h i s welcome comments i n proof reading
t h e d r a f t . A s p e c i a l thanks must go t o my fe l low graduate s tuden t
M r . David H. Douglas no t only f o r t h e va r ious subrout ines and programs
used by t h i s system bu t a l s o f o r h i s encouragement and many h e l p f u l
comments throughout t h e e n t i r e p r o j e c t .
F i n a l l y I wish t o express my most s i n c e r e thanks t o my wi fe , Vickeri
E. Cochrane, f o r h e r encouragement, understanding and pa t ience .
TABLE OF CONTENTS
ABSTRACT
ACKNOWLEDGEMENTS
TABLE OF CONTENTS
TABLE O F FIGURES
CHAPTER I
CHAPTER I1
CHAPTER 111
CHAPTER I V
C W T E R V
APPENDIX I
APPENDIX I1
THE CARTOGRAPHIC PROCESS
THE COLLECTION STAGE
THE STORAGE STAGE
THE DISPLAY STAGE
C o n t o u r ing
B l o c k D i a g r a m s
Analytical H i l l S h a d i n g
CONCLUSION
PROGRAMS AND SUBROUTINES
A SAMPLE DATA STRUCTURE
SELECTED BIBLIOGRAPHY
page
iii
iv
v
v i
1
9
19
2 8
3 1
3 5
4 7
5 4
56
85
8 8
TABLE OF FIGURES
Figure Page
Car tographic Pyramid 2
Cartographic Pyramid 8
Regular Grid Data Col lec t ion 11
Line Reduction 13
Autocorrelat ion Function 14
L i s t Processing Records 2 1
Data Flow, L i s t Processing 2 2
Tr iangula t ion Scheme, Canoe River Valley 2 4
I n i t i a l Po in te r Choice 2 5
Canoe River Valley, Or ig ina l Topographic Map 29
Canoe River Valley, 100 Meter Contours 3 2
Canoe River Valley, 50 Meter Contours 33 \
Canoe River Valley, 100 Meter Contours 3 4
Canoe River Valley, Viewpoint within t h e Data S t ruc tu re 36
Canoe River Valley, 200 Unit P r o f i l e Spacing 3 7
Canoe River Valley, 500 Unit P r o f i l e Spacing 3 8
Rotat ion of Data S t ruc tu re 3 9
P r o f i l i n g of Data S t ruc tu re 4 0
Horizon and P r o f i l e Compar'ison 4 1
Canoe River Valley, O r thographic P ro jec t ion 42
Canoe River Valley, True Perspec t ive P ro jec t ion 4 3
Canoe River Valley, Orthographic P ro jec t ion 44
Canoe River Valley, True Perspec t ive P ro jec t ion 45
Canoe River Valley, O r thographic P ro jec t ion 4 6
Vectors of a Typical Tr iangle 4 9
Shading Symbol Range 50
Canoe River Valley, Shaded Relief Map 5 3
Figure
V e r t i c a l Plane T h r o u g h the D a t a S t ructure
ISOKONT
EYEBALL, READER1
GREY SHDE
GREY SHDE
T R I G L E
SCHNET
SCHNET
SCHNET
S CHNET
SCHNET
C O W E R
CONVER
C O W E R
ANGFND
MARK I T
I S O N , LOR and LAND
WORK1, WORK2 and F I N D I T
SORTER and S T R I P
ROTATE and CENTRE
MAXMIN and P O I N T S
OUTS I D
WORK1 and BORDER
I r r egu la r D a t a S t ruc ture
R e c o r d s of the D a t a Structure
CHAPTER I : THE CARTOGRAPHIC PROCESS
Cartography is the technique of collecting and displaying information
pertaining to the spatial characteristics of geographic regions.
Collection is the gathering of information, while display involves
the reproduction of this information in such a way as to give the user
or viewer maximum knowledge of the original region or spatial phenomena.
Since geographic study areas are in general very large and the amount of
collected information quite voluminous, certain storage techniques must
be used to keep the information in a logical, usable form. Storage,
the intermediate step to collection and display, should be based on
consideration of the information being stored and the use which is to
be made of the information.
However, cartography is not simply a matter of collecting, storing and
displaying information - cartography is the totality of these processes and must consider each one as part of the group. Common to each of
these stages is that which is of primary concern; the information!
Since the objective is to reach display with as little loss of inform-
ation as possible and since the efficacy of each step is dependent
upon that of the previous step, it is necessary that retention be
maximized throughout. The maximum amount (in terms of desired output)
of relevant information must be collected, since the base of the cart-
ographic pyramid is the collection stage (Figure 1.1) and all else
is dependent upon this. The cartographic pyramid gives a good illustr-
ation of information flow. The shape of the pyramid illustrates inform-
ation retention; information content generally decreases with height,
or the processing distance, from the original region.
p hlc
Flow
Or ig ina l Geographic Region
Figure 1.1 Cartographic Pyramid
Reg lo n
The information content of cartographic maps has recently come
under study by both cartographers and mathematicians. Sukhov ( 26 ) , examines how the contents of a map may be generalized and, through
the use of information theory, calculates the deviation of a given
map from that of a fully "loaded" source, or what proportion of the
maximum possible information is not on the finished map. Gokhman
and ~ekler ( 12 analyse the methodology in studying the information
content and capacity of maps, deriving various formulas which may be
of great use in the ~tudy of maps as the end product of the mapping
process. These studies, which consider the map as an information
source, are of great value in the optimization of the cartographic
technique - since a good measure of the efficiency of the technique is in the analysis of the information content of the finished product
(the map).
In all studies of information flow and the communication of ideas
it is necessary to understand how information is measured. How much
information does any given communication have or not have? If a map
contains information is this information in the best form, is the
map a good medium for the transportation of information, and, how
may the map be improved to maximize its information content with
little or no loss of aesthetic value?
Information theory is that body of descriptive knowledge built up
to describe and quantify the content of communications. A certain
communication is deemed to carry information only if it alleviates
or reduces the uncertainty which existed for the receiver before that
particular communication took place. The true quantity of vagueness
removed is difficult, if not impossible to measure. However through
statistical treatment it has been possible to assign relative values
to the information content and to evaluate certain modes of communic-
ation on this basis, In other words it is impossible to assign an
absolute value to the amount of information contained in a given
message, however tkcontent can be compared to other messages and
other modes of communication for a relative measure.
Communications may be said to relate information to the observer
concerning an event (E) which occurs with a probability of P(E).
If the observer is told that the event (E) has occurred then by
definition he has received
units of information.
The base chosen for the logarithm dictates the units of information.
The logarithm to base 10
gives information in units of Hartleys. With the natural logarithm
or log t o base e
information i s i n n a t s . The most common, i n computer usage, i s t h e
base 2 logari thm o r b ina ry u n i t i n which t h e r e s u l t i n g u n i t of
information
i s c a l l e d the - b i t .
For example i f t h e event (E) i s t h e f l i p p i n g of a co in and t h e
subsequent observa t ion of a head then P(E) = $5. I f t h e co in i s
f l i pped and a head i s observed then t h e informat ion rece ived i s r i
= log2 P(E) = log2 (2) = 1 b i t lLJ 1 ) = 0 [$J = log lo (2) = 0.301 Har t leys .
An information-generating mechanism is an informat ion source i n .
which t h e success ive ly emi t ted symbols a r e s t a t i s t i c a l l y independent
of each o the r and i s c a l l e d a zero-memory information source. Each
symbol from t h e f i x e d f i n i t e source a lphabet
a r r i v e s from t h e mechanism wi th no dependence whatsoever on the pre-
ceding symbol. The source (S) i s completely descr ibed by the a lphabet
and p r o b a b i l i t i e s wi th which t h e symbols occur - which a r e
Since this is a discrete information source, with all symbols being
statistically independant, the information provided by the occurrence
of the symbol S is given by j
The average amount of information per symbol can then be calculated as
-P(s~) . I(Si) bits i =O
Average information per symbol is defined as the entropy of the source
and may be interpreted as the amount of uncertainty of the observer
before the communication is received.
Information theory sets out the guidelines for the quantification of
the information contained in a given conmunication, through the appl-
ication of which, various modes of communication may be compared for
the most efficient. Abramson ( 1, p.13) presents a comparison of the
spoken word of a radio announcer to that of one single television
picture. Assuming that the radio announcer has a vocabulary of 10,000
words, of which he selects 1000 in a random fashion (which is of course
not the case in the process of normal speech), the probability of him
choosing any one particular 1000 sequence (E) is then
And the amount of information transmitted by any particular sequence (E)
will be
= 13,000 bits
The television picture is composed of a matrix 500 x 600 with each
cell of the matrix (black and white television) having any one of
10 distinguishable grey scalee possible. Therefore the base alphabet
for the television is
Thus the probability of any one picture (E) occurring is
1
And the information transmitted by one of these pictures is
Therefore, comparatively speaking, the information transmitted by one
television picture far exceeds the information transmitted by 1000
spoken words .
Maps, as Sukhov (26) , and Gokhman and Mekler ( 12 ) point out,
may also be compared in this manner. Hqever, since maps are a
combination of various communication techniques, { i . e. text, topographic line work (isolines, hachuring), thematic line work
(roads, settlements), hydrographic line work (rivers, lakes, oceans),
colour patterns (tonings, shadings), and map graticules each of
which may be considered as an information-generating mechanism,
information content must be determined for each of these techniques
considered as an information source. The map must be broken down
into its component parts and analysed piece by piece, the information
for the various sources is then summed to give the total.
However the effects of various tehniques working in conjunction with
each other will be lost with this method. If for example five hundred
foot colour changes are overlaid with ten foot contours of a topographic
surface it is possible to calculate the information transmitted by the
contours and by the colour changes, however the information of the
combination is difficult if not impossible to measure. It is known
that the colours will enhance the contour levels and make the relief
appear more definite - but the information transmitted by this tech- nique is not a hard and fast unit which can be measured. The map
therefore contains certain tangibles which may be quantified in terms
of the information they provide, but the intangibles are inherent in
the map and any information which they provide will be overlooked in
objective measurements even though it may be of great value.
Analysing the information content of given display techniques will
afford some insight into the efficiency of the displays, however
within the cartographic process, display is simply the end result.
If different maps vary in information it cannot be concluded that
this has been solely determined by the display technique. The cart-
ographic pyramid, which illustrates information flow and whose shape
corresponds with information retention, shows that information is not
only lost at the display stage but also at the collection and storage
stages. A good display can do no more than to illustrate the inform-
ation that has proceeded this far in the process; it cannot generate
its own information but must be fed this from the lower stages. Thus
analysis of information content must take place at the collection,
storage and display stages in order to optimize the cartographic process.
The collection stage should give the base information set for the study
and should be based upon that which the study is intended to examine. The
collection stage is therefore the most important member of the group
and all necessary information should enter here. Entrance at this point
should be directly into storage, with the storage technique used being
developed primarily to serve the information entering. However, since
the information must: exit from the storage stage to the display stage
the storage technique should also accommodate the exiting of the inform-
ation. Thus the storage technique assumes a dual role - it must not only
accept information from t h e c o l l e c t i o n s t a g e wi th maximum r e t e n t i o n
but a l s o g ive information t o t h e d i sp l ay s t a g e , i d e a l l y , e x a c t l y a s
much information a s was accepted from the c o l l e c t i o n s t age . I f t h e
s to rage and d i s p l a y s t a g e s can be c rea t ed t o c a r r y a l l information
c o l l e c t e d , t h e ca r tog raph ic pyramid w i l l assume a new shape (Figure
1 .2) - s i n c e a l l information c o l l e c t e d from the o r i g i n a l geographic
reg ion w i l l appear on t h e reduced car tographic vers ion . However
s i n c e the car tographer does not wish t o d u p l i c a t e r e a l i t y - only
accentua te c e r t a i n chosen a t t r i b u t e s - the c o l l e c t i o n s t a g e w i l l - - ---__
O r i g i n a l R e g i o n
Figure 1 .2 Cartographic Pyramid wi th information r e t e n t i o n .
s t i l l show some l o s s of information. This cannot r e a l l y be termed
a l o s s , a s i t i s a f i l t e r i n g o r s e l e c t i v e sampling, record ing only
those elements of r e a l i t y which a r e deemed necessary t o an understanding
of t h a t p a r t i c u l a r phenomena which is t o be s tudied .
CHAPTER 11: THE COLLECTION STAGE
Maps are two dimensional representatiors of three dimensional geog-
raphic areas or spatial phenomena. They are based on information
selected from an infinite number of characteristics concerning the
area in question. Since the map only represents reality in a reduced
form it is imperative that the information selected from reality be
characteristic of the reality. However, since no map is a represent-
ation of all of reality but only certain portions thereof, the
information selected must only characterize these portions. For
example, topographic maps, hydrographic maps, land use maps, settlement
pattern maps or linguistic maps all represent different portions of
reality and the information selected from reality must characterize
the appropriate portion. Therefore, the type of map to be constructed
or the focus of the information to be presented by the map, dictates
what information shall be collected from the geographic area.
In the representation of surfaces (topographic, economic, or social),
specific, characteristic points must be selected from the real surface.
These points are functions of two variables
in which f is the function of surface behaviour from which z may be
calculated - given x, y and the function. However, unlike mathematical
surfaces, f is generally unknown for topographic surfaces. Therefore
in the collection of information from a topographic surface it is
necessary to collect the three values, x, y, and z , which will completely
define the behaviour of the surface. Selection of these points may be
carried out by any one of four methods;
1) regular grid overlay in the x, y plane, with collection of the
2; variable,
2) sampling varying x, y coordinates for a fixed z value with constant
incremental increases in z (i.e. recording x, y coordinates of isolines),
3 ) collecting z values for random x, y coordinate locations,
or 4) collecting z values of specific points on the surface - where the points are determined by how characteristic they are of changes in
the surface.
Any one of these methods will yield data characteristic of the surface
and enable reproduction. However, since some collect more redundant
information than do others, they require larger samples to achieve
equality of information content.
Sampling a surface with the regular grid overlay technique involves
superimposing a grid of constant x, y increments onto the surface and
recording the z values for the grid nodes, In order that a statistically
sound sampling be obtained, the theoretically "best" cell size may be
calculated with the sampling theorem, which states that "if a function
has no spectral components of frequency higher than W, then the value
of the function is completely determined by a knowledge of its values
placed $ W apart. The lack of freedom of the function for variation
from the prescribed path between sample points is a consequence of its
lack of spectral components of frequency higher than W". (28). For
example, if undulations of the surface are to be detected to within
100 units, it would be necessary that the grid cells be of 50 unit
spacing or less.
Data collection based on regular spacing of the sample points should,
if the sampling theorem is invoked, yield a statistically sound
representation of the surface. Data collected in this manner tend to
have the appearance of overlaying the surface with a "fish net",
Figure 2.1, since each cell of the grid is only represented by the
grid nodes.
Figure 2.1 Regular Grid Data Collection. Program: VUBLOK; Production: D. Cochrane
Information collected in this manner is somewhat random, since the
collection points (nodes of data collection) are not chosen for the
surface in question but for the reproduction desired by the user. It
is unlikely, unless the cell size chosen is extremely small, that the
nodes will happen to correspond with breaks bf the surface, or points
which define changes in the surface. If the cell size is made small
enough to ensure collecting all important points of the surface, the
amount of data thus collected will be enormous, the majority being
redundant. For example, if a data collection area is comprised of
mountainous regions and plateau regions interspersed, the cell size
will have to be extremely small to sufficiently cover the mountainous
regions ensuring adequate data collection points. However, the plat-
eaus will be represented by more than an adequate number of data points,
each representing nearly the same surface function and many of which
may be considered redundant. Collection of data by this method not
only wastes a good deal of time in the collection stage, but since the
data is carried through and displayed, waste is perpetuated throughout
the process.
Sampling a surface by recording only the x, y coordinates of isolines,
or, allowing the x, y values to vary while holding the z value fixed is
a technique of prime importance to photogrameters. Through the use of
optics, the photographer constructs, from aerial photographs, a three
dimensional visual representation of the surface, from which he then
records the x, y coordinates of the surface by a form of tracing.
Sampling a surface by this technique involves recording the x, y coord-
inates of major breaks along contour lines, the interval at which data
points are recorded is dependant upon the regularity of the surface.
Smooth contours may be approximated by few data points, while rough and
irregular contours will need more. However, as pointed out by Douglas
and Peucker ( 11 ), attempts to automate this technique have lead to
vast amounts of redundant information being recorded, since the machine
does not intuitively "choose" points which represent major breaks of the
surface. Automatic line followers record data at regular intervals
of either distance or time, and the sampling is therefore random
since points are not chosen to represent the surface, only the output
desired. Of course, the theoretically "best" interval may be chosen
with the sampling theorem but this does not alleviate the problem of
vast amounts of redundant information being reporded.
Redundant information may be screened from the raw data. Douglas
and Peucker develop a technique which seems to relieve the data of
only its redundant parta. Figure 2.2 shows the comparison between
raw data and screened data - line a is constructed from 112 data
points, while line b is constructed from only 19 data points.
Figure 2.2 Line Reduction. Douglas and Peucker (11)
Information content of the message (line) has been retained, only the
redundancy has been removed. Of course line a or line h is only a
generalized representation of the real line since specific breaks have
not necessarily been recorded. However, this technique of choosing a
vast number of data points and subsequently screening out only the
redundant information will approximate methods of recording only points
of high information content. As the number of data points chosen increases,
so does the probability of choosing points of high information content - i
points representing changes in the surface function.
A surface is a continuum of points each of which is characteristic
of its neighbourhood. A neighbourhood may be defined mathematically
as "for any real number c, zt neighbourhood of c is that open interval
containing cl'. ( 14, p. 74 ) The size of the interval of which the
data point is characteristic is of course dependant on the nature of
the surface or the surface function, For example, the neighbourhood
of which a point on an infinite level plane is characteristic is
an infinite neighbourhood, whereas if the surface is extremely
irregular the neighbourhood of characterisation becomes smaller, W'
The size of the neighbourhood will vary in relation to the irregularity
of the surface in a given distance. The autocorrelation function
shows that the larger a neighbourhood becomes, the more probable it
is that any point chosen at random from the real surface will vary
from the data point for which the neighbourhood is being drawn. J'
C o r r e l a t i o n C o r r e l a t i o n
Distance
Figure 2.3 Autocorrelation Function
Figure 2.3 illustrates the autocorrelation function - correlation of the surface at any given data point is plotted against distance
from the data point in question. The correlation between the surface
and the data point decreases as the distance increases, maximum
correlation is attained at the data point where the distance is
equal to zero. 1
Neighbourhoods, or regians of homogeneous information, are comprised
of characteristically similar data but similar data carries redundant
information, unnecessary to the description of the surface. Changes
in neighbourhood however are of high information content, as in the
statement "the wrong side of the tracks"; the tracks are an important
socio-economic boundary relaying a great deal of information to the
observer. A line or boundary has a certain extension or neighbourhood
within which a point may lie and still be descriptive of the change
between neighbourhoods. If a point is chosen at random from a surface
then the probability that this point will lie within a neighbourhood
is proportional to the area of the neighbourhood, and the probability
that the point will lie on a neighbourhaodboundary is proportional / to the "area" of the boundary. Thus if the probability of choosing a
point within a neighbourhood (WN) is equal to P(WN) and the probability
of choosing a point on a neighbourhood boundary (NB) is equal to P ( N B )
then
since the area (WN) will generally exceed the "area" (NB). The inform-
ation content of the points so chosen is
from 1
and
which implies d i r e c t l y t h a t
The information provided by a po in t chosen from wi th in a neighbourhood
w i l l be less than t h a t provided by a po in t chosen on a neighbourhood
boundary - assuming of course t h a t 1 i s t rue . Thus, i f t h e neighbour-
hood of a p o i n t i s known, and i t should be, simply from t h e r e g u l a r i t y
of t he s u r f a c e , sampling of t he s u r f a c e f o r t he r e t e n t i o n of high
information con ten t need only cons ider t h e c h a r a c t e r i s t i c s of p o i n t s
which r ep re sen t changes of neighbourhood. This of course is t h e method
of t he surveyor who records only breaks of t h e s u r f a c e , which he has
apprsximzted with pclygccs (n~ighhiirhoods).
P /
Po in t s c h a r a c t e r i s t i c of changes i n neighbourhoods have been c a l l e d
"sur face s p e c i f i c " p o i n t s by Warntz ( 2 9 ) . H e o u t l i n e s t h r ee d i s t i n c t
groupings of p o i n t s and l i n e s ; peaks and p i t s , passes and p a l e s , r i d g e
l i n e s and course l i n e s . With t h i s s e t a l l high l e v e l changes i n su r f ace
behaviour (neighbourhood changes) may be noted. A peak is a po in t of
l o c a l maximum and a p i t a p o i n t of l o c a l minimum ; both a r e , w i th in
some r e l a t i v e neighbourhood, surrounded by c losed contours . A pass
and a pa l e a r e p o i n t s of i n f l e c t i o n i n t h e s u r f a c e p r o f i l e and have no
c losed contours i n t h e i r neighbourhoods. A pass occurs a t t h e j unc t ion
between r i d g e l i n e s and course l i n e s , while a pa l e occurs a t t h e h igh
po in t between p i t s , and i s i t s e l f a low po in t of t h e r i d g e between t h e
p i t s . A r i d g e i s the l i n e of meeting of two upwardly s lop ing s u r f a c e s
and conversely a course is a l i n e of meeting of two downwardly s lop ing
surfaces. Ridge l i n e s , which connect points of l o c a l maxima, a r e
separated by course l i n e s , which connect po in t s of l o c a l minima.
Surface s p e c i f i c po in t s a r e po in t s of high information content , not
only a s changes i n neighbourhoods but a l s o a s s p e c i f i c po in t s wi th in
groupings of neighbourhoods. The knowledge t h a t a point is a peak
conta ins the information t h a t t h i s point is a l o c a l maximum, t h e f i r s t
de r iva t ive of the su r face funct ion is zero a t t h i s point , and t h i s
point represents a change of surface c h a r a c t e r i s t i c s f o r a t l e a s t two -I
neighbourhoods (usual ly more). En t i r e groups of neighbourhoods can be (*
reconstructed from the su r face s p e c i f i c points , s ince not only do
these po in t s des ignate changes i n neighbourhoods, they - a r e c h a r a c t e r i s t i c \ . ~J
of the neighbourhoods of which they form a p a r t . These po in t s de f ine
the s p a t i a l r e l a t ionships of neighbourhoods through t h e i r r e l a t i v e
pos i t ions on the su r face (21, p.29).
Sampling only su r face s p e c i f i c po in t s i s not a new technique - surveyors
have been co l l ec t ing su r face d e t a i l i n t h i s manner f o r cen tu r i e s .
However, wi th in t h e f i e l d of computer cartography, even though da ta
have been co l l ec ted i n t h i s manner i t is normally in terpola ted t o a 1 I
regular g r i d f o r s torage . Symap, one of the forerunners i n computer '
cartographic processing, accepts a s input i r r e g u l a r l y co l l ec ted da ta \ i po in t s but transforms the da ta onto a regular g r i d f o r any subsequent \ opera t ions . I n t e r p o l a t i o n d i spe r ses t h e information content of a
I i
da ta point to the g r i d nodes. Information regarding the t rue , surface
re l a t ionsh ip of a point , which is c h a r a c t e r i s t i c of a neighbourhood,
to other neighbouring s p e c i f i c po in t s is l o s t . ..-...-..- A l l information which
is i m p l i c i t t o a p o i n t ' s pos i t ion , and, a l l information t o be derived
from a p o i n t ' s i n t e r a c t i o n wi th i ts neighbouring s p e c i f i c po in t s - a l s o impl ic i t by p o s i t i o n - is gone. Cer ta in ly a new type of impl ic i t -
ness is gained, t h a t of the pos i t ion of the g r i d nodes, but t h i s i s
f o r the in te rpo la ted surface , not the t r u e geographic surface f o r
which the da ta was co l l ec ted . Surveyors, on the o ther hand, u t i l i z e
t h i s information. Once da ta concerning t h e surface s p e c i f i c p o i n t s has
been c o l l e c t e d t h e surveyor p l o t s the p o i n t s and connects them (even i f
only menta l ly) i n t o a rough t r i a n g u l a r network. From t h i s network he
then begins t o draw h i s conclusions about t h e su r f ace , whether i t be
f o r subd iv i s ions , engineer ing s t r u c t u r e s ( roads , b r idges , b u i l d i n g s ) ,
o r simply t o map the s u r f a c e - h i s dec i s ions a r e always based on t h e
s u r f a c e s p e c i f i c p o i n t s and t h e i r neighbourhoods. Once such d a t a has
been c o l l e c t e d i t i s imperat ive t h a t every d e t a i l be r e t a i n e d ;
in format ion content should not s u f f e r simply t o add t o t h e ease of
c o l l e c t i o n o r handling.
THE STORAGE STAGE
Computer representation and manipulation of surfaces involves
processing vast amounts of data, which, if left in a raw un-
structured form would be generally inaccessible. Data sets are
comprised of "elementary data items" ( 10, p.118 ) which are
singular pieces of information (i.e,x-coordinate of data point).
A collection of all elementary data items concerning one data
point is termed a record, and the collection of records into
logical units is a file. "The arrangement and interrelation of - records in a file form a data structure" ( 1 0 1 1 ) . The
information to be retrieved and the type of processing to be
carried out dictates the type of data structure best suited to
a given problem. As Dodd (10) points out there are many types
of data structures and many combinations thereof.
As an example of a data structuring problem, consider all the
names and phone numbers of the greater Vancouver region recorded
as one name, address and phone number (elementary data items) per
data card (record). If these cards were then shuffled randomly
they would constitute a very raw data set, and, there would exist
many possible structurings.
a). alphabetize the records by surname,
b). alphabetize the records by given names,
c). sequence the records by phone numbers,
d). regionalize on the basis of city blocks and order by
house number,
or e). sort by street then order by house number.
Any of these methods would yield a data structure, however the speed
of computer access to the elementary data items would vary for each.
The alphabetized structure of (a) would be very efficient for
retrieval of phone numbers if given the surname, but, the structure
of (e) would only impede the same search.
The functions of a data structure are numerous and depend entirely
on the problem to be solved. Surface storage renuires data
structures which are capable of a). minimizing space requirements
b). allowing fast access for retrieval,
updating, and storage
and c). retention of maximum spatial
information content.
However, simply attaining each of these does not guarantee a good
data structure - these characteristics must compensate and cornpl.rment each other, attaining the best from each in the totality.
As mentioned previously, retention of maximum spatial. information
content is of prime importance, si.nce this is the purpose of the
data structure in surface manipulation. There would be absolutely
no benefit in creating a fast, small data structure containing
relatively little information.
Surface representation is best accomplished by the collection of
irregular data points, surface specific points. These points carry
information describing the spatial relationships of certain surface
features and this information must be retained by the data structure.
Any data structure designed to accommodate this information must \ have the following characteristics.
Neighbourhood relationships should remain with the data, to the point
of making them explicit by actually recording within the data structure
the fact that two or more certain neighbours are adjacent and have a
given relationship between them. Pointers between neighbours such as,
point A is a neighbour of point B which is in turn a neighbour of point
C, should be established. The surface specific points should he related
to each other within the structure, since a good deal of information
is herein contained.
Linked or - list organization is a type of data structure in which
the links "are used to divorce the logical organization from the
physical organization" ( 10, p.122 ) of the structure. The links,
or as they are more generally called pointers, connect logically
adjacent parts of the data set which are stored in physically non-
adjacent areas of storage, thus allowing the computer to process a
record which is in a physically different area of storage than that
adjacent to the preceding record. The pointers between records may
be part of the actual record or they may simply be computer addresses
calculated at the time of processing (hash coding technique). For
example in Figure 3.1 if the data were to be organized alphabetically
it would be structured and processed as it is in the table.
Label Name
Anderson, Q. J.
Bambi, D.R.
Doe, J.
Smith, E.J.
Vanline, W.K.
Address
1715 W. Hastings St.
307 Cordova St.
1219 E. South St.
2102 S. West St.
1605 N. Smith St.
Phone #
397-0421
472-9152
281-0415
972-0916
104-3721
Pointer
Figure 3.1 List Processing Records
But if it was desired to process the names sequentially by phone number
from lowest to highest it would not be necessary to even check the
phone numbers, processing would start at Vanline and proceed as shown
in Figure 3.2
Figure 3 . 2 Data Flow, L i s t Processing
Vanl ine ' s p o i n t e r is 12 which means t h e next record t o be processed 1
has a l a b e l of 12 and i s Doe, which has a p o i n t e r of 21 which p o i n t s
t o Anderson, e t c . This example demonstrates how t h e l i s t o rgan iza t ion
func t ions , wi th one l a b e l and one p o i n t e r per record . The phone
numbers become l o g i c a l l y ad jacent (process ing w i l l be i n t h e l o g i c a l
o r d e r ) even though t h e r e may be a v a s t phys i ca l d i s t a n c e between the
r eco rds .
1 l a b e l = key
A record may of course be l o g i c a l l y ad j acen t t o more than one
o t h e r record , s i n c e t he adjacency premise may d i f f e r - i . e . phone
number, s t r e e t addrese, or C h r i s t i a n name, For example t h e p o i n t e r s
e s t a b l i s h e d i n , F i g u r e 3.1 have an adjacency premise of phone numbers,
t h e phone numbers i nc rease a s t h e p o i n t e r l is t inc reases . However,
i f t h e premise were t o be surnames, t h e o r d e r of p rocess ing would have
t o be
which would i n d i c a t e a d i f f e r e n t p o i n t e r f o r each record. Obviously,
i f t h e premise were addresses another group of p o i n t e r s would be c r ea t ed .
Thus each record may have more than one p o i n t e r , with each p o i n t e r
being dependent upon a d i f f e r e n t adjacency premise. In a r e c o r d ' s
p o i n t e r l i s t t h e f i r s t p o i n t e r may po in t t o t h e ad jacent record based
on phone numbers, t h e second t o t h e ad j acen t based on street address
and t h e t h i r d based on C h r i s t i a n name. Of course each record may have
only one l a b e l s i r r e t h e record is processed by i t s l a b e l and mu l t i p l e
l a b e l s would only i n c r e a s e process ing t i m e i n checking t h e l a b e l l i s t
f o r t h e given l a b e l . Data, r ep re sen t ing s u r f a c e s t r u c t u r e s , w i l l have
m u l t i p l e p o i n t e r s , each s u r f a c e s p e c i f i c po in t must be connected t o
more than one o t h e r s u r f a c e s p e c i f i c po in t . A su r f ace cannot be
represen ted by p o i n t s which a r e func t ions o f , o r connected t o , s i n g l e
o t h e r p o i n t s .
The d a t a s t r u c t u r e chosen i n t h i s r e sea rch was one i n which m u l t i p l e d~ - -
p o i n t e r s were used t o connect s u r f a c e s p e c i f i c p o i n t s . The method
of t h e surveyor was followed; d a t a were c o l l e c t e d i r r e g u l a r l y f o r t h e
breaks of t h e s u r f a c e , o r t h e boundaries of neighbourhoods (Appendix
11, page 85 ) . The i r r e g u l a r d a t a were then t r i a n g u l a t e d wi th t h e
c r i t e r i a f o r t r i a n g l e formation being t h a t t h e p lane of t h e t r i a n g l e
most c l o s e l y approximate t h e r e a l su r f ace . The c r i t e r i o n f o r c lo senes s
was t h a t t h e t r i a n g l e chosen (many t r i a n g u l a t i o n schemes a r e p o s s i b l e
from a given number of p o i n t s ( 2 3 ,Chapter 4 ) ) should have the
l e a s t a b s o l u t e d i s t a n c e between the p lane of t h e t r i a n g l e and the r e a l
Figure 3.3 Triangulation Scheme, Canoe River Valley
su r f ace . Since the da t a poin ts f o r t h j s .structurcl were der ived
from a map i t was re ln t - tve ly simple t o c l~oosc thc plan<% o f l e a s t 2
d e v i a t i o n from t h e su r f ace . Figure 3.3 i l l u s t r a t e s t h e t r i a n ~ u l a t c d
d a t a p o i n t s ove r l a id on the o r i g i n a l sur face .
The d a t a s t r u c t u r e i s constructed from t h e t r i a n g u l a t e d network
a t t h e t ime of recording t h e da t a values. Recording i s done
according t o t h e fol lowing r u l e s :
1) s e q u e n t i a l l y ( s t a r t i n g a t 1) l a b e l a l l d a t a po in t s (nodes of
t h e network) up t o N, t h e number of po in ts i n the d a t a s e t .
The fo l lowing a r e done f o r each d a t a po in t i n o rde r , one a t a t ime
(Format i s ou t l i ned i n Appendix 11).
2 ) record t h e l a b e l (from above) and t h e x, y , z coordina te of t h e
d a t a p o i n t i n ques t ion . -----
Figure 3 . 4 I n i t i a l Po in t e r Choice
2 An automated t r i a n g u l a t i o n procedure i s being developed.
3) s t a r t i n g a t t h e p o i n t e r c l o s e s t t o no r th and proceeding i n a clock-
wise d i r e c t i o n (Figure 3 . 4 ) record t h e l a b e l s of t h e p o i n t s t o which t h e
p o i n t i n ques t ion is connected.
4 ) i f a border (ou t s ide ex t remi ty of t h e da t a s e t ) is encountered
between two p o i n t e r s , record a va lue of 32000 i n t h e p o i n t e r l i s t .
5) i f t h e number of p o i n t e r s r a d i a t i n g from the p o i n t i n ques t ion
is g r e a t e r than seven ( >7 ), then make t h e seventh p o i n t e r i n t h e
l i s t a nega t ive i n t e g e r .
The a b s o l u t e va lue of t h e i n t e g e r s h a l l depend upon, i ) t h e number
of d a t a p o i n t s i n t h e s e t (N) and i i ) t h e number of t imes , f o r
prev ious r eco rds , t h e number seven has been surpassed. I f , f o r t h e
d a t a s e t i n ques t ion , t h i s i s t h e 1st node f o r which t h e number seven
has been surpassed then t h e i n t e g e r s h a l l have a va lue of N + 1. I f ,
f o r t h e d a t a s e t i n ques t ion , t h i s i s t h e j t h node f o r which t h e
number seven has been surpassed then t h e i n t e g e r s h a l l have an a b s o l u t e
va lue of N + j .
I f t h e number of p o i n t e r s does n o t exceed seven then r e t u r n t o number
2 ) , o therwise cont inue .
8) t h e (N + j ) t h record must now be f i l l e d i n . Give i t a l a b e l of
(N + j ) and record e x a c t l y t h e same x, y , z coord ina tes a s t h a t of
t h e node i n 2 ) .
9) cont inue record ing t h e p o i n t e r s as above wi th t h e f i r s t p o i n t e r
of t h e (N + j ) t h record being t h e seventh p o i n t e r clockwise around
the po in t i n ques t ion .
10) If t h e number of p o i n t e r s happens t o exceed t h i r t e e n use the same
method a s above t o record them wi th the l a b e l of t h e new record being
(N + j + 1) o r (N + 2) .
11) hlen all pointers of the point in question are exhausted (for
the number of pointers greater than seven) make the last pointer in
the list a negative integer. The absolute value of this integer
shall be the label of the point in question (that recorded in number
2 ) ) .
Continue this process for all N data points, with the resultant (N + k) records being the data structure representing the surface, where k
is the number of nodes with more than seven neighbours.
The data structure so constructed will represent the surface not only ,,/ relative to an absolute origin, but will also contain the relative
relationships between neighbours. Processing the records of this
structure'will be carried out between logical records and not
necessarily between physically adjacent records. All the neighbours
of one point may easily be recognized by the explicit relationships
designated by the pointers, which in itseif is not an advantage
over the implicit relationship between grid nodes. However, the nodes
are surface specific points rather than simple grid node samplings
which do not necessarily characterize the surface.
CHAPTER IV: THE DISPLAY STAGE
Information extraction is the prime objective of all data collections.
Data display, for the purpose of extracting information, may be
carried out in any one of the following forms;
1) tabulate the observed data,
2) statistically analyze the data and tabulate the results,
3) graphically represent the observed data,
or 4) graphically represent the statistically analyzed data.
In all forms of display the main concern should be to maximise the
amount of information obtainable from the results (table, graph, map,
etc.) of the study. The purpose of any study and the predetermined
use to which information gathered will be applied will generally
dictate which display method is best for the data in question.
Repre~entation of a surface is dependant upon the total data, inform-
ation being drawn from the relative positions of data points. Therefore,
it is imperative that the data be observed as a whole. The parts of
the data structure have no absolute meaning and can only be judged by
comparison to their neighbours. For example, it means nothing to say
a certain data point has an x, y, z value of (100, 200, 300). The
point could be a peak of great relative significance or a point on
a relatively flat surface. Surface data should be presented to the L'
observer in a manner such that all neighbourhood relations may be easily
observed.
Cartographers, through centuries of experimentation, have developed
numerous methods for the graphical representation of surfaces. In
1701 Edmund Halley (in27) published the first isoline
Figure 4 . 1 Canoe River Valley, Original Topographic Map
mnp, of isogones o r l i n e s of equa l magnetic d e c l i n a t i o n . By 1972
when Norman Thrower ( 2 7 ) published h i s book "Maps & Man" he presented
fo r ty - th ree types of isograms a s being a s e l e c t i o n "from a much l a r g e r
number of terms f o r s p e c i a l forms of t h e isogram" ( 2 7 , p 164 ).
During the n ine t een th cen tury block diagrams o r t h r e e q u a r t e r view
p r o j e c t i o n s were developed and used p r imar i l y f o r i l l u s t r a t i n g sub-
s u r f a c e s t r u c t u r e s of t h e e a r t h i n r e l a t i o n t o t h e su r f ace func t ions .
Senefelder ( 2 7 ) , i n t h e l a t e e igh t een th cen tury , developed a technique
of using mu l t i p l e co lours o r t o n a l ranges f o r t he i l l u s t r a t i o n of
topographic r e l i e f . Hachuring and r e l i e f shading of t h e s u r f a c e was
expanded by Tanaka (27) i n t h e e a r l y twen t i e th cen tury and more
r e c e n t l y automated by Yoel i (33). H i s t o r i c a l l y , ca r tographers have
always s t r i v e d f o r t h e "best" g r aph ica l r e p r e s e n t a t i o n of t h e d a t a wi th
which they have been presen ted .
The f o c a l po in t of t h i s r e sea rch has been t h e r e p r e s e n t a t i o n of s u r f a c e s ;
sampling, s t o r age and d i s p l a y . I n o rde r t h a t t h e d a t a s t o r e d i n t he
i r r e g u l a r d a t a s t r u c t u r e be accu ra t e ly por t rayed i t was necessary t o
c r e a t e a new system of d i sp l ay r o u t i n e s t h a t were cen te red around t h e J
d a t a s t r u c t u r e . Three d i s p l a y techniques were chosen; contour l i n e s ,
block diagrams and r e l i e f shading. One system of subrout ines was then
w r i t t e n f o r each of t h e s e techniques wi th t h e r e s u l t a n t programs being
a s fo l lows; ISOKONT, a program f o r t h e product ion of contour maps,
EYEBALL, f o r t he product ion of block diagrams o r , t h r e e dimensional
views, and GREYSHDE, f o r the product ion of shaded r e l i e f maps. Using
t h e i r r e g u l a r d a t a s t r u c t u r e and r e l y i n g on numerous subrout ines
(Appendix I) these r o u t i n e s w i l l i d e a l l y accomplish t he des i r ed r e s u l t
of d i s p l a y i n g t h a t information which i s c o l l e c t e d and s t o r e d wi th a s
l i t t l e informat ion l o s s as poss ib l e .
Contour i n &
ISOKONT is a program f o r d i sp l ay ing i s o l i n e s of e l e v a t i o n (contours )
from t h e d a t a of the i r r e g u l a r s t r u c t u r e . The bas ic i d e a of ISOKONT
i s ve ry simply a s fo l lows;
Knowing t h e z va lue of t h e h i g h e s t d a t a po in t i n t h e e n t i r e
s t r u c t u r e , c a l c u l a t e f o r t h e user-defined contour i n t e r v a l
t h e va lue of t h e maximum contour l e v e l ( i . e . i f maximum z
= 510 and contour i n t e r v a l = 50, then maximum contour l e v e l
equa l s 500).
Pass t o SCHNET t h e maximum contour l e v e l and t h e va lue of t he
h i g h e s t d a t a p o i n t . SCHNET w i l l t hen , a s descr ibed i n
Appendix I, c a l c u l a t e and pl.ot a l l t h e i n t e r s e c t i o n p o i n t s
of t h i s contour l e v e l w i t h t h e edges of t h e d a t a s t r u c t u r e .
Check t o see i f a l l i n t e r s e c t i o n s of t h e p a r t i c u l a r contour
w i t h t h e edges have been found. This check i s accomplished
by s e t t i n g up a b i t o r b i n a r y ma t r ix i n which each e n t r y i n
t h e ma t r ix (each c e l l ) i s simply a binary f i g u r e ' 1 ' o r '3'.
The c e l l l o c a t i o n i s de f ined by t h e nodes a t t he end of each
edge. For example, t h e edge formed by t h e two nodes 56 and
101 w i l l have a m a t r i x l o c a t i o n of row 56 by column 101.
Each t i m e a new contour l e v e l i s s t a r t e d t h e e n t i r e mat r ix
i s set t o ' 0 ' . When an edge is passed through by a p a r t i c u l a r
contour , t h a t c e l l l o c a t i o n de f ined by t h e nodes of t h e edge
i s set t o 'I1. Thus, i n o r d e r t o ensure t h a t a p a r t i c u l a r
edge has been c rossed by t h e contour , simply check t h e b i t
l o c a t i o n .
Decrease t h e va lue of t h e contour l e v e l by t h e va lue of t h e
contour i n t e r v a l . I f any edges a r e above t h e contour l e v e l
they may be e l imina t ed from any f u r t h e r checks s i n c e t h e r e i s
no p o s s i b i l i t y of i n t e r s e c t i o n wi th the contour .
Figure 4 .2 Canoe River Val ley , 100 Meter Contours. Program: ISOKONT
Figure 4.3 Canoe River Valley, 50 Meter Contours. Program: Isokont
Figure 4.4 Canoe River Valley, 100 Meter Contours. Program: J S X O N T
. 5 ) Pass t o SCHNET t h e va lue of t he contour l e v e l and any d a t a
p o i n t which i s above t h i s l e v e l , but has not been e l imina ted
i n S tep 4) . SCHNET w i l l aga in c a l c u l a t e and p l o t t h e i n t e r -
s e c t i o n s of t h i s contour l e v e l with t he edges of t h e d a t a s e t .
6) Continue s t e p s 3 ) , 4 ) , and 5) u n t i l t h e minimum va lue of t h e
d a t a set is g r e a t e r than t h e va lue of t h e contour l e v e l .
A l i s t i n g of ISOKONT may be seen i n Figure 1.2. ISOKONT w i l l produce
maps of any d e s i r e d i n t e r v a l . Figure 4.2 and Figure 4.3 show contour
maps of t h e Canoe Val ley ( o r i g i n a l topographic map, F igure 4.1).
F igure 4.2 shows contours p l o t t e d wi th a one hundred meter contour
i n t e r v a l whi le F igure 4.3 i s of a f i f t y meter i n t e r v a l . F igure 4.4
i l l u s t r a t e s t he op t ion of having t h e contour i n t e r v a l s p l o t t e d on t h e
contour map. The d a t a set f o r t he se p a r t i c u l a r maps c o n t a i n only e i g h t y
one p o i n t s - s e l e c t e d by examination of t h e s u r f a c e , and choosing only
s u r f a c e s p e c i f i c p o i n t s .
Block Diagrams
EYEBALL i s a r o u t i n e which c a l c u l a t e s and p l o t s va r ious pe r spec t ive
view diagrams of t h e i r r e g u l a r d a t a s t r u c t u r e . For a user-def ined
viewpoint (po in t i n space from which t h e u s e r wishes t o view t h e
s u r f a c e ) and c e n t r a l p o i n t ( cen t e r of view the u s e r wishes i n t h e d a t a
s t r u c t u r e ) t h e r o u t i n e w i l l c o n s t r u c t , according t o t h e op t ion s p e c i f i e d ;
t r u e pe r spec t ive p r o j e c t i o n s , pe r spec t ive i n x and or thographic i n y ,
pe r spec t ive i n y and or thographic i n x , o r t r u e or thographic p r o j e c t i o n s .
Any viewpoint above t h e minimum z va lue of t h e su r f ace may be s p e c i f i e d
and i n f a c t t h e viewpoint may a c t u a l l y rest on t h e s u r f a c e , a l lowing t h e
u s e r t o "walk" over t he s u r f a c e (Figure 4 .5) . Also, s i n c e t h e p ro j ec t ed
s u r f a c e i s composed of s u r f a c e p r o f i l e s taken a t s p e c i f i e d r e g u l a r i n t e r v a l s
from t h e viewpoint , t h e u s e r i s a f forded f l e x i b i l i t y i n determining t h e
e x t e n t of d e t a i l on t he f i n i s h e d p r o j e c t i o n (compare F igure 4.6 t o F igure
I'ih:uri. 4 . 5 Carloc' River V a l l e y , Viewpoint With in t h e Data S t r u c t u r e . P r o f i l i n g b e g i n s a t one h a l f t h e d i s t a n c e be tween t h e v i ewpo in t and t h e c e n t r a l p o i n t . Program: EYEBALL
Figure 4.6 Canoe R i v e r Val ley, 200 U n i t P r o f i l e Spac ing . Program: EYEBALL
Figure 4.7 Canoe River Valley, 500 Unit Profile Spacing. Program: EYEBALL
A perspec t ive view of a su r f ace must show only those a r e a s of t h e su r f ace
which would be seen by t h e eye. It is t h e r e f o r e necessary f o r any prc-
j e c t i o n r o u t i n e t o e l imina te those po r t ions of t h e s u r f a c e obscured by
s u r f a c e elements i n c l o s e t proximity t o t h e viewpoint. A su r f ace po in t
m y be def ined a s hidden i f and only i f a l i n e segment connecting the su r f ace poin t and the viewpoint i n t e r s e c t s t h e s u r f a c e a t some po in t .
Kubert, Szabo, and G i u l i e r i (17) o u t l i n e a n a lgor i thm f o r t h e cons t ruc t ion
of t h i s l i n e segment f o r each su r f ace element and t h e subsequent test f o r
i n t e r s e c t i o n s . EYEBALL e l imina te s hidden s u r f a c e elements by moving a
v i s i b i l i t y p r o f i l e through t h e s u r f a c e a t r i g h t ang le s t o t h e l i n e of
s i g h t and away from t h e viewpoint.
The main r o u t i n e of t h e EYEBALL system i s simply a program t o s t a r t t h e
ope ra t ion and t o s t o p it: CONVER. The EYEBALL system ope ra t e s on t h e
i r r e g u l a r d a t a s t r u c t u r e and performs t h e ope ra t ions a s fol lows:
1) The e n t i r e d a t a s e t i s f i r s t assigned new x, y coord ina tes by
transforming and r o t a t i n g the d a t a such t h a t t h e viewpoint
Sezones t h e new x, y o r i g i n and the c e n t r a i po in t i i e s on che
x a x i s , F igure 4 .8 . The z va lues (he ight ) a r e l e f t unchanged.
Any coord ina tes now r e f e r r e d t o w i l l be t he new coord ina tes .
i V' Figure 4.8 Rota t ion of Data S t r u c t u r e
2 ) Beginning a t e i t h e r ,
P) tile ~iiit~h~lum x vaiue, o r
i i ) one half t h e d ie tance from the viewpoint to t he c e n t r a l
po in t , whichever is g r e a t e r , cons t ruc t p r o f i l e s through the
d a t a s e t , a t r i g h t ang le s t o t h e x a x i s and of a user-defined
d i s t a n c e a p a r t .
These p r o f i l e s , Figure 4.9, a r e cons t ruc ted by f i r s t c a l c u l a t i n g
t h e endpoints , which a r e simply t h e i n t e r s e c t i o n p o i n t s of t h e
boundary of t h e da t a set w i t h a l i n e of given x p o s i t i o n and
i n f i n i t e y length , po in t s A and B of F igu re 4 . 9 . The coordin-
a t e s of t h e endpoints of t h e d e s i r e d p r o f i l e a r e then passed t o
SCHNET, which determines t h e i n t e r s e c t i o n p o i n t s of t h i s l i n e
w i t h t h e d a t a s e t and r e t u r n s t h e x, y, and z coo rd ina t e s of
t h e s e i n t e r s e c t i o n s . --
Figure 4.9 P r o f i l i n g of Data S t r u c t u r e
3 ) The p r o f i l e s o r e then pro jec ted onto a n imaginary p lane which
is cons t ruc ted between t h e c e n t r a l p o i n t and t h e viewpoint.
4 ) The p r o f i l e c l o s e s t t o t he viewpoint i s then c a l l e d the horizon
and i s t e s t e d a g a i n s t t h e second c l o s e s t p r o f i l e t o t h e view-
po in t t o s e e i f t h e second c l o s e s t p r o f i l e i s v i s i b l e . The
h ighes t vfs ibPe p o i n t s (of t h e horizon and t h e p r o f i l e ) then
become t h e new horizon, F igure 4.10. Th i s new horizon is then
compared t o t h e next p r o f i l e away from t h e viewpoint and a new
horizon can be formed. Each time a comparison is done t h e
rwwltant tuwiwoa Le ploc lgd , w h @ t h s ~ t t $a wtrtr@ly new ~f
j u s t the same a s t h e preceding horizon. This process cont inues
u n t i l t h e l a s t p r o f i l e , which is less than (by l e s s than one c e l l
width) o r equal t o t h e maximum x va lue of t h e d a t a set, has been
compared t o t h e next t o last horizon and has been p l o t t e d .
A l i s t i n g of t h e program EYEBALL may be seen i n F igure 1.3.
- Hovlxon
---- Prof i le
. N e w H o r l r o n
,-, H l d d e n S o c t l o n r
Figure 4.10 Horizon and P r o f i l e Comparison
Some of t h e p l o t s which r e s u l t from var ioue viewpoints being used wi th
EYEBALL a r e a s fol lows;
Above each p l o t i t is noted on o contour map the d i r e c t i o n from which
the v i e w was taken.
Fi gurc. 4.11 Canoe River Valley, Orthographic Pro j ect ion. Program: EYEBALL
F i g u r e 4 . 1 2 Canoe R i v e r V a l l e y , True P e r s p e c t i v e P r o j e c t i o n . Program: EYEBALL
Figu re 4.13 Canoe River Val ley , Or thographic P r o j e c t i o n . Program: EYEBALL
Figure 4.14 Canoe River Valley, True Perspective Projection. This view is of the north west half of the data structure only. Program: EYEBALL
I Viewing
I Direct ion v
Figure 4.15 Canoe River Valley, Orthographic Projection. Program: EYEBALL
Figure Number Descr ip t ion
4.11 Orthographic view of t h e su r f ace wi th 100 u n i t spacing
of t h e p r o f i l e s .
True pe r spec t ive p r o j e c t i o n wi th 100 u n i t spacing of
p r o f i l e s .
Orthographic view wi th 100 u n i t spacing of p r o f i l e s .
True pe r spec t ive p r o j e c t i o n of only ha l f t h e d a t a
s t r u c t u r e (nor th west corner only) w i t h 100 u n i t
spacing of p r o f i l e s .
4.15 Orthographic view wi th 100 u n i t spacing of p r o f i l e s .
Ana ly t i ca l H i l l Shading
The GREYSHDE system i s used f o r t h e c o n s t r u c t i o n of shaded r e l i e f models
of t h e s u r f a c e a s developed by Yoel i (31) . The method i s somewhat
s i m i l a r t o t h a t of Yoel i except t h a t Yoel i c a l c u l a t e s t h e shading of
u n i t squa re s of t h e d a t a set and GREYSHDE c a l c u l a t e s shading f o r e n t i r e
t r i a n g u l a r polygons of t h e d a t a s t r u c t u r e . The i r r e g u l a r d a t a s t r u c t u r e
being comprised of t r i a n g u l a r polygons would make i t imprac t i ca l t o
r e d i v i d e t h e s u r f a c e i n t o smaller r e g u l a r polygons s i n c e t h e r e s u l t a n t
g r i d c e l l s would be of t h e same s u r f a c e f u n c t i o n a s t h e l a r g e r t r i a n g l e s .
Thus t h e on ly p r a c t i c a l method by which t o shade t h e s u r f a c e is us ing
t r i a n g l e s .
A s Yoel i p o i n t s o u t i t is impossible t o c r e a t e a n exac t r e p r e s e n t a t i o n
of t h e e a r t h ' s r e l i e f on a map. However by i l l umina t ing a s u r f a c e w i th
a p o i n t l i g h t source and reproducing t h e shading which appears on t h e
su r f ace , a c l o s e approximation t o r e a l i t y may be r e a l i z e d . Yoel i beg ins
h i s d e r i v a t i o n of t h e t h e o r e t i c a l shading of a su r f ace by using Wiechel 's
equat ion f o r l i g h t i n t e n s i t y a t any po in t on a sur face .
cos (e ) = c o s (a) . c o s (b) + s i n ( a ) . s i n (b) . c o s (c )
In which:
e is the ang le between the l i g h t r a y and t h e normal t o t h e su r f ace
a t t h e po in t i n ques t ion .
b t h e s lope ang le of t h e su r f ace .
a t he complement of t h e ang le of s l o p e of t h e l i g h t r a y ,
c t h e ang le between t h e s u r f a c e and a p lane perpendicular t o t h e
l i g h t r ay .
Yoel i u ses vec tor a n a l y s i s t o apply t h e equat ion t o an a r e a element
deiined by two v e c t o r s i n t h e plane of i l l umina t ion . The v e c t o r s a r e
Then, assuming t h a t t h e l eng th of t h e l i g h t vec to r 8 ( l i g h t r ay ) is one
u n i t t h e equat ion
Sx(a b - a b ) + S (a b - axbZ) + SZ(a b - a b ) Y Z Z Y Y z x X Y Y X
cos (e) =
- a b ) 2 + (azbx - axbz)2 + (a b - a b )2 d ( a y b z . x Y Y x
is der ived . Th i s i s a s i m p l i f i c a t i o n of ~ i e c h e l ' s formula f o r t h e l i g h t
i n t e n s i t y of a r ec t angu la r s u r f a c e element.
A s mentioned above, i t would be imprac t i ca l t o d i v i d e t h e t r i a n g u l a r
polygons i n t o r ec t ang le s o r squares . Each t r i a n g l e of t h e i r r e g u l a r
d a t a s e t is defined by t h r e e edges o r vec to r s which a r e i n t he p lane
of t h e polygon they de f ine , thus any two edges of any p a r t i c u l a r 3 -+
t r i a n g l e can be thought of as the v e c t o r s a and b.
Given t h e coord ina tes of p o i n t s L, M and N i n F igure 4.16 a s ,
it i s a simple ma t t e r t o c a l c u l a t e t h e components of t h e v e c t o r s -b -t a and b.
I f t h e assumption is then made t h a t t h e l i g h t source i s i n t h e 0
northwest and a t an ang le of i n c l i n a t i o n of 45 t h e components
of t he vec tor may be e a s i l y found. Having found t h e va lues of
S S S *---"---- -.3 "L -+ -b
L V ~ C L W C L W L L L ~ the cclu~ponentcl uf a aid 3 , cos e m y be x' y' z solved f o r .
L
Figure 4.16 Vectors of a Typical T r i ang le
'Cos e ' is the va lue of t he l i g h t i n t e n s i t y over the given s u r f a c e
e l -men t - The l i g h t i n t e n s i t y over t h e s u r f a c e v a r i e s from whi te
wi th f u l l i l l umina t ion t o b lack wi th no i l luminat ion . F u l l
i l l umina t ion r e s u l t s when t h e ang le of i l luminat ion corresponds t o
t h e s u r f a c e normal wi th l i g h t r a y s h i t t i n g t h e sur face perpendicular ly
y i e ld ing a v a l u e of 1 .00 f o r cos e . When t h e sur face normal corresponds
t o t h e a n g l e of inc idence of t h e l i g h t r ay and is i n t h e same d i r e c t i o n
a s the l i g h t ray , t h e v a l u e of c o s e i s -1.00; however t h i s r a r e l y occurs
i n n a t u r e ( i . e . a n overhanging c l i f f , o r double valued s u r f a c e func t ion ) .
Surface s lopes f o r topographic s u r f a c e s a r e r a r e l y over fo r ty - f ive degrees,
which inc l ined away from t h e l i g h t r ay w i l l g ive cos e a va lue of 0.00.
Since f o r s lopes of over f o r t y - f i v e degrees away from the l i g h t ray , t h e
s u r f a c e would appear very heav i ly i n shade, a l l values of c o s e l e s s than
o r equal t o 0.00 may be considered a s black. Thus t h e range of cos e
from -1.00 t o 1.00 w i l l correspond t o a s u r f a c e shading range of b lack
to whi te wi th a l l c o s e v a l u e s l e s s than o r equal to zero having a b lack
shading. For t h e purposes of GREYSHDE t h i s range was d iv ided i n t o t e n
groups and ass igned shading symbols from a l i g h t grey t o black, F igure 4.17.
0 .1 . 2 .3 .4 .s .6 .7 . a .9 1.0
( I - cos e)
Figure 4.17 Shading Symbol Range
These symbols when used r e l a t i v e t o each o ther g ive a good impression
of surface relief and i r r e g u l a r i t y .
The a lgor i thm f o r GREYSHDE i s a s fol lows;
1) Read i n i r r e g u l a r da t a s t r u c t u r e .
2 ) C a l l TRIGLE, a subrout ine which forms t h e v e r t i c e s of a l l 1
t r i a n g l e s i n t o t h r e e one dimensional a r r a y s . For example,
i f t h e j t h t r i a n g l e encountered has t h e ve r t ex numbers of
12, 13, 14 then a r r a y one con ta ins 1 2 i n t he j t h p o s i t i o n ,
a r r a y two con ta ins 13 i n t h e j t h p o s i t i o n and a r r a y t h r e e
con ta ins 14 i n t h e j t h pos i t i on .
3 ) C a l l SHADE, a subrout ine which c a l c u l a t e s the grey shading
of every t r i a n g l e i n t h e d a t a s t r u c t u r e by t h e method
ou t l i ned above.
4) Using SCHNET c a l c u l a t e t h e x, y coord ina tes of t h e i n t e r s e c t i o n
p o i n t s of t he da t a s t r u c t u r e and a l i n e of cons tan t y va lue
passed through the d a t a s t r u c t u r e from minimum x t o maximum x.
The s t a r t i n g , o r i n i t i a l , y va lue of t h e l i n e is t h e maximum
y va lue of t h e da t a .
5 ) Moving from t h e minimum x va lue of t h e i n t e r s e c t i o n p o i n t s
found, t o t h e m a x i m u m , p a i r t h e i n t e r s e c t i o n p o i n t s a s fol lows;
( l s t , 2nd), (2nd, 3 r d ) , (3rd, 4 t h ) , . . . . . . . . , ( (n - l ) s t , n t h ) .
6 ) Calcu la t e t h e x coord ina te of t h e midpoint of each p a i r and
determine w i t h i n which t r i a n g l e of t h e da t a s t r u c t u r e each
midpoint l i e s .
7) Assign t h e shading va lues of t h e app ropr i a t e t r i a n g l e s t o t h e
s e c t i o n s of t h e l i n e represented by each i n t e r s e c t i o n p a i r .
Therefore, from the f i r s t i n t e r s e c t i o n po in t t o t h e second
i n t e r s e c t i o n po in t t h e l i n e w i l l be assigned a shading va lue
of t he t r i a n g l e wi th in which the l i n e between t h e i n t e r s e c t i o n
p o i n t s l i e s .
8) Assemble and output a l i n e of p r i n t ( fo r t h e l i n e p r i n t e r ) ,
each cha rac t e r of which i s based upon t h e shading va lue i t i s
t o r ep re sen t , Figure 4.17.
9) Decrease t h e y va lue of t h e l i n e ( a s ca l cu la t ed i n 4) by a
c e r t a i n i n t e r v a l and c a l c u l a t e t h e i n t e r s e c t i o n p o i n t s of
t h i s l i n e wi th the d a t a s t r u c t u r e .
10) Go back t o s t e p 5) and cont inue t h i s process u n t i l t he minimum
y va lue of t h e da t a s t r u c t u r e i s encountered by t h e l i n e moving
downward through the s t r u c t u r e .
A l i s t i n g of t he GREYSHDE program may be seen i n F igure 1 .4 . The product
of GREYSHDE is a shaded r e l i e f map (Figure 4.18) which is a d i s p l a y of a
much more genera l n a t u r e than e i t h e r t h e contour map o r t h e pe r spec t ive
view. However, the shaded r e l i e f map does c a r r y information of a much
higher l e v e l and c o n s t i t u t e s g e n e r a l i t i e s r a t h e r than p a r t i c u l a r s .
F i g u r e 4.18 Canoe R i v e r V a l l e y , Shaded Relief Map. Program: GREYSHDE
CHAPTER V: CONCLUSION
Nearly every field of academic work has felt the impact of the
computer. With its extensive storage facilities, rapid access to
data and high speed of calculation the computer has the possihility
of revolutionizing cartography. As a communicative process, the
object of cartography is to convey to an independant observer as
much information concerning a geographic area or spatial phenomena
as is possible. Information is generally lost at each of three stages
within the process; collection, storage and display. This thesis
has been an endeavor to illustrate how, with an alternative approach
to data collection, and through implementation of the addressing
facilities offered by the computer, retention of information can
be maximized throughout the process. The approach recommended as
an alternative to reguiar grid collection and/or storage is that of
collection of surface specific points and storage of the absolute
coordinates of these points and their spatial relationships to
neighbours with a linked list data structure.
One important innovation of the data structure developed is its
ability to convey and retain information about the relation between
surface specific points. This is important because a surface function
is dependant upon the relation and interaction between points for
the majority of surface information. A regular grid will of course
yield this information, however the amount of necessary surface data
must be increased along with the processing time. The linked list
data structure appears, by the tests run thus far, to maximize inform-
ation retention while saving on data storage space and processing time.
The systems for the dfsplay of the irregular data structure have been
designed to give the user flexibility in viewing the surface. From
t h e f i l t e r e d o r smoothed r e p r e s e n t a t i o n a f fo rded by GREYSHDE t o t h e
minute i s o l i n e d e t a i l of ISOKONT, the use r may choose the amount of
information t o be displayed. GREYSHDE, through use of t h e t r i a n g l e ,
o r neighbourhood, a s t he lowest l e v e l d a t a i tem, f i l t e r s o r channels
t h e information i n t o groups, g iv ing t h e u s e r i n s i g h t t o t h e r e l a t i o n -
s h i p s of neighbourhoods. GREYSHDE g ives no a b s o l u t e s u r f a c e va lues ,
only the s u r f a c e func t ion r e l a t i o n s . EYEBALL a l lows t h e use r t o view
t h e s u r f a c e from a n o w 1 pe r spec t ive , aga in no a b s o l u t e s p e c i f i c s
of t h e s u r f a c e appear on the reproduct ion , on ly t h e r e l a t i o n s h i p s
between neighbourhoods. However, t h e s e r e l a t i o n s h i p s may be f u r t h e r
enhanced by a change of p r o f i l e d e n s i t y , a change of viewing p o s i t i o n
o r a change of p ro j ec t ion . The most d e t a i l e d d i s p l a y i s given by
ISOKONT, wi th t h e use r d i c t a t i n g t h e amount of in format ion t o be on
t h e f i n i s h e d p l o t simply through adjustment of t h e contour i n t e r v a l .
These systems a l low t h e information of t h e s u r f a c e s p e c i f i c p o i n t s
r e l a t e d through p o s i t i o n t o be p l o t t e d w i t h a h igh degree of in format ion
r e t e n t i o n . The d i s p l a y s are, a s = e a r l y a s p o s s i b l e , t h a t in format ion
which has been c o l l e c t e d , no l o s s can b e a t t r i b u t e d t o s t o r a g e o r
ou tput (d i sp l ay ) techniques.
The p r i n c i p l e s developed i n t h i s t h e s i s should s e r v e a s a b a s i s t o
ongoing r e sea rch f o r t h e development of e f f i c i e n t geographic d a t a
s t r u c t u r e s . Geography, be ing a s tudy of dynamic phenomena, needs d a t a
s t r u c t u r e s capable of handl ing eve r changing s p a t i a l d i s t r i b u t i o n s .
Data s t r u c t u r e s which a r e a b l e t o cope w i t h t h e i n t e r a c t i o n s and i n t e r -
r e l a t i o n s h i p s between groups of d a t a . The d a t a s t r u c t u r e h e r e i n
developed may not be capable of s o l v i n g t h e s e problems b u t should
h e l p i n t h e development of new s t r u c t u r e s ; i f on ly t o p o i n t ou t a
need f o r development.
APPENDIX I: PROGRAMS AND SUBROUTINES
The t h r e e d i s p l a y r o u t i n e s o u t l i n e d i n Chapter I V were dependant upon
numerous sub rou t ines f o r t h e i r e f f i c i e n t ope ra t ion . One of t h e s e was
of major importance and w i l l be d iscussed i n some d e t a i l wh i l e t h e
r e s t a r e s e l f explanatory and may be seen i n F igure 1 - 2 t h r u F igure 1.23. I
SCHNET is a r o u t i n e f o r searching and developing a pa th through t h e
i r r e g u l a r d a t a s t r u c t u r e . The pa th chosen by SCHNET i s based on s e v e r a l
p o s s i b l e c r i t e r i a , one of which must be suppl ied by t h e invoking program.
The fo l lowing c r i t e r i a were chosen f o r SCHNET;
a ) The pa th of t h e J t h i s o l i n e - f i n d t h e i n t e r s e c t i o n p o i n t s
of a pa th c r ea t ed by a p lane of he igh t J i n t e r s e c t i n g t h e
d a t a s t r u c t u r e . SCHNET w i l l r e t u r n t h e x , y coo rd ina t e s of
t h e i n t e r s e c t i o n p o i n t s .
b ) The pa th of a v e r t i c a l p l ane - f i n d t h e i n t e r s e c t i o n p o i n t s
of a v e r t i c a l p lane pass ing through t h e d a t a s t r u c t u r e ,
SCHNET w i l l r e t u r n t h e x, y , z coord ina t e s of t h e pa th .
See F igure 1.1.
c ) The d a t a p o i n t c l o s e s t t o a given x , y coord ina te . Given
any x, y coord ina te , p r e f e r a b l y w i t h i n t h e d a t a s e t boundaries ,
SCHNET w i l l r e t u r n t h e l a b e l of t h e d a t a p o i n t which i s c l o s e s t
t o t h i s p o i n t .
The pa th fo l lowing a lgo r i thm f o r a network was f i r s t developed by
Dayhoff (9) and used f o r contour ing a r e g u l a r g r i d p a t t e r n i n X-Ray
c rys t a l log raphy . The a lgor i thm, a s used by,SCHNET, i s b a s i c a l l y t h e
same a s Dayhoff 's except t h a t minor changes have been made t o accommodate
both a new d a t a s t r u c t u r e and t h e c r i t e r i a of a v e r t i c a l p lane .
B a s i c a l l y SCHNET t e s t s each edge i n a sys temat ic manner f o r an i n t e r s e c t i o n
wi th t h e pa th . A few d e f i n i t i o n s a r e necessary p r i o r t o a complete
d e s c r i p t i o n of t h e algori thm:
RP - r e f e rence po in t , normally t h e major node of t h e edge being
t e s t e d . Swinging always occurs around t h e RP.
SP - sub p o i n t , is the secondary node of t h e edge t h a t i s being
t e s t e d . Always t h e changing p o i n t , o r t h e po in t which i s
be ing changed i n t h e swinging procedure.
EP - edge p o i n t , is t h e p o i n t which i s being c a l c u l a t e d a s t h e
i n t e r s e c t i o n between t h e pa th and t h e edge def ined by t h e
nodes RP and SP.
The a lgor i thm f o r SCHNET is;
SCHNET i s passed, from t h e invoking procedure, t h e f i r s t
RF t o be used, t h e va lue of which i s dependant upon the
c r i t e r i a chosen. For t h e c r i t e r i a of fol lowing a contour
pa th , RP i s chosen a s any d a t a p o i n t which i s above t h e
va lue of t h e contour l e v e l (pa th t o be followed) bu t has
no t been e l imina ted due t o subsequent process ing ( see
write-up of ISOKONT). For t h e c r i t e r i a of fol lowing t h e
pa th of a v e r t i c a l p lane ( s t r a i g h t l i n e ) RP i s chosen a s
t h e d a t a p o i n t c l o s e s t t o one end of t he v e r t i c a l p lane
( i . e . t h e v e r t i c a l p lane becomes a l i n e i n t h e x, y p lane
def ined by two p o i n t s a t t h e ends of t h e l i n e 1 This po in t
may be found wi th a subsequent c a l l t o SCHNET us ing c r i t e r i a
c ) from above. For t h e c r i t e r i a of f i n d i n g t h e d a t a p o i n t
c l o s e s t t o a g iven x, y coo rd ina t e l o c a t i o n t h e RP used ,ay
be t h e l a b e l of any d a t a p o i n t .
2) SP i s chosen as t h e d a t a p o i n t po in ted t o by t h e f i r s t
( s e q u e n t i a l l y measured) p o i n t e r i n RP'S p o i n t e r l i s t .
3) The edge formed by RP - SP i s checked f o r an i n t e r s e c t i o n
(EP) wi th t h e pa th . )
4) a ) i f one e x i s t s i t i s c a l c u l a t e d and s t o r e d . SP i s then
s e t t o t h e d a t a va lue pointed t o by t h e next ( s e q u e n t i a l l y )
po in t e r i n RP's p o i n t e r l i s t - 3) i s repea ted un le s s of
course t h e next p o i n t e r i n RP's l i s t i s zero o r blank - i n d i c a t i n g t h a t a l l RP's neighbours have y i e lded i n t e r s e c t i o n
p o i n t s . Which f o r t h e contour pa th i n d i c a t e s a c losed
cont inuous contour around RP i n which c a s e c o n t r o l i s re turned
t o t h e invoking procedure. For t h e v e r t i c a l p lane c r i t e r i a
t h i s i s impossible un le s s of course RP is on a boundary of
t h e d a t a s e t and then one of RP's p o i n t e r s would have a va lue
of 32000 which would i n d i c a t e t o SCHEJET t h a t t h i s cond i t i on
may occur and t o check f o r i t .
b) i ) i f no EP i s found, and, no EP has y e t t o be found
f o r t h i s p a r t i c u l a r RP, then SP i s s e t t o t h e d a t a va lue
poin ted t o by t h e next ( s e q u e n t i a l l y ) p o i n t e r of RP's p o i n t e r
l i s t . 3) i s repea ted u n l e s s of course t h e next p o i n t e r i n
RP's l i s t is zero o r blank.- i n d i c a t i n g t h a t a l l RP's neighbours
have been checked and found t o y i e l d no pa th i n t e r s e c t i o n s .
Control i s r e tu rned t o t h e invoking r o u t i n e which must g ive
SCHNET a new RP.
i i ) But, i f no EP i s found and one was found f o r t h e l a s t
SP ( i . e . 4a was performed f o r t h e l a s t p o i n t e r i n RP1s l i s t )
then 6 i s performed.
6 ) RP is s e t t o t h e d a t a va lue of SP and SF i s s e t t o t h e d a t a
va lue poin ted t o by t h e p o i n t e r i n t h e new RPls l i s t immediately
fo l lowing t h e p o i n t e r t o t h e o l d RP.
7) The edge RP - SP is checked f o r an EP. One must e x i s t s i n c e
t h e pa th has en tered t h e t r i a n g l e and un le s s i t stopped i n s i d e
t h e t r i a n g l e ( t h e end of a s t r a i g h t l i n e ) i t must l eave t h e
t r i a n g l e through t h i s s i d e ( s ince i t d i d no t l eave through
t h e s i d e def ined by the nodes o l d RP, SP.
8) SP i s s e t t o t h e d a t a va lue poin ted t o by t h e next p o i n t e r i n
RP's l i s t .
9 ) Go back t o s ta tement 3 ) .
This process of swinging through RP's and SP's w i l l cont inue u n t i l one
of t h e s topping mechanisms i s encountered. The s topping mechanism f o r
a contour pa th could be one of two cond i t i ons ;
a ) t h e contour i s a continuous c losed curve which even tua l ly
returns cc the initial R?.
b ) t h e contour encounters one of t h e boundaries of t h e da ta s e t
and must s t o p , i n which case SCHNET t r a n s f e r s t h e pa th fol lowing
procedure back t o t h e beginning of t h e pa th a t t h e i n i t i a l RF.
SCHNET then cont inues t o fo l low t h e pa th i n t h e oppos i t e d i r e c t i o n
u n t i l ano the r border i s reached i n which c a s e t h e c o n t o u r has
been completed and c o n t r o l i s r e tu rned t o t h e invoking procedure.
The s topping mechanism f o r a s t r a i g h t l i n e may be one of two events
occuring
a ) a boundary of t h e d a t a s e t i s reached, b u t s i n c e t h e i n i t i a l RP
was one end of t h e l i n e o r where t h e l i n e en t e red t h e d a t a s e t
a l l i n t e r s e c t i o n s have been found and c o n t r o l i s r e tu rned t o
t h e invoking procedure.
b ) an end p o i n t of t h e l i n e h a s been reached and s i n c e t h e i n i t i a l
RP was one end of t h e l i n e o r where t h e l i n e en t e red t h e d a t a s e t
I ,
Figure I. 1 Vertical Plane Through the Data St rur- t tlrl , S(;;?J'' o ~ ~ ~ z ~ - i t ' on the data structure and the vrr t l r:i ; 4 ' : intersection points o f i'ne t - r w
c o n t r o l is re turned t o t h e invoking procedure.
A sample SCHNET run a s i l l u s t r a t e d i n F igure 1.1 i s a s fo l lows;
I n i t i a l l y RP i s 1
I
None
H
G
F
None
E
None
D
C
None
l3
A
None
The f i n a l SP being 32000 i n d i c a t e s t o SCHNET t h a t a border has been
reached. The va lues of EP as i n t e r s e c t i o n coord ina t e s a r e then
r e tu rned t o t h e invokipg procedure.
The l i s t i n g f o r SCHNET may be seen i n ~ i ~ u r e I - 7 t h r u F igure I. 11 .
T11e programs of t h e d i s p l a y system u s e t h e s u b r o u t i n e s a s f o l l o w s ;
I SOKONT
CONVER
CENTRE
ROTATE
STRIP
SCHNET
SORTER
RIDGE I
PLOTS 2
FACTOR 2
MAXMIN
CENTRE
TRIGLE
SETIS
RESET
SHADE
POINTS
S CHNET
STRIP
OUTSID
PNPOLY l
MAXMI N
SORTER
T h e s u b r o u t i n e SCHNET always u s e s t h e f o l l o w i n g s u b r o u t i n e s ;
SCHNET
WORK1
BORDER
PLOTS
FACTOR^ PLOT^ NUMBER^
LAND
LOR
ANGFND
MARKIT
1 Douglas, David, H . "Graphic and C a r t o g r a p h i c :~ \ l I>ro i~ t in t> J I ;- t n;" unpubl i shed b u t used f o r t e a c h i n g purposes a t 'l'i,c, i ~ i l i v r ~ r ~ i t v r ) ' r i I . . . .
2 S o f t w a r e s u b r o u t i n e p a c k a g e I ,,r S iiri).r, T 's 7:;rJ1- ? ' I 1 1 ' , + $1 I % I : i
I SO
KO
IIT:
PR
OC
O
PT
IOtI
S(l
~,?
lfl)
; /
TH
lS P
RO
GnA
ll 1
5 D
ES
ltiE
D
FC
R
TI?
E D
RA
\IIt
:G
OF
CO
P:TO
UR
M
AP
S
OF
D
AT
A
STO
RE
D
111
A'i
I RR
EG
ULA
F! I
IAN
NE
R
;\ti0
T
RI A
rIG
ULA
TE
D.
I!!PU
T:
(ON
TH
E
FlL
E S
YS
ll:)
C
OL
1-
5
CO
L 6
-10
CO
L 11
-15
CO
L 1
6-2
0
CO
L 2
1-2
5
CO
L 2
6-3
0
CO
L 3
1-3
5
Tii
E
:;Ut.:
BER
OF
DA
TA
P
OI?
ITS
IN
Tii
E
IXP
UT
D
AT
A
SE
T
lt;C
Llj3
1 ::C
9C
t:XY
P
OIN
TS
, (I. E
. T,
?E
TO
TA
L K
VX
BE
R
OF
DA
TA
P
OIi
ITS
TO
B
E
CO
NS
IDE
RE
D
FOR
T
HE
MA
P)
AS
A
t;
IYT
EG
EJ
f.'U
llBER
. T
HE
t!U
:(BC
R
OF
DA
TA
P
OI ;
JTS
It1
TH
E l N
PU
T
DA
TA
S
ET
E
iI!IU
S
TH
E
NU
1:BE
R
OF
D
UH
I4Y
PO
It:T
S,
AS
A!.
I IN
TE
GE
R
:IUI!B
ER
. T
tIE
t:
l:IIt
-IC
t!
Z 'V
ALU
E
IN T
HE
D
AT
A
SE
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
C
AL
L
PLO
T(X
OU
T,0.
0,3)
R
ET
UR
N
EN
D
Fig
ure
1
.23
W
OR
K1
and
B
OR
DER
APPENDIX T I : A SAMPLE DATA STRUCTURE
A sample d a t a s t r u c t u r e was prepared f o r t h e topographic s u r f a c e of
t h e Ptarmigan Creek a r e a of Canoe River v a l l e y l oca t ed i n c e n t r a l
B r i t i s h Columbia (F igure 4 . 1 ) . This i s a good s u r f a c e f o r tests of
t h i s d a t a s t r u c t u r e s i n c e i t c o n s i s t s of r e g u l a r s u r f a c e f u n c t i o n s
i n t e r s p e r s e d wi th i r r e g u l a r func t ions . The r i v e r bottom i s a w e l l
def ined g e n t l y s lop ing p l a n e w i t h t h e s i d e s of t h e v a l l e y breaking
s h a r p l y from t h e bottom and r i s i n g t o i r r e g u l a r peaks. Surface
s p e c i f i c p o i n t s were chosen from t h e s u r f a c e a s p o i n t s r e p r e s e n t a t i v e
of changes i n neighbourhoods. A t r i a n g u l a t i o n of t h e s e p o i n t s was
c a r r i e d o u t wi th t h e c r i t e r i a f o r t r i a n g l e formation being t o minimize
t h e d i s t a n c e between t h e t r i a n g u l a r p l ane and t h e r e a l s u r f a c e
(F igure 3.3). The v e r t i c e s of t h e t r i a n g l e s were numbered from one
through e i g h t y one a s shown i n F igure 11.1. Following t h e r u l e s
o u t l i n e d i n CHAPTER 111 t he d a t a were recorded i n t h e format
The f i n i s h e d d a t a s t r u c t u r e , ready f o r u s e w i t h t h e d i s p l a y r o u t i n e s ,
is shown i n Figure 1 1 . 2 . This s t r u c t u r e c o n s i s t s of e i g h t y one r e a l
d a t a p o i n t s and e i g h t dummy d a t a p o i n t s ( i . e . e i g h t r e a l p o i n t s have
more than seven p o i n t e r s ) . This d a t a s t r u c t u r e was used t o produce
a l l t h e example g raph ic s of t h e d i s p l a y system o u t l i n e d i n t h i s t h e s i s .
C8
Figure 11.1 Irregular Data Structure. The triangulated surface specific points ready for recording the data.
14
50
. 2
10
0.
20
50
. 2
20
0.
22
00
. 1
50
0.
12
50
. 1
55
0.
15
50
. 1
20
0.
16
00
. 1
35
0.
65
0.
65
0.
85
0.
80
0.
95
3.
95
0.
11
90
. 6
50
. 8
50
. 8
DO
. 7
00
. 3
50
. -3
50
. 3
00
. 5
00
. 4
50
. 1
50
. 0.
0.
0.
0.
'
0.
0.
0.
0.
66
00
. 7
00
0.
Figure 11.2 Records of the Data Structure
1 . Abramson , N. In fo rmat ion Theory and Coding, New York: McGraw-Hill Book Co., I n c . , 1963, pp . 1-39
2. Agterberg , F. P. "Computer Techniques i n Geologq" E a r t h Sc ience Review, Vo1.3, 1967, pp. 47-77
3 . Armand, A.D.
4. B e r y l a n t , A.M.
5 . Board, C.
6. Board, C .
7 . Codd, E.F.
8 . Connel ly , D.S.
9 . Dayllof f , M.O.
"The A p p l i c a t i o n of I n f o r m a t i o n Theory t o Geographical D i v i s i o n i n t o Areas," i n Mathemat ical Methods and Modern Geography, U. S. S .R. : Kazan U n i v e r s i t y , 1972 pp. 114-125
"Vaps of 1 n t e r r e l a t . i o n s and T h e i r A p p l i c a t i o n i n ~ e o g r a ~ h i c Research:' S o v i e t Geography, Review and T r a n s l a t i o n , Vo1.13, 1972, pp. 472-481
1967, "Maps as Models," i n Chorley, R. J . , and P.Hagget t , Models i n Geography, London: Methuen & Co., L t d . , 1970, pp. 671-725
"Car tograph ic Communication and S t a n d a r d i z a t i o n ; ' I n t e r n a t i o n a l C a r t o g r a p h i c A s s o c i a t i o n P r o c e e d i n g s , l 9 7 2
"A R e l a t i o n a l Model of Da ta f o r Large Shared Data Banks,'' Communications of t h e ACM, ~ 0 1 . 1 3 , No. 10, June 1970, pp. 377-387
"The Coding and S t o r a g e o t T e r r a i n Height Data: An I n t r o d u c t i o n t o Numerical Cnrtogr;lphy," F1 .Sc . ' I ' l~esis, Corncl l U n i v e r s i t y , Septcmbcr, 1968
, "A Contour-Pap I'rogr;riil l o r X-Ikly Crys l ; l 1 l of:rnpl~y," ,
Con~muni c;t t ions o f t hc A(:M, V o 1 . 6 , No. 1 0, Oc to1)c.r - -- 1963, pp. 620-622
10. Dodd , George, C. "Elements of Data Yanagement Systems," Computing Surveys , Vol . l , No.2, June 1969, pp. 117-133
11. Douglas, David H. and T.K.Peucker "Algorithms f o r t h e Reduction of t h e Number of P o i n t s Required t o Represen t a D i , g i t i z e d L ine o r i t s Car icature ," The Canadian C a r t o g r a p h e r , Vol.10, No.2, December 1973, pp. 112-122
12. Gokhman, V .M. and M.M.Mekler "The Inf o rmat ion Theory and Thematic Cartography," i n Mathemat ical Methods and Modern - Geography, U.S.S.R.: Kazan U n i v e r s i t y , 1972, pp.99-i13
13. Hamil ton, J . A . A Survey of Data S t r u c t u r e s f o r I n t e r a c t i v e Graph ics , Rand Corp. Memorandum, RM - 6145 - ARPA, A p r i l 1970
14. Johnson, R.E. and F.L.Kiokemeister Ca lcu lus w i t h A n a l y t i c Geometr- , 3 rd e d i t i o n . Boston: Al lyn and Bacon, I n c . , 1964
15. Kadar, I . and F.Karsay The More P r o f i t a b l e S t o r i n g and T r a n s f e r r i n g P o s s i b i l i t i e s of t h e I n f o r m a t i o n Content of t h e M ~ D . Budapest : I n s t i t u t e of Survey ing , 1969
16. Knuth, Donald, E. The A r t of Computer Programming, Volume 1/ Fundamex+al Algorithms. R e a d i n ~ , Massacbusettn: ~ T i s o n - ~ e s l e ~ Publishing Co., 1968
1 7 . Kubert, B. , J . Szabo, and S. G i u l i e r i "The Pe r spec t ive Representat ion of Funct ions of Two Var iab les , " Journa l of the Assoc ia t ion f o r Computing Machinery, Vo1.15, No.2, A p r i l 1968, pp. 193-204
18. Lawson, H.W. "PL/1 L i s t Processing," Communications of t he ACM, Vol.10, No.6, June 1967, pp. 358-367
19. Marchand, Bernard q'Information Theory and Geography," Geographical Analysis , Vol.IV, No.3, J u l y 1972, pp. 234-257
20. McIntyre, Donald, B. , David D . P o l l a r d , and Roger Smith Computer -
Programs f o r Automatic C o n t o u r i q , Computer Cont r ibut ion 23, Edi tor Daniel F. Merriam, S t a t e Geological Survey, The Univers i ty of Kansas, 1968
21. Peucker, Thomas, K. Computer Cartography, Commission on College Geography Resource Paper No. 17, ~ s s o c i a t i o n of American Geographers, Washing ton, D .C . : 1972
22. Peucker, Thomas, K. Computer Cartography, A Working Bibliography, Discussion Paper No. 12 , Department of Geography, Univers i ty of Toronto, August 1972
23. P ren te r , P.M. Sp l ines and V a r i a t i o n a l Methods, Manuscript, t o be publ ished, 1975
24. Ra ta j sk i , L. "The Research S t r u c t u r e of Theore t i ca l Cartography," Paper, 6 t h Annual I n t e r n a t i o n a l Cartographic Assoc ia t ion Conference, Montreal - Ottawa, 1972
25. Rayner, J . N . An In t roduc t ion t o Spec t r a l Analysis , No.2, Monographs i n S p a t i a l and Environmental Systems Analysis , London: Pion, 1971
26. Sukhov, V . I . "Application of Information Theory i n Genera l iza t ion of Map Contents, '' ~ n t e r r a a t i o k l Yearbook of Cartography, V01.10, 1970, pp. 40-47
27. Thrower, Norman, J . W . Maps and Man, Englewood C l i f f s , New Jersey: Prenrice-Hall , I nc . , 1972
28. Tobler , Wa ddo , R . "Geographical F i l t e r s and t h e i r Inve r se s , I t
Geographical Ana lys i s , Vol.1, 1969, pp. 234-253
29. Warntz, W. '!The Topology of a Socio-Economic Te r r a in and S p a t i a l -. -
~ l o w s , " Papers , Regional Science Assoc ia t ion , io1.17, 1966, pp. 47-61
30. Williams, R . "A Survey of Data S t r u c t u r e s f o r Computer Graphics Systems," Computing Surveys, Vo1.3, No.1, March 1971, pp. 1-21
31. Y o z ~ ~ , P. " A m l y t i c a l Xi11 Shading, I' Surveying and Mapping, December 1965, pp. 573-579
32. YoeEi, P . "Analy t ica l H i l l Shading and Densi ty ," Surveying and Mapping, June 1966, 573-579
33. Yoel i , P. "The Mechanization of A n a l y t i c a l H i l l Shading," The Cartographic Jou rna l , Vo1.4, 1967, pp. 82-88