Data Models
Overview
• Introduction
• Common spatial data models
• Raster data models
• Models and cells
• Raster resampling
• Other data models
• Data and file structures
Learning objectives
• Distinguish among the real world, data models, and
data structures
• Explore data attribute types
• Distinguish among nominal, ordinal, and
interval/ratio data
• Understand the primary spatial models used in GIS
• Examine moving data among models
• Learn about coordinate systems
• Understand basic data and file structures and
formats
Introduction
pp.25-26
Data models
How do we
conceptualize our
world in a GIS?
Most common data
models define
thematic layers
Typically, layers, one
layer for each distinct
view of a theme
Courtesy [Link]
Data models matter!
• Foundational to GIS
• You’ll make serious mistakes without knowing
appropriate use of our two main types of coordinate
systems
• Without understanding data models and structures,
you’ll create faulty data, misunderstand others’ data,
and often mis-perform analyses, getting the wrong
answers for spatial problems
Common feature types
Points Lines
Areas Gradients
Building footprints - polygons
Elevation - gradient of heights
Rivers - lines
Populated ….or as
places as areas
points….
Roads as
lines….
….or as
areas
Land cover - discrete categories
Parcels - polygons
Precipitation - gradient
Coordinate Systems
pp.27-28
Cartesian coordinate systems
Spherical coordinate systems
Mathematical definition of our Earth
Geographic coordinates are inherently distorted
Spherical coordinates – latitude/longitude
Our system references a rotational North Pole, not a
wandering magnetic North Pole
Data models are abstraction of the “relevant” geography and
characteristics
Phenomena exist
Computer
representation
Abstraction of phenomena
and properties
Feature coordinates and attributes
Main points
• Data are most often stored as single-theme layers
• We commonly represent features as point, line,
area, or gradients
• The same features can be represented different
ways in different layers - it depends on our needs
• We often conceptualize three levels: the real world,
our data model, and data structures
• Our most common data models include two parts,
geographic data as coordinates, and attribute data
associated with the coordinates.
Geographic coordinates are not a
Cartesian system!
While we sometimes store layers
in latitudes/longitude, we don’t
often use them in analysis
Geographic coordinates in degrees/minutes/seconds
Geographic coordinates
Latitudes vary from 0 to 90
from the Equator to Poles,
+ or N North, - or S South
Longitudes vary from 0 to 180
from the Prime (Greenwich)
Meridian to the Antemeridian, +
or E East, - or W West
Longitudes converge at the poles
so
the distance spanned by a degree of
longitude isn’t constant across the
globe
1105.5 km 1114.5 km
1113.0 km 672.6 km
Spherical vs. ellipsoidal earth
Degrees-Minutes-Seconds (DMS) vs. Decimal Degrees (DD)
E25o47’55”, S1o39’10” vs. E 29.903o, S 6.4435o
o o
Different ways to express the same coordinates e.g. 18 30” = 18.5
Convert between DD & DMS
Spherical to surface distance
Reading on GPS or phone
o
45 5’8.20” reports to
the nearest 0.01”.
How many meters (or
feet) does that
spherical distance
equal on the ground?
Spherical to surface distance approximate formula for a
perfectly spherical earth
What distance is spanned by 0.01”?
Given Earth radius of 6,378,137 m
d = 0.01” / 3600” / 1o = 0.000002778o
= 0.000002778 / 57.2957o per radian
= 0.000000048481 radians
so
d = 6,378,137 x 0.000000048481
= 0.31 m, or about 1 foot
Spherical to surface distance approximate formula for a
perfectly spherical earth
Caveats:
• The formula is an approximation,
because Earth isn’t a perfect sphere
• Must express angles in radians
• Formula is not accurate for longitudinal
differences except at the Equator - error
increases with distance from the Equator
• Generally can be applied to latitudes
along a line of longitude
Spherical to surface distance approximate formula for a
perfectly spherical earth only valid on a great circle
B
Meridians and the Equator are Great Circles
Lines of equal
latitude are small
circles
e.g., the
Arctic Circle or
Tropic of Cancer
More precise formula for distance on a sphere
A further complication: the Earth isn’t a sphere
Coordinate distance on a sphere
• We use both DMS and DD for spherical coordinates,
but they’re convertible
• We have approximate and improved formulas for
estimating surface distances from spherical
coordinates
• Distance measurements are always along great
circles
• The Earth’s shape is closer to an ellipsoid than a
sphere, with commensurately more complicated
formulas
Attribute Data and
Types
pp. 36-38
Feature coordinates and attributes
Types of attribute data
• Nominal - type, character, no implied rank or size
• e.g., county or country name,
• Ordinal - identifies order, but not absolute difference,
• e.g., state rank by percent poverty
• Interval/ratio - both order and a linear scale
• e.g., temperature, population density, elevation
Why is it important?
• Not all calculations are appropriate for all types
• What is the arithmetic average of red, yellow, blue?
• What is the count of categories between 1.1 and
8.73?
• Which larger, Poplar or Cascade?
Landcover class - nominal, ordinal, or interval/ratio?
Landcover class - nominal, ordinal, or interval/ratio?
Nominal
Standard of Living Index
(Composite of income, cost, life expectancy, leisure time)
Nominal, ordinal, or interval/ratio?
5 High
4
3
2
1 Low
Standard of Living Index
(Composite of income, cost, life expectancy, leisure time)
Nominal, ordinal, or interval/ratio?
5 High
4
3
Ordinal 2
1 Low
U.S. Population Density
Nominal, ordinal, or interval/ratio?
U.S. Population Density
Nominal, ordinal, or interval/ratio?
Interval/Ratio
Common Spatial
Data Models
pp. 39-45
Representation & data structures
• Most common data
models define thematic
layers
• Typically, layers, one
layer for each distinct
view of a theme
Courtesy GAO
Phenomena exist
Computer
representation
Abstraction of phenomena
and properties
Rasters – fixed cell size + grid orientation
Gradients
Gradients
Raster cells; each has a value
Gradients
Raster cells; each has a value
Two most common data models
Feature-Table conceptual model with hidden indexing
Vector topology
Topology – geometric properties that to not change with shape:
adjacency, connectivity, containment
Planar topology = no overlaps
Topological rules
are established
between and
among layers.
e.g., “must not
overlap,” or
“must be entirely
contained by”
Topology
• Enforced through rules
• Parcel polygon layer
must not have gaps
• Centroid points must fall
building polygons
• Building polygons must
not cross parcel
boundaries
Polygon topology example
• Two layers in our analysis - Buildings & Landcover
• Landcover classes can’t overlap or have gaps
• Edges of buildings can’t overlap, have gaps with
landcover
• Buildings are isolated, so don’t have to worry about
building/building overlaps or gaps
Gaps and overlaps in one layer
Gaps and overlaps among layers
Software helps identify errors
Real errors
Real errors
“Faux” errors
where layers do
not line up…
(Almost) nothing is pure!
Enforced
uniformity in
vector polygons
& raster cells as
a computational
representation
vs.
most everything
in the real world
is at least a little
mixed up!
The NRCS Soil Survey mapping description exemplifies how real-world
messiness is represented: “Areas of soil that were markedly different in use
and management but too small to be delineated at the scale of mapping were
described as inclusions in map units or denoted by a spot symbol on the map.
When the mapping is presented at a larger scale, these areas may appear to
be errors in the map.”
Raster Data
Models/Models and
Cells
pp. 51-59
Combining data
We can
convert
among major
models
Mixed pixel problem
Landcover map
Two classes: land (1) or
water (2)
Cell A is straightforward
since it is entirely land (1).
What category to assign
for B, C, or D? These
cells are mixed.
Raster vs. vector attribute storage
Many-to-one nominal data are common and a separate
attribute table tames the data
Raster layers storing
interval/ratio data
often don’t have an
associated table
because there are too
many cells and most
are single-valued or
unique valued
Multi-part vs. single-part shapes
How do we store attributes for singular entities like states
when they can have multiple parts?
Many singular entities are composed of multi-part shapes
Multi-part shapes
Single-part shapes
Single-part shapes
Raster Resampling
Raster Resampling - inter/intra-cell averaging
Raster resampling is necessary when data have
different grains (cell size)
Raster Resampling -
a distance weighted average to
calculate raster values
Raster resampling - sometimes our raster data have different grids (e.g., size,
orientation)
Landcover
data at 30m
resolution
Elevation
data at 10 m
resolution
Resampling ambiguity
What if the cells
aren’t “well behaved”
Bilinear
Interpolation
d=5
d=5
d=5
Other Data Models
pp. 61-66
We can convert among major models
Sometime we use
specialized
data models.
A TIN (Triangulated
Irregular
Network) is used to
represent surfaces
with edges. It is less
storage-intensive than
raster layers and can
better represent some
features, especially
human ones.
Data and File
Structures
pp. 67-73
Data and file structures
• Data and file structures are often hidden to users but
the details matter!
• Different use cases and design paths will typically
involve different software packages and different
data and file structures
• GIS analysts often spend a fair amount of time trying
to figure out what data they have been given or why
output does not look like it should!
Architecture/Landscape Architecture/Design data path
Hydrologic analysis data path
When you want this… …but you get this…
Data and file structures
• Data are stored as
binary numbers
• Bits are 0 or 1
• Bytes are 8 bits
• Data (e.g., raster cells)
are often referenced as
1 byte, two byte, etc.
Which is bigger?
0100
0011 ?
What is the largest number you can store
with 8 digits?
8
24 Which can store a larger
64 number?
128
256 ? Unsigned 8-bit integer
Signed 8-bit integer
They store the same
Binary numbers
Data types for attributes
Long integer - 4 bytes, will hold
numbers from +/-2,147,483,648
Text - typically 2 bytes per text
space
Double real - 8 bytes, will hold
numbers from -2.2 x 10308 to 1.8 x
10308
Raster compression
Raster pyramids are
a way to resample at
lower resolution to
speed display
Copyright 2017 Open Geospatial Consortium CC BY 3.0.
Data often have specific organization to reduce size, speed
access, and ease updates
Data and file structures
Example: ESRI Shapefiles
Landcover dataset, wash_lc
is a cluster of files,
wash_lc.shp - containing the coordinates
wash_lc.dbf - containing the attributes
wash_lc.shx - containing linkages, other info
wash_lc.prj - optional, containing projection information
wash_lc.sbn - an optional indexing file
Generally, all files are needed for useful data
If you mess with one file, you can “break” the data