dr. bo wu · lsgi 521: principles of gis lecture 4: data modelling 1. learning outcomes 2. vector...
TRANSCRIPT
9/28/2011
1
LSGI 521: Principles of GIS Lecture 4: Data ModellingLSGI 521: Principles of GIS Lecture 4: Data Modelling
LSGI 521: Principles of GIS
Lecture 4: Spatial Data Modelling in GIS
Dr. Bo Wu [email protected]
Spatial Data Modelling in GIS
@p y
Department of Land Surveying & Geo-InformaticsThe Hong Kong Polytechnic University
LSGI 521: Principles of GIS Lecture 4: Data Modelling
1. Learning outcomes2. Vector model
Contents
3. Raster model4. Comparison of vector and raster models5. Modeling terrain surface using vector and
raster models6. Object-oriented Modelingj g7. Network Modeling
9/28/2011 2
9/28/2011
2
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• By the end of this lecture you should be able to:– Provide a definition of spatial data model
E l i h ti l bj t d t t d t
Learning Outcomes
– Explain how spatial objects are used to create a data model
– Distinguish between vectors and rasters– Describe a spatial data model structure– Explain how topology is stored in the model– List the advantages and disadvantages of differentList the advantages and disadvantages of different
spatial data models– Know how to model a network
9/28/2011 3
LSGI 521: Principles of GIS Lecture 4: Data Modelling
Spatial Objects
9/28/2011 4
9/28/2011
3
LSGI 521: Principles of GIS Lecture 4: Data Modelling
Vector and Raster Spatial Data
Objects in Real WorldVector View Raster View
9/28/2011 5
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Vector data model • The basic logic unit in a
geographical context d t li
Basic Types of Geographic Data Models
corresponds to a line, e.g. contour lines
• Raster (Tesselation) data model • The basic logic units is a
single cell or unit of space in the mesh
• Hybrid data model• Possesses characteristics
of both vector and raster data model
• Others9/28/2011 6
9/28/2011
4
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Spaghetti Model• Chaincodes Model
Typical Vector Models
• GBF/DIME Model• Topologic Model• POLYVRT Model
9/28/2011 7
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Each object on the map becomes one logic record in the digital file, and is defined as strings
Spaghetti Model
and is defined as strings of x, y coordinates.
• The spaghetti model remains the conceptual map model - direct line to line translation.
Spaghetti Noodles
9/28/2011 8
p g
9/28/2011
5
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Advantages– Good for computer-assisted cartographic production
where no topologic relation is required
Advantages & Disadvantages of Spaghetti Model
p g q• Disadvantages
– No spatial relationships are reordered– Common boundary of two adjacent polygon are
stored twice– Inefficient for most type of spatial analyses– Spatial relationships which are implicit in the original
analog document must be derived through computation
– Correction and updates of the data must rely on visual checks of graphic output
9/28/2011 9
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Classical chaincode model was presented by Freeman-Hoffman in1974
• Unique direction code
Chaincodes Model
• Encode line data on grid unit• Record x, y coordinates only for beginning point of each line
9/28/2011 10
9/28/2011
6
LSGI 521: Principles of GIS Lecture 4: Data Modelling
An Example of Chaincodes Model
9/28/2011 11
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Advantages– Compactness
Advantages & Disadvantages of Chaincodes Model
– Using unit vector direction code - easier forsome measurement and analyticalprocedures (distance, shape analysis)
• Disadvantages– No spatial relationships are retained - aNo spatial relationships are retained a
compact spaghetti– Coordinate transformations, particularly
rotation, are more difficult
9/28/2011 12
9/28/2011
7
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• GDF/DIME (Geographic Base File/ Dual Independent Map Encoding) from US
GBF/DIME Model
p g)Census Bureau
• Each street, river, railroad line etc is represented as a series of straight line segments
• Usage:
12
Usage:– Digitally storing street maps– Providing geographically
referenced address information in computerized form
9/28/2011 13
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Advantages– As a directed graph, missing segments and other
b t ti ll h k d
Advantages & Disadvantages of GBF/DIME Model
errors can be automatically checked.– Some location systems (e.g. street address) can be
directly derived from the model.
• Disadvantages– Line segments are not stored in any particular order;
to retrieve any particular line segment exhaustiveto retrieve any particular line segment, exhaustive search must be performed on the entire file.
9/28/2011 15
9/28/2011
8
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Definition– Basic logic entity is straight line segment– A line segment begins or ends at the
Topologic Model
A line segment begins or ends at the intersection with another line or at a bend
• Files– X, Y coordinate node file– Line segment file– Topologically coded network polygon file
9/28/2011 16
LSGI 521: Principles of GIS Lecture 4: Data Modelling
An Example of Topologic Model
9/28/2011 17
9/28/2011
9
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Advantages– Most popular method of retaining spatial
Advantages & Disadvantages of Topologic Model
relationships among objects– Explicitly record adjacency information– Points, line, polygons are stored in a non-
redundant manner• DisadvantagesDisadvantages
– It is a time consuming process to properly define the topology depending on the size and complexity of the data set
9/28/2011 20
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• POLYVRT (POLYgon conVERTer) presented byPeucker and Chrisman in 1975.
• Explicitly and separately storing each type of
POLYVRT
• Explicitly and separately storing each type ofdata entity in a hierarchical data structure– A chain is denoted as the basic line entity comprised
from a sequence of straight line segments– A line segment begins and ends at a node– A node is defined as the intersection point between
two chains and its position is indicated by x ytwo chains and its position is indicated by x, ycoordinates
9/28/2011 21
9/28/2011
10
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Polygons• Chain List• Chains
An Example of POLYVRT Model
• Chains• Points• Nodes• Files are linked
by pointers
9/28/2011 22
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Advantages– More efficient in retrieving than simpler topologic structures;– Selective retrieval of only specific classes in the data model at a
Advantages & Disadvantages of POLYVRT Model
S y ptime;
– The queries concerning the adjacency of polygons need only deal with the polygons of interest. Only individual chains which bound the polygons of interest are retrieved
• Disadvantages– The physical separation of files cause the need for a link or
pointer structurepointer structure– Incorrect pointers can be extremely difficult to detect or correct– Initial generation of this structure can be cumbersome and time-
consuming
9/28/2011 23
9/28/2011
11
LSGI 521: Principles of GIS Lecture 4: Data Modelling
Raster Models
For Vector Models:Individual entities are the basic data units for which geometric information is explicitly recorded.
While Raster Models:The basic unit become a unit of space for which entity information is explicitly recorded.
9/28/2011 24
y p y
LSGI 521: Principles of GIS Lecture 4: Data Modelling
A Simple Raster Data Model
9/28/2011 25
9/28/2011
12
LSGI 521: Principles of GIS Lecture 4: Data Modelling
Another Example of Raster Model
9/28/2011 26
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Run-Length Encoding• Block Encoding
Typical Raster Models
g• Chain Encoding• Quadtree Model• Point Quadtree Model• K-D Tree
9/28/2011 27
9/28/2011
13
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Run-length encoding allow the points in each mapping unit to be stored per row in terms, from left to right, of a begin cell and an end cell.
Run-Length Encoding
g
9/28/2011 28
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Block encoding extends the run-length encoding idea to two dimensions by using a series of square blocks to store data
Block Encoding
9/28/2011 29
9/28/2011
14
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Chain encoding works by defining the boundary of the entity. The boundary is defined as a sequence of unit cells starting from and returning to a given origin. The direction of travel around the boundary is usually given using a numbering system (e g 0=North
Chain Encoding
boundary is usually given using a numbering system (e.g., 0=North, 1=East, 2=South, and 3=West).
9/28/2011 30
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Advantage– more compact than square grid
it bl f li ll l l ith i
Advantages & Disadvantages of Encoding Models
– suitable for linear or parallel algorithms processing
• Disadvantage– not suitable for processes which depend upon
neighborhood effects
9/28/2011 31
9/28/2011
15
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Recursive subdivision of space in quadtreemodel results in a
Quadtree Model
model results in a regular, balanced tree structure of degree 4– A hierarchical or tree
data model– Each node has 4 sons
9/28/2011 32
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Advantages– Tree file structure - well developed already
Advantages & Disadvantages of Quadtree Model
– Suitable for handling a very large database– Compatible with conventional cartesian
coordinate systems• Disadvantages
There is a trade off between the complexity of– There is a trade-off between the complexity of the object and the dimensions of the smallest grid cell.
9/28/2011 33
9/28/2011
16
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Point quadtree is a special quadtree that divides space based on the location of ordered points, rather than regular spatial decomposition
Point Quadtree Model
g p p
TORONTO
BUFFALODENVER
OMAHACHICAGO
MOBILEATLANTA
MIAMI
(0,100) (100,100)
(60,75)
(5,45)
(25,35)(35,40)
(50,10)Y
(80,65)
(85,15)
9/28/2011 34
(90,5)
X (100,0)(0,0)
CHICAGO
DENVER TORONTO OMAHA MOBILE
BUFFALO ATLANTA MIAMI
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Advantages– Location based
Advantages & Disadvantages of Point Quadtree Model
– Save space• Disadvantages
– The shape of the tree is highly dependent on the order in which the points are addedAdditions and deletions are impossible except– Additions and deletions are impossible except at the leaves of the tree
9/28/2011 35
9/28/2011
17
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• K-D tree divides the area into two parts instead of four, yielding a tree of degree 2
K-D Tree
(0,100) (100,100)
TORONTO
BUFFALODENVER
OMAHACHICAGO
MOBILEATLANTA
MIAMI
(60,75)
(5,45)
(25,35)(35,40)
(50,10)Y
(80,65)
(85,15)
(90,5)X (100,0)(0,0)
CHICAGO
9/28/2011 36
CHICAGO
DENVER
TORONTOOMAHAMOBILE
BUFFALO
ATLANTA
MIAMI
LSGI 521: Principles of GIS Lecture 4: Data Modelling
Modeling Terrain Surface
9/28/2011 39
9/28/2011
18
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Raster-based Digital Terrain Model (DTM) is simply a grid of height values in which each cell contains a single value representative of the height of the terrain that is covered by that cell.
• DEM (Digital Elevation Model)
Raster-based Digital Terrain Model
DEM (Digital Elevation Model)
9/28/2011 40
LSGI 521: Principles of GIS Lecture 4: Data Modelling
An Example of DEM
9/28/2011 41
9/28/2011
19
LSGI 521: Principles of GIS Lecture 4: Data Modelling
1:1,000,000 Map Scale DEM
42
LSGI 521: Principles of GIS Lecture 4: Data Modelling
1:250,000 Map Scale DEM
43
9/28/2011
20
LSGI 521: Principles of GIS Lecture 4: Data Modelling
1:50,000 Map Scale DEM
44
LSGI 521: Principles of GIS Lecture 4: Data Modelling
1:10,000 Map Scale DEM
45
9/28/2011
21
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• A more advanced, more complex and more common form of vector-based DTM is the Triangulated Irregular Network (TIN)
Vector-based Digital Terrain Model
9/28/2011 46
LSGI 521: Principles of GIS Lecture 4: Data Modelling
TIN Model
16
5
7
11A
BC I
JK
N
2
3
87
910
4
C
D
E
F
G
H
LMEDGES
adjacent
ABCDEFGH
B, KA, C, LB, DC, E, LD, FE, GF, H, MG, I
NODES
node#
ABCDEFGH
1, 6, 71, 7, 81, 2, 82, 8, 92, 3, 93, 4, 94, 9, 104, 5, 10
9/28/2011 47
X-Y Coordinatesnode# coordinates
123
11. . .
x1, y1x2, y2x3, y3. . .x11, y11
Z Coordinatesnode# z_value
123
11. . .
z1
. . .
z2z3
z11
IJKLMN
H, J, NI, KA, J, NB, D, MG, L, NI, K, M
IJKLMN
5, 10, 115, 6, 116, 7, 117, 8, 97, 9, 107, 10, 11
9/28/2011
22
LSGI 521: Principles of GIS Lecture 4: Data Modelling
An Example of TIN
9/28/2011 48
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Advantages – Adapt to the nature terrain
Advantages & Disadvantages of TIN Model
– Facilitate the calculation of slope and other terrain-specific parameters
• Disadvantages – More time is required in dividing irregular
space point setspace point set– For some point set, there are many possible
different triangulations
9/28/2011 49
9/28/2011
23
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• An object is a self-contained package of information describing the characteristics and capabilities of an entity
• In a geographical object data model, the real world is
Object-Oriented Modeling
modeled as a collection of objects and relationships between them
Each entity in the GIS is an objectA collection of objects of the same type is called a classEach class has a superclass
9/28/2011 50
Each class has a superclass from which it can inherit both instance variables and methods
LSGI 521: Principles of GIS Lecture 4: Data Modelling
Object-Oriented Data Model
OBJECT
POLYGON LAND PARCEL
Polygon-1 Polygon-1 Land parcel-1
Land parcel-2
Land parcel-3
• Three key hallmarks of object orientation– Polymorphism– Encapsulation– Inheritance
9/28/2011 51
9/28/2011
24
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Advantages– The ‘natural’ model: directly corresponds to the object
found in reality.
Advantages & Disadvantages of Object-Oriented Model
found in reality.– Completeness: every object is completely bounded
with a defined ‘shell’.– Inheritance: a class can include subclasses that can
inherit both its data and methods.– Openness: allows to modify and expand instance
variables and methodsvariables and methods.• Disadvantages
– Complicated– Difficulty of implementation
9/28/2011 52
LSGI 521: Principles of GIS Lecture 4: Data Modelling
What is a Network?
Any system of interconnected linear features
9/28/2011 53
9/28/2011
25
LSGI 521: Principles of GIS Lecture 4: Data Modelling
How to Represent a Network?
9/28/2011 54
LSGI 521: Principles of GIS Lecture 4: Data Modelling
Network Elements
Links
• Network nodes• Network links
• Impedance and demand• Turn• Stops (intermediate nodes) • Centers (resource provider/center)
School
End point of 8 route bus
Links
Turn
Centers
N l ft t h
Impedance
9/28/2011 55
Start point of 8 route bus
Barrier
Links
Stops10 people get
on the busdeman
No left turn here
Demand
9/28/2011
26
LSGI 521: Principles of GIS Lecture 4: Data Modelling
The Simplest Node-Link ModelTwo fundamental tables are required in the Node-Link Model that
can be stored in a relational database
• Node table This table contains at least three fields; one to store a unique identifier
• Link table – This table also contains at
least three fields; one to store an unique identifier, one to store the node of origin and one to store the node of
– This table contains at least three fields; one to store a unique identifier and the others to store the node's X and Y coordinates..
destination. A fourth field can be used to state if the link is unidirectional or not.
9/28/2011 56
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Impedance– Length by default– ‘from-node’ to ‘to-node’ and ‘to-node’ to ‘from-node’ impedances
Different impedance may be assigned to different turn types
Network – Impedance and Demand
– Different impedance may be assigned to different turn types
• Demand– Attributes added to the network
9/28/2011 57
9/28/2011
27
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• There are n2 possible turns at every network node, where n is the number of edges connected at that node
• Four types of action
Network - Turn
– Passing straight through an intersection– Backtracking, i.e. making a U-turn– Turning left– Turning right
9/28/2011 58
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Node# - internal node no. of the network node at which turn is made• Arc1# - internal node no. of arc entering the node• Arc2# - internal node no. of arc leaving the node• Azimuth – north azimuth of arc entering the node
An Example of a Turntable
g• Angle – angle of turn from Arc1# to Arc2#, left turns have + angles, right
turns have – angles
599/28/2011
9/28/2011
28
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Cover-ID– Unique user-id for each stop
• In-order– Value for the order in which the stops will be visited
Network - Stop
Unlike nodes, stops do not affect or alter path direction
Value for the order in which the stops will be visited
• Route-ID– Feature-id of the route
created• Impedance
– The cost associated with the stop, e.g. time, money cost
9/28/2011 61
cost• Transfer
– Loading or unloading of resources or commodities at a stop
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Cover-ID– Unique user-id for each center
• Route-ID
Network - Center
– Feature-id of the route created
• Max-Impedance – Serving area (distance, time)
• Supply– The maximum total demand
9/28/2011 62
9/28/2011
29
LSGI 521: Principles of GIS Lecture 4: Data Modelling
An Example of the Allocation Problem
639/28/2011
LSGI 521: Principles of GIS Lecture 4: Data Modelling
Typical Applications
9/28/2011 64
Best Route Closest Facility
9/28/2011
30
LSGI 521: Principles of GIS Lecture 4: Data Modelling
Typical Applications
Service Area
Origin-Destination Cost Matrix
9/28/2011 65
LSGI 521: Principles of GIS Lecture 4: Data Modelling
• Further readings– D. Buckey, Vector and Raster - Advantages and Disadvantages
(http://bgis.sanbi.org/gis-primer/page_19.htm)– Finding Your Way with ArcGIS Network Analyst
Review
(http://proceedings.esri.com/library/userconf/devsummit06/papers/network_analyst.pdf)
• Summarization of the main ideas presented in this lecture:
• Questions?
2011/9/28 66