0% found this document useful (0 votes)
40 views10 pages

Gis - 4

GIS

Uploaded by

RajanRanjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views10 pages

Gis - 4

GIS

Uploaded by

RajanRanjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

GIS Data Model

Raster Data model

E. DECODING SCAN ORDERS


since Morton and Peano orders are useful but complex, two types of questions arise when they
are used:
1 What are the row and column numbers for a given pixel?
2 What is the position in the scan order for a given row and column number?
Method
start by numbering the rows and columns from 0 up: 3 10 11 14 15 2 8 9 12 13 1 2 3 6 7 0 0 1 4 5
0123
- row 2, column 3 is position 13 in the Morton sequence
1- How to go from row 2, column 3 to Morton sequence?
a. convert row and column numbers to binary representations:
16s 8s 4s 2s 1s 1 0 row 2 1 1 column 3
b. interleave the bits, alternating row and column bits (called bit interleaving (
1 1 0 1 row col c. evaluate this sequence of bits as a binary number:
Answer: 8 + 4 + 1 = 13 so to get the Morton position, interleave the bits of the row and column
number . How to find row and column number from Morton position 9? a. convert the position
number to a binary number 16s 8s 4s 2s 1s 1 0 0 1 (8 + 1 = 9) row col b. separate the bits:
1 0 row = 2 0 1 col = 1
Generalization
can express the row and column number to any base, not just base 2 (binary), and including
mixtures of bases
example: row 6, column 15, using base 4 instead of base 2 6464s 16s 4s 1s 1 2 row 6 = 1x4 +
2x1 3 3 col 15 = 3x4 + 3x1
interleaving:
1 3 2 3 1x64 + 3x16 + 2x4 + 3x1 = 123
2
answer: row 6 column 15 is position 123

HIERARCHICAL DATA STRUCTURES


A. INTRODUCTION
different scan orders produce only small differences in
compression
the major reason for interest in Morton and other
hierarchical scan orders is for faster data access
the amount of information shown on a map varies
enormously from area to area, depending on the local
variability
it would make sense then to use rasters of different sizes
depending on the density of information
large cells in smooth or unvarying areas, small cells
in rugged or rapidly varying areas
unfortunately unequal-sized squares won't fit together ("tile the plane") except
under unusual circumstances one such circumstance is when small squares nest
within large ones
there are, however, some methods for compressing raster data that do allow for
varying information densities
B. INDEXING PIXELS
consider the 16 by 16 array in which just one cell is different notation: row and
column numbering starts at 0 thus the odd cell is at row 4, column 7
3

Procedure
begin by dividing the array into four 8x8 quadrants, and
numbering them 0, 1, 2 and 3 as in the Morton order quads 1,
2 and 3 are homogeneous (all A) quad 0 is not homogeneous,
so we divide only it into four 4x4 quads these are numbered
00, 01, 02 and 03 because they are partitions of the 8x8 quad
0 of these, 00, 01 and 02 are homogeneous, but 03 is divided
again into 030, 031, 032 and 033 now only 031 is not
homogeneous, so it is divided again into 0310, 0311, 0312
and 0313
what we have done is to recursively subdivide using a rule of
4 until either: a square is homogeneous or

we reach the highest level of resolution (the pixel size)


this allows for discretely adaptable resolution where each resolution step is fixed
this concept is related to the use of Morton order for run encoding if we had coded
the raster using Morton order, each homogeneous square would have been a run
8x8 squares are runs of 64 in Morton order, 4x4 are runs of 16, etc the run
encoded Morton order would have been: 16A 16A 16A 4A 1A 1B 1A 1A 4A 4A 64A
64A 64A if we allow runs to continue between blocks we could reduce this to: 53A
1B 202A i.e. a homogeneous block of 2m by 2m pixels is equivalent to a Morton
run of 22m pixels
4

Decoding locations
the conversion to row and column is the same as for
decoding Morton numbers except that in this case the
code is in base 4 in the example the lone B pixel is
assigned code 0311
1. convert the code to base 2
hint: every base 4 digit converts to a pair of base
2 digits
thus 0311 becomes 00110101
2. separate the bits to get:
row 0100 = 4
column 0111 = 7
so the numbering system is just the Morton numbering of
blocks, expressed in base 4
however, sequence and data compression are not the
most useful aspects of this concept
C. THE QUADTREE
can express this sequencing as a tree the top is the entire
array at each level there is a four-way branching each
branch terminates at a homogeneous block
the term quadtree is used because it is based on a rule of
4 each of the terminal branches in the tree (the ones
having values) is known as a leaf in this case there are 13
leafs or homogeneous square blocks

Coding quadtrees
to store this tree in memory, need to decide what to store
in each memory location
there are many ways of storing quadtrees, but they
all share the same basic ideas
one way is to store in each memory location
EITHER: 1. the value of the block (e.g. A or B), or or
2. a pointer to the first of the four "daughter" blocks
at the next level down
all four daughter blocks of any parent always occur
together overhead - Coding quadtrees
thus, the quadtree might be stored in memory as:
Position: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Contents: 2 6 A A A A A A 10 A 14 A A A B A A
0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4):level(
the content of position 1 is a pointer indicating that the map is subdivided into four blocks
whose contents can be found starting at position 2 position 2 indicates that the four
parts of the 0 block can be found beginning at position 6 positions 3, 4 and 5 indicate
that the other three level 1 blocks are all A and are not further subdivided
Accessing data through a quadtree
consider two ways in which this quadtree may be accessed:
1. find all parts of the map with a given value
2. determine the contents of a given pixel
notation: if the array has 2n by 2n pixels there are n possible levels in the tree, or n+1 if we
count the top level (level 0) use m for the number of leafs
6

1. to find the parts of a map with a given value we must examine every leaf to see if
its value matches the one required this requires m steps as there are m leafs
2. to find the contents of a given pixel, start at the top of the tree if the entire map is
homogeneous, stop as the contents of the pixel are known already if not, follow the
branch containing the pixel do know which branch to follow: take the row and column
numbers, write them in binary, interleave the bits, and convert to base 4 e.g. row 4,
column 7 converts to 0311 at each level, use the appropriate digit to determine which
branch to follow e.g. for 0311, at level 0 follow branch 0, at level 1 follow branch 3,
etc. in the worst case, may have to go to level n to find the contents of the pixel, so
the number of steps will be n

QUADTREE ALGORITHMS AND SPATIAL


INDEXES
A. INTRODUCTION
this unit examines how quadtrees are used in
: several simple processes, including
- measurement of area
- overlay
- finding adjacent leafs
- measuring the area of contiguous
patches
in addition, this unit will look at how
quadtrees can be used to provide indexes
for faster access to vector-coded objects
finally, alternative forms of spatial indexing
will be reviewed
Definition
to traverse a quadtree: begin by moving down the leftmost branch to the first leaf
after processing each leaf in this branch, move back up to the previous
branching point, and turn right this will either lead down to another leaf, or back
to a previous branching point diagram
several of the following examples use this simple raster and its associated
8
quadtree

B. AREA ALGORITHM Procedure


to measure the area of A on the map:
traverse the tree and add those leafs coded A,
weighted by the area at the level of the leaf
Example
in the example quadtree, elements at level 0
have area 16, at level 1 - area 4, at level 2 - area
1
thus, area of A is: 1 (leaf 00) + 1(leaf 02) + 1 (leaf
03) + 4 (leaf 2) + 1 (leaf 32) = 8 units
C. OVERLAY ALGORITHM
Procedure
to overlay the two maps: traverse the trees
simultaneously, following all branches which exist in
either tree where one tree lacks branches (has a leaf
where the other tree has branches), assign the value
of the associated leaf to each of the branches
e.g. node 3 is branched on map 1, not on map 2
the leafs derived from this node (30, 31, 32
and 33) have values B, B, A and B on map
1, all 2 on map 2 the new tree has the
attributes of both of the maps, e.g. A1, B2

Problem D. ADJACENCY ALGORITHM


find if two leafs (e.g. 03 and 2) are adjacent Corollary: find
the leafs adjacent to a given leaf (e.g. 03)
note that in arc based systems adjacencies are coded in
the data structure (R and L polygons), so this operation is
simpler with vector based systems
Definition
here adjacent means sharing a common edge, not just a
common point diagram
Two cases
leaf codes are: 1. same length (same size blocks, e.g. 01
and 02) or 2. one is longer than the other (different size
blocks, e.g. 03 and 2)
solving this problem requires the use of: 1. conversion from
base 4 to binary and back
base 4 because of the "rule of 4" used in
constructing quadtrees 2. bit interleaving 3. a new
concept called Tesseral Arithmetic
Tesseral Arithmetic
tesseral arithmetic is an alternate arithmetic
useful for working with the peculiarities of
quadtree addressing
to add binary numbers normally, a "carry" works
to the position to the left
e.g. adding 1 to 0001 gives 0010
this is the same as decimal arithmetic except that
carries occur when the total reaches 2 instead of 10

10

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy