]> www.wagner.pp.ru Git - sites/home_page.git/blob - geography/fGIS/concepts.html
Added fGIS
[sites/home_page.git] / geography / fGIS / concepts.html
1 <HTML>
2 <HEAD>
3 <TITLE>
4 f(GIS) concepts
5 </TITLE>
6 </HEAD>
7 <BODY>
8 <H1><FONT SIZE="+3"><I>f(</I></FONT><FONT SIZE="+2"><B>GIS</B></FONT><FONT SIZE="+3"><I>)</I></FONT>
9     concepts</H1>
10
11 <!-- CONTENTS NUMBERED NESTED --><OL>
12 <LI><A HREF="#toc_section0">Data model</A>
13 <OL>
14 <LI><A HREF="#toc_section1">Functional model</A>
15 <LI><A HREF="#toc_section2">Layer classification</A>
16 <LI><A HREF="#toc_section3">Implementation of data model</A>
17 <LI><A HREF="#toc_section4">Regions and chartographic projection</A>
18 </OL>
19 <LI><A HREF="#toc_section5">Program design</A>
20 <OL>
21 <LI><A HREF="#toc_section6">Layer as Tcl object</A>
22 <LI><A HREF="#toc_section7">Planchet - object for displaying maps</A>
23 <LI><A HREF="#toc_section8">Drawing modes for raster layer</A>
24 <LI><A HREF="#toc_section9">Low level objects</A>
25 <LI><A HREF="#toc_section10">GIS operation</A>
26 <LI><A HREF="#toc_section11">Utilities</A>
27 <LI><A HREF="#toc_section12">Data access library</A>
28 </OL>
29 </OL>
30 <!-- END CONTENT -->
31
32
33
34
35
36 <A NAME="toc_section0"></A><H3>Data model</H3>
37
38 GIS is a software system for processing spatial data. So, adequate model
39 of spatial phenomena is most important thing for GIS. 
40 <P>
41 It should provide way to represent spatial phenomena in computer memory,
42 allow to perform desired operation on this representation and let user
43 see the results in form, he used to. Ideally, GIS system should hide
44 complicated issues of internal data storage from user as well as text
45 processor hides questions of font rendering or kerning or SQL database
46 hides actual file layout and search technologies, providing simple,
47 but powerful relational operations instead.
48 <P>
49 Many modern
50 GIS systems, especially vector based, like ARC/Info, try to 
51 represent map of spatial phenomena rather than spatial phenomena
52 itself. It leads to overcomplication of storage format and processing
53 algorithms, and makes user worry about such technical things as polygon
54 topology, which are completely irrelevant to his problem (say geology
55 or soil science), as font rendering hints and kerning is irrelevant to
56 contents of article, typesetted with some partcular font. Maps are
57 tool for analyse spatial data, widely used, but no more than tool.
58 GIS system should deal with them, becouse it is neccesary to use
59 existing data, which are represented on maps, and present results to
60 user in understandable form of maps, but while processing data we should
61 take into account properties of actual phenomena, rather then properties
62 of chartographic representation like polygons.
63 <P>
64 <A NAME="toc_section1"></A><H4>Functional model</H4>
65
66 In f(GIS) we use term <I>layer</I> to denote computer representation of
67 spatial phenomena. We define layer as function which maps geographical
68 coordinates to value of some property. Closest analogue of our
69 <I>layer</I> is <I>spatial variable</I> in geostatistics.
70 <P>
71 Layer values can be either real numbers or elements of some finite sets.
72 If you want to study more complicated spatial phenomena, it is better
73 to describe it as set of layers rather then individual layer with
74 structured value. Obvoisly you'll not need values of all attributes in
75 question for all desired calculations, and separating them makes your
76 actions more clear.
77 <P>
78 Becouse layers are defined as functions it is theoretically possible to
79 apply well develped mathematical apparatus of functional analysis to
80 them.
81
82 <A NAME=layerclass></A>
83 <A NAME="toc_section2"></A><H4>Layer classification</H4>
84 Layers can be classified by their area of definition and their set of
85 values. By area of definition we can distinguish between:
86
87 <DL>
88 <DT> Two-dimensional layers
89 <DD> which are defined on some contineous area.
90   It is most frequently used type of layers for physical geography. 
91   Relief and soil type are perfect examples of such layers. Area of
92   definition of two-dimensional layers is usially finite, limited by
93   boundaries of study area or by availability of data. Areas which are
94   outside of area of definition are called <I>offsite</I> areas.
95 <DT> One-dimensional layers
96 <DD>  are defined on set of lines within study area. Examples of such
97    layers are hydrography or railroad network.
98 <DT> Zero-dimensional layers
99 <DD> are defined on set of separate points. This layers can be used
100   for store information about sampling points or weather station
101 networks.
102 </DL> 
103
104 By the set of values layers can be classified to:
105 <DL>
106 <DT>Numeric layers
107 <DD> whose values belong to some contineous interval on numeric axis,
108 for example relief layers, which have any value between lowest and
109 highest altitude in the study area.
110 <DT>Classification layers
111 <DD>which have finite set of values. f(GIS) allows to use arbitrary
112 strings as elements of such set. Soil map which has names of soil series
113 as values can be used as an example.
114 </DL>
115
116 This simple classification covers all theoretically important types of
117 layers. Dealing with implementation we'll have to classify layers
118 further, for example, according to source of thematic data. But for 
119 data analysis it is not significant whether data are stored in disk
120 file or come from some data asquition system on the fly. It is only
121 important to know type of values and whether they are defined for
122 any point of study area or not.
123
124 <A NAME="toc_section3"></A><H4>Implementation of data model</H4>
125
126 Spatial phenomena seldom can be expressed by some mathematical equation.
127 Even if they can, finding of this equation is usially aim of analysis,
128 not a starting point. So, we need to store values of layers in any
129 point they are defined. Raster is natural way to store data for 
130 two-dimensional layers.<P>
131 <FONT SIZE=-2> (Raster is just big matrix of numeric values, stored 
132 in special format to reduce storage space. If raster is used in GIS
133 processing, it should be known, how to find row and column numbers given
134 real word coordinates and vice versa)</FONT>
135 <P>
136 f(GIS) uses raster data format developed for EPPL7 GIS system. This
137 format have several advantages - it is compressed and allows random
138 access at the same time and it is able to deal with very fine
139 resolution. For example Landscape map of exUSSR with spatial resolution
140 (raster cell size) 500m and more than 3000 distinct kinds of landscapes
141 occupies about 9MB of disk space. Due  to such properties of data
142 format, it is advisable to work with raster cell size significantly less
143 then known accuracy of data. Resolution of maps can be compatible with
144 resolution of your scanner and printer - modern processors are powerful
145 enough to bear it, so raster doesn't mean loss of precession.
146 <P>
147 This data format is able to hold values in range 0..65535. While it is
148 always sufficient for classification layers, it can look that for
149 numeric layers it is better to use real numbers. But data always have
150 finite accuracy, which is usially less than 1/65535 of total range,
151 and even if we can take measurements with larger precession, we should
152 take into account spatial variability within one raster cell.
153 <P>
154 For example, if we have map of relief of Russia with 500 meter cell, 
155 we need to represent range from -28 (Caspian coast) to 5642 (Elbrus)
156 meters above sea level. Thus smallest usable unit is about 10 cm.
157 Some points' altitude may be measured with more accuracy (for example,
158 triangualtion points), but each raster cell represents 500x500 meters
159 square which always would have more than 10cm of variability.
160 Even if value of our layer should have more precession in some part
161 of its range, we could use non-linear (for instance logarithmic) mapping
162 of raster cell values to layer values.
163 <P>
164 But even with compression, raster files occupy significant storage
165 space. So, we should avoid duplication of them if possible. Thus we 
166 introduce concept of <I>reclass tables</I>. Reclass table maps values
167 of raster cell to another set of integer in arbitrary order. Don't mix
168 reclass table with mapping function which is used for convert raster
169 cell values to real units of numeric layer. For example if we have
170 statistical data of populations by county and want to create population 
171 them as map, we can use reclass table over county map. Several counties
172 with different names, which have distinct values in county map raster,
173 can be mapped to same class in population density map if their population
174 density is same.
175 <P>
176 Point layer is just list of triplets &lt; X, Y, Value &gt;.  Typically
177 point layer doesn't contain more than few thousands of points, so there
178 is no need to optimize performance or storage space.
179 <P>
180 Natural storage form of one-dimensional layer is vector format. 
181 It is most questionable area in current fGIS design. There are a lot of
182 advantages of EPPL7 vector format (compactness, speed of processing),
183 but it have only one drawback, which overcomes them all - it can
184 associate only one value with whole vector object (polyline). But
185 if we are talking about the function, defined on set of lines, whe
186 should be prepared that this function (stream depth for instance) would
187 vary from one end of line to other. 
188 <P>
189 It is also a question how intersections and joints of lines should
190 be stored/interpreted, becouse most interesting network analysis
191 algorithmes require ability to cross joints and intersections.
192 <P>
193
194 <A NAME="toc_section4"></A><H4>Regions and chartographic projection</H4>
195
196 Study area usially have hierarchical structure. For example Russia
197 can be subdivided to administrative regions, which consists of
198 districts. United States consists  of states, which are divided into
199 counties. Often study is concerned only with one of such hierarchy
200 levels, but there are opposite examples. 
201 <P>
202 Each hierarchy level have its typical data accuracy (which is rough 
203 representation of map scale in GIS world, becouse GIS maps can be
204 arbitrarily scaled, but only certain scale range make sense for
205 particular data accuracy), chartographic projection (especially
206 significant for large areas like whole country or continent).
207 On thematic maps like soils or vegetation, different classifications
208 can be used in different scales.
209 <P>
210 So, f(GIS) uses concept of <I>regions</I>. Region is set of layers,
211 which cover almost same territory, have exactly same projection and
212 simular spatial resolution. Regions can be nested, i.e. region of 
213 Russia can have several subregions of administrative regions, which
214 have subregions of districts etc. In this case there should be <i>base
215 layer</i>
216 which have subregion names as values. When copiing data between regions
217 f(GIS) authomatically performs neccessary projection and resolution
218  conversion using base layer as reference. Classification conversion,
219 if neccessary, should be performed by user, becouse it requires
220 knowledge in problem area.
221
222 <A NAME="toc_section5"></A><H3>Program design</H3>
223  
224 f(GIS) is designed as set of extensions to Tcl programming language
225 and set of independent utilities, which perform most time consuming
226 raster and vector processing tasks. Thus long operations can be launched
227 in background as separate while user continues to view/analyze data in 
228 main program.
229 <P>
230 From users point of view, fGIS is Tcl application which allows him
231 to operate with set of layers from GUI as well as from Tcl command line.
232 It is essential design constraing that there should be no operation,
233 which can be performed from GUI, but couldn't be from Tcl script. There
234 should be way to automate everything. Other way around is enusred by
235 very nature of Tcl. Nothing prevent user, which have direct access to
236 Tcl interpreter from creating new button or menu item and binding any
237 Tcl command to it. 
238 <P>
239 From programmers point of view, fGIS consists of several abstraction
240 levels, all available for extension and modification. And I think that
241 every fGIS user can eventually become programmer, if he discoveres need
242 to implement some, just invented, data analysis algorithm, or customize
243 graphical user interface to his needs. Relationship between fGIS
244 abstraction levels is shown on this figure.
245 <P>
246 <IMG SRC=levels.gif ALIGN=center ALT="Figure 1">
247 <P>
248 <A NAME="toc_section6"></A><H4>Layer as Tcl object</H4>
249 Layers in fGIS behave like objects in object-oriented programming
250 language. Once created with <B>layer</b> command they become tcl
251 commands itself (i.e. name of layer can be used as Tcl command),
252 just like Tk widget. Options of layer command allow to manipulate
253 properties of layer and store layer definition to file. This file
254 is just Tcl script which creates neccessary subobjects and invokes
255 appropriate command to create layer.
256 <P>Layer have following properties
257 <DL>
258 <DT>It can return value by coordinates
259 <DD> It is why whole thing is about
260 <DT> It can one or more ways to draw itself
261 <DD> Raster layer can be drawn in opaque colors, so only offsite area is
262 transparent or using transparent monochrome patterns, thus allowing to
263 overlay one raster over another. In most existing raster GIS, like
264 Idrisi only vector or point layers can be overlayed over raster. 
265 <P>
266 In f(GIS) <B>any</B> 
267 layer can be drawn as overlay
268 There are three <A HREF="#modes">drawing modes</a> for raster layer,
269 color, pattern and symbol.
270 <DT> It has underlying data source
271 <DD> Data source for layers typically consist of some object which can
272  return integer value given coordinate (raster file, combined with
273 reclass table, for example) and <i>legend table</i> or <i>map
274 function</i> which maps values of underlying raster object to
275 thematically meaningful values.
276 <DT> It has visualization parameters
277 <DD> visualization fo layer is controlled by several parameters such as
278 color palette, pattern set, flag, indicating if boundaries between
279 classes are drawn or not. All these parameters can be changed
280 interactively.
281 <DT> It has metadata
282 <DD> Metadata for layer typically include layer title, units in which
283 its values are managed, spatial resolution and value precession.
284 Chartographic projection is property of region rather than layer.
285 </DL> 
286
287 Besides layer types described <A HREF="#layerclass">above</A> fGIS have
288 <I>object</I> layer type. This layer type can consist of any objects
289 allowed in Tcl canvas - lines, arcs, polygons, images with only one
290 thematic value for each object. This type is primarily for annotation
291 purposes, but also can be used as substitute for vector layers, while
292 later are not developed
293 <P>
294 <A NAME="toc_section7"></A><H4>Planchet - object for displaying maps</H4>
295 Another type of object which is essential for fGIS user is
296 <i>planchet</I>. It is Tk widget like canvas (and actially derived from
297 canvas) which has chartographic projection and real-world coordinates.
298 It is used for displaying layers and picking points on them. Becouse
299 it has real-world coordinates and physical size on the screen, it always
300 knows its scale. When scale is changed (via zoom or window resize operation),
301 all layers currently displayed on planchet are redrawn appropriately.
302 <P>
303
304 Planchet also have <i>look feature</I>. If right mouse button is pressed
305 on some point in planchet, it displays values of several layers in this
306 point in pop-up window.
307 <P>
308 There can be also &quot;friend widgets&quot; like status line which
309 display current coordinates if mouse is over planchet or zoom/unzoom
310 buttons which change its state depending of current state of planchet.
311 <P>
312 <A NAME="modes"></A><A NAME="toc_section8"></A><H4>Drawing modes for raster layer</H4>
313
314 f(GIS) supports three drawing modes for raster layers - color, pattern
315 and symbol mode.
316 <DL>
317 <DT> In color mode,<DD> each value (or range of values, if
318 values are real number) of layer corresponds with particular color on
319 screen/paper. This is simplest drawing mode and it is supported by all
320 raster-oriented GIS.
321 <DT> In pattern mode<DD> contineous areas of same class are filled
322 by black and white patterns, which is suitable for black and white
323 printers. But this mode allows much more - patterns can have any color
324 and background of pattern is transparent rather then white, so patterned
325 layer can be overlaid over other raster layers.  Boundaries between
326 areas with different classes (polygons) can be highlighted in this mode as well as
327 in color mode.
328 <DT> Symbol mode<DD> looks much like pattern mode and use same pattern
329 sets as it. But it handles patterns differently. In pattern mode,
330 patterns can be cut if polygon boundary crosses rectangle, representing
331 pattern element. In symbol mode pattern elemet is interpreted like icon,
332 which can be either drawn entirely, or not drawn at all. So visible area
333 of map is divided into rectangular grid of size of pattern element and
334 each cell of this grid is filled with pattern, apropriate for central
335 point of this cell. 
336 </DL>
337 Differences between these thre modes are shown on following figure:
338 <IMG SRC="drawing-modes.gif" ALIGN=center ALT="Figure 2">
339
340
341 <A NAME="toc_section9"></A><H4>Low level objects</H4>
342
343 There are additional objects like rasters, palettes and pattern sets.
344 But user seldom need to operate on them directly. They are primarily
345 for developers of new layer types.
346
347
348 <A NAME="toc_section10"></A><H4>GIS operation</H4>
349 GIS operation like calculationg buffer zones or computing new layer
350 from several existing are performed by separate <A
351 HREF="#epu">utilities</A> running in background. For user convinience
352 there are tcl procedures which take one or more layer names as arguments
353 and call appropriate utility.
354 <P>
355 Example of such procedure is interregion copy command, which tooks
356 layer name and name of target region, determines projections and calls
357 projection conversion program.
358 <P>
359 In some cases such procedures need to perform sufficient preprocessing
360 of user-supplied arguments 
361 <A NAME="epu"></A>
362 <A NAME="toc_section11"></A><H4>Utilities</H4>
363
364 GIS processing utilities are more general than fGIS. They use just
365 data files and user-supplied arguments. So they can be used separately
366 from fGIS, for example by users of EPPL7 GIS. Utilities are designed
367 for batch environment, so they use exit codes to report status and
368 stdin/stdout to recieve and return values which are not fit in command
369 line. Important concept of these utilities is that user shouldn't worry
370 about raster cell size. All utilites which operate on several raster
371 files are able to deal with files with different cell sizes as long
372 as there is non-empty intersection in terms of real-world coordinates.
373
374 <A NAME=""></A><A NAME="toc_section12"></A><H4>Data access library</H4>
375
376 Both low-level Tcl objects (rasters, vectors) and utilites use common
377 C library to access data files. This library provides appropriately
378 high-level framework for those who want implement own data analysis
379  algorithmes. For example it includes iterator routines, which recieve
380 user-written function and open raster file and perform this function
381 on every cell of given file. While library operates primarily in terms
382 of raster cells (which can be important for cellular automata
383 algorithmes, which need to distinguish between ``this cell'' and
384 ``neighbouring cell'') it provides ways to process files with different
385 cell sizes simulateously.
386
387
388 </BODY>
389 </HTML> 
390
391
392
393
394
395
396
397
398