chapter 4 spatial data & spatial db sys 1. introduction

34
Chapter 4 Spatial data & spatial DB sys 1. Introduction spatial DB sys is different from conventional DB sys stores complex data types – points, lines, polygons needs sophisticated spatial operators 1

Upload: others

Post on 27-Dec-2021

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 4 Spatial data & spatial DB sys 1. Introduction

Chapter 4 Spatial data & spatial DB sys 1. Introduction

spatial DB sys is different from conventional DB sys stores complex data types – points, lines, polygons

needs sophisticated spatial operators

1

Page 2: Chapter 4 Spatial data & spatial DB sys 1. Introduction

2. Definition & classification of spatial data

2.1 Spatial data & pseudo-spatial data 1) spatial data : data of spatial attributes that denote a location / near the surface

two important properties : reference to a geographic space represent at a variety of geographic scales

two fundamental forms - vector & raster

vector – basic unit is the geographic object, represented by points, lines, polygons ex. Land use, transportation, forest inventories, land cover raster – basic spatial unit is a grid cell / pixel, serve as a data store & geographical referencing size of a single pixel – resolution 2) pseudo-spatial data : describe / related to the characteristics of real world features ex. street address, demographic characteristics

conversion of pseudo-spatial data into spatial data is a very time consuming & resource intensive

2

Page 3: Chapter 4 Spatial data & spatial DB sys 1. Introduction

Spatial Data

Pseudo-spatial Data

Vector Data Street Addresses

Scanned maps / air

photos

Alpha-numeric

data

Geocoding

Digitising

Rectification

Registration

Layers of Spatial Data

(See Figure 4.2)

ApplicationData Trans-

formation

Raster Data

Base Map

Automated vectorisation

TopographicBase

Fig 4-1 Types of spatial data

3

Page 4: Chapter 4 Spatial data & spatial DB sys 1. Introduction

2. 2 A functional perspective of spatial data

four categories of spatial data in a functional classification base map data : geodetic control + various types of topographic base data

framework data : parcel layer + facilities layer + address layer

application data : spatial datasets for different DB applications

business solution : support many operations & decision making functions

4

Page 5: Chapter 4 Spatial data & spatial DB sys 1. Introduction

Geodetic Control Network

Orthophotography Planimetric Detail Topography

Cadastral Fabric Street Centre-line Building Footprint Hydrology

AddressFacilitiesParcel

Natural Resources

Geology

EnvironmentTax DistrictJurisdiction Unit

Census Tract Zoning

Election District Land Use

Land Cover

Public Safetyand Security

Environmental ImpactAssessment

FacilitiesManagement

Building Permitsand Inspection

Goods and ServicesDelivery

Resource Planningand Management

Bas

e M

ap D

ata

Fram

ewor

kD

ata

App

licat

ion

Dat

aB

usin

ess

Solu

tions

Digital Terrain Model

Fig 4-2 A functional classification of spatial data

5

Page 6: Chapter 4 Spatial data & spatial DB sys 1. Introduction

3. Spatial data structure & DB models

two key aspect of spatial data – geometry + topology

3.1 The concept of a “geometry” of spatial data geometry is to represent a spatial feature as an object

OGC geometry object model (Open GIS Simple Feature Specification for SQL)

geometry : non-instantiable construct

four subclasses (point, curve, surface, geometry collection) : instantiable construct

there are many geometric types – so called graphical primitives

geometries sharing the same attributes form a layer (/ feature class)

6

Page 7: Chapter 4 Spatial data & spatial DB sys 1. Introduction

Geometry Spatial Reference System

Point Curve Surface Geometry Collection

Line String Polygon MultiSurface MultiCurve MultiPoint

Line Linear Ring MultiPolygon MultiLine String

Legend:

Aggregate / formIs a subclass of

Fig 4-3 The OGC geometry object model

7

Page 8: Chapter 4 Spatial data & spatial DB sys 1. Introduction

Layer

Coordinates

GraphicalPrimitives

Collection

Geometry

Spatial Hierarchy Examples

Roads, rivers, land parcels, land use / cover

One or more of the roads, rivers, land parcels,land use / cover polygons from a single layer

One or more of the road and river segments, parcellines and land use / cover boundaries in a parentgeometry

Individual points, lines and polygons that areused to represent a geometry

(x, y) or (latitude, longitude)

Fig 4-4 The concept of geometry and its relationship w/ other elements as representations of spatial features 8

Page 9: Chapter 4 Spatial data & spatial DB sys 1. Introduction

3.2 The concept of topology & topological data structures

topology : a field of mathematics studying the properties of geometric figures & their relationships typically studying adjacency, connectivity, containment

relationship can be defined by 3 primitives – nodes(0cell), edges(1cell), polygons(2cell)

one & two dimensional topology : 1D - network topology by nodes + edges

2D – planar topology by closed polygons

terms definition

node : 0D, one / more edges (ex. arcs, chains, lines) connect to form a topological junction

edge : 1D, formed by a directed, non-branching line segments bounded by a from & to node

polygon : 2D, closed by connected & directed edges

usually, arc-node topology is built to enforce the topological relationship

ex. geo-relational data model of an Arc/Info coverage – AAT, PAT tables

advantage of topological data structure

automatic detection & correction of digitizing & editing errors, artifacts reduction of storage requirements (ex. boundaries shared by adjacent polygons are stored once)

enables sophisticated spatial analysis & applications

9

Page 10: Chapter 4 Spatial data & spatial DB sys 1. Introduction

(a) Non-topological (cartographic) data structure (b) Topological data structure

A B

Polygon A = (403600, 275700), (403000, 275700), (403000, 275000), (403300, 275000), (403600, 275700)

Polygon B = (403600, 275700), (403300, 275000), (404000, 275700), (404000, 275700)

Vertice_ID X Y

b 403000 275700 c 403000 275000 e 404000 270500 f 404000 275700

Poly_ID Arcs

A 1, 2 B 2, 3

Polygon File

Node File

Node_ID X Y

a 403600 275700 d 403300 275000

A B

ab f

c d e

1

2

3

Arc FileArc_ID Vertices

1 b,c 2 - 3 e,f

Coordinate File

Network Topology FileArc_ID F_node T_node

1 a d 2 d a 3 d a

Polygon Topology FileArc_ID L_Poly R_Poly

1 A World 2 A B 3 B World

Fig 4-5 Topological enforcement & topological data structure

10

Page 11: Chapter 4 Spatial data & spatial DB sys 1. Introduction

3.3 Non-topological data structure

shapefile – non topological data structure, by ESRI

open data model w/ full-polygon data structure limitations

limited cartographic rendering capability

incompatibility w/ relational DB management principles & techniques

not efficient spatial analysis

lack of support for transferring metadata

11

Page 12: Chapter 4 Spatial data & spatial DB sys 1. Introduction

3.4 The geo-relational model conventional data model for spatial data

spatial data are abstracted into a series of independently defined layers

each layer represents a selected set of associated spatial features (ex. road, soil type)

spatial features on each layer are the same type of graphical primitives – points, lines, polygons

attributes are stored in separate relational tables – attribute tables

attribute tables are logically linked by the unique feature identifiers (FID)

best example – arc node model (of ESRI coverage)

12

Page 13: Chapter 4 Spatial data & spatial DB sys 1. Introduction

Roads / highways

Soil types

Land cover

Land parcels

Drainage

1 e,f 2 f,g 3 a,b 뀉.. 뀉.. 10 f,j 11 j,o 12 j,k,l,m,n

Arc FileArc # Coordinate list

1

2

4

5

3

67

8

9

12

10 11

a

bc

d

e

f

ghi

jk

lm n

o

Coordinates FilePoint # X Y

a 10480 67324 b 10495 67221 c 10321 67230 뀉. 뀉. m 11084 68030 n 11012 68090 o 11907 67230

ID Class No. of Lanes 1 1 4 2 1 4 3 2 2 4 2 2 뀉. 뀉.11 2 212 2 2

ID Maintenance date 1 2005 May 06 2 2005 Dec 02 3 2005 Aug 15 4 2006 Jan 10 뀉. 뀉.11 2005 Jun 2712 2004 Nov 10

Road attribute table

Pavement Management Table

Roads / highways

Storing of spatial data by breaking down featuresinto graphical primitives

Crea

ting

a lin

e fe

atur

e fro

m

stor

ed p

oint

coo

rdin

ates

Linking spatial and text-based data by a common feature identifier (FID)

Link

ing

diffe

rent

text

-bas

ed

tabl

es u

sing

a co

mm

on

feat

ure

iden

tifie

r (FI

D)

Attribute data stored in a relational database

Fig 4-6 The geo-relational model

13

Page 14: Chapter 4 Spatial data & spatial DB sys 1. Introduction

3.5 The geodatabase model

allows a user to define spatial data as specific abstract data types

→ making it possible to store spatial data w/ their associated attribute data in a single DB

advantages (compare to geo-relational model)

take full advantage of the available indexing, transaction management DB constraint mechanisms to maintain the integrity of the spatial data

cost effective

best example – geodatabase (of ESRI) – from personal geoDB to enterprise geoDB

spatial data that share the same attributes are stored in a single table table has two sets of fields – predefined fields : FID, geometry, area

custom fields : attribute data associated w/ spatial data

values can be updated by transaction processing

topology is implemented by using integrity rules stored in a topology tables

enforce topological relationship to feature class in a single table ex. adjacency, connectivity, containment

14

Page 15: Chapter 4 Spatial data & spatial DB sys 1. Introduction

FEATURE DATA SET NON-SPATIAL DATA TABLES

SURVEY DATA SET

Feature Class

PF FK Other Keys

Feature Class Rules / Constraints

Topology

Obj-ID Geometry Connectivity Rules

Geometric Network

Obj-ID Geometry User-Defined-Fields Obj-ID User-Defined-Fields

Attribute Data Table

Point-ID N E

Control Points

Point-ID N E

Coordinate ListRASTER DATA SET

METADATA DOCUMENT

Georeferencing

Georeferencing

Metadata Extraction

Metadata Extraction

Met

adat

a Ex

tract

ion

Met

adat

a Ex

tract

ion

Graphics-attribute linkRelations Table

External link

Fig 4-7 Structure of a spatial DB using a DBMS for the storage of spatial data & topological relationships

15

Page 16: Chapter 4 Spatial data & spatial DB sys 1. Introduction

SIN Address Telephone

004334125 90 Highview Avenue 519-0909200298900 450 Kingsway East 690-0808434222234 1234 Hamilton Road 690-2234421004009 400 Hunt Club Drive 417-8485334222090 1185 University Street 680-9121

FID Geometry Shp-area Owner SIN Zoning Frontage Date reg.

100 6000.5 VanDamme 004334125 1a 50.0 2003 05 12102 5600.0 McGrath 200298900 1a 48.5 2003 09 20124 7200.0 Henderson 434222234 a 60.5 2002 12 12137 10800.0 Thornley 421004009 1b 200.0 2003 06 01166 8400.5 Valade 334222090 1a 80.5 2001 05 20

Predefined fields Custom fields

1a Single-family residential 1b Multi-family residential 2 Commercial 3 Industrial 4 Institutional

Code Description

Linking to another relational table using a unique key Linking to a lookup tableusing a classification code

Fig 4-8 Table structure of a geodatabase 16

Page 17: Chapter 4 Spatial data & spatial DB sys 1. Introduction

Lot 65

Lot 66

BuildingLot l

ine

Lot l

ine

Feature Class Rule Feature Class

Lot_lines Must not have danglesLots Must not overlapOwner_parcel Must be closedLot_lines Must be covered by LotsBuildings Must be covered by Owner-parcelBuildings Must be covered by LotsBuildings Must not overlap Lot_linesLots Must be formed by Lot-linesLot_lines Must not overlap Buildings

Topology File

Fig 4-9 Storing topological relationships using an integrity rule

17

Page 18: Chapter 4 Spatial data & spatial DB sys 1. Introduction

4. Spatial DB systems

4.1 Definition & classification of spatial DB systems

three characteristics : a sort of DB sys offers spatial data type (SDT) & query language

provides at least spatial indexing & efficient algorithms for spatial joins

spatial DB sys works as the underlying technology of GIS

many spatial DBs are now developed as spatial data warehouse

→ supply GIS users w/ timely & relevant spatial data

spatial DB sys vs. GIS → Table 4-1

18

Page 19: Chapter 4 Spatial data & spatial DB sys 1. Introduction

GIS Tools andData Engine

Data File

Proprietary GISAPI

Proprietary GISData Format

GIS Applications

GIS Applications GIS ToolsProprietary

GIS API

SpatialApplications

Extended SQL

Extended SQLGeneric

DBMS UserInterface

GISData

Engine

GIS Applications GIS ToolsRDBMS

GISData

Engine

ProprietaryGIS API

ProprietaryGIS API

StandardSQL

(a) Data file-based spatial data processing using a GIS before the mid-1990s

(b) DBMS-based spatial data processing using a GIS in the late 1990s

(c) Today 뭩 spatial data processi

ORDBMSStored Spatial

Data ProcessingProcedures

Spatial Index

CorporateDatabase /

DataWarehouse

Data integration / sharing Data integration /sharing

Fig 4-10 Evolution of spatial data processing

19

Page 20: Chapter 4 Spatial data & spatial DB sys 1. Introduction

20

Page 21: Chapter 4 Spatial data & spatial DB sys 1. Introduction

4.2 Characteristics of spatial DB systems

4.2.1 Spatial data types (user-defined / abstract data types)

OGC geometry object model provides a conceptual standards-based framework for ADT

different SW vendors implement the concept in different ways

Oracle Spatial – 9 SDT called geometric primitive types IBM DB2 Spatial Extender – geometry type to describe its ADT

ESRI geodatabase – feature geometry

21

Page 22: Chapter 4 Spatial data & spatial DB sys 1. Introduction

(a) Geometry types used in the object-oriented model of Oracle Spatial

(b) Geometry types and sub-types of DB2 Spatial Extender

(c) Feature geometry of ArcGIS Geodatabase

Point Line string Polygon

Arc-line string Arc polygon Compound polygon

Compound line string Circle Rectangle

Super-type

Polygon

Rectangle

Square

Ellipse

Circle

Sub-type of geometry

Point

Multi-pointLine String

Multi-linestring

Multi-polygon

Sub-type ofpolygon

Sub-type ofrectangle

Sub-type ofellipse

Points Lines Polygons

Multipoint

Point

Multipart polyline

Single-part polyline

Path

Multipart polygone

Single-part polygon

Ring

Line Circular arc Elliptic arc Bezier curve

Segments

Fig 4-11 Spatial data type used Oracle Spatial, IBM DB2 Spatial Extender & ESRI Geodatabases

22

Page 23: Chapter 4 Spatial data & spatial DB sys 1. Introduction

4.2.2 Spatial data indexing & access method

spatial indexing – expedite access to & return of data to a user from a DB more complicated than table indexing – it deals w/ 2D space not linear array in tables

concept is the use of approximation to gradually narrow its search area until objects are found

numerous indexing methods – R tree, B tree, quadtree

R-tree : more commonly adopted method

multi-level tree that stores a set of rectangles in each node * the rectangle - minimum bounding rectangle (MBR)

index stores the reference numbers of the MBRs + coordinates of its 4 corners + object IDs

23

Page 24: Chapter 4 Spatial data & spatial DB sys 1. Introduction

R1 R2

R3 R4 R5 R6 R7 R8

R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 R20 R21

Root page

Branch pages

Leaf pages

R1

R2

R3

R4

R5

R6

R7

R8

R9

R10B

R11

C

R12

R13

R15R14

R16

R17

R18

R19

R20

R21

A

(a) The R-tree indexing hierarchy

(b) Spatial relationships among bounding boxes in a R-tree index

Fig 4-12 The R-tree index

24

Page 25: Chapter 4 Spatial data & spatial DB sys 1. Introduction

4.2.3 Spatial data integrity & constraints

integrity constraints - business rules to protect the data by ensuring accuracy, correctness, validity

six classes of spatial data integrity constraints (Cockcroft’s view)

static topological int conts – ex. all polygons must be closed

transition topological int conts – ex. if a polygon boundary is modified, all the conjugate

polygons must be updated simultaneously

static semantic int conts – ex. area of land parcel must not be negative

transition semantic int conts – ex. subdivided land parcels must have the same sum area as

the original land parcel

static user-defined int conts – ex. rivers wider than 2m must be stored as polygons

transition user-defined int conts – ex. after re-zoning a land parcel, the land use status must be

updated within 2 days

cf. data modeling & DB operations case (in Chapter 2)

: domain constraints, key& relation constraints, semantic constraints

25

Page 26: Chapter 4 Spatial data & spatial DB sys 1. Introduction

4.2.4 Long transaction management

DB transaction - involves movement of data in & out of DB + recording of the process

spatial DB transaction is different from the conventional DB transactions

need to handle long transactions (ex. road fabric update – takes several days, not seconds)

different vendors use different solutions to the long transactions problem

ex. Oracle – workspace manager

: support multiple versions of all records in a table

users can change these versions independently & share w/ others

26

Page 27: Chapter 4 Spatial data & spatial DB sys 1. Introduction

4.3 Spatial data processing

4.3.1 Classification of spatial operators

a spatial query is formulated using one / more operators

OGC classification of spatial operators (→ Table 4-2)

basic operators – allow to access the general properties of a geometry

topological operators – express spatial relationship between geometries

spatial analysis operators – allow to construct analytical spatial queries using a single /multiple geometries

27

Page 28: Chapter 4 Spatial data & spatial DB sys 1. Introduction

28

Page 29: Chapter 4 Spatial data & spatial DB sys 1. Introduction

4.3.2 Spatial operations & filtering

large size of a typical spatial DB + complexity of spatial operations → requires filtering

example solution : Oracle Spatial : two-tier approach

primary filter – reduce the number of candidate geometries by the spatial index of DB secondary filter – made up of one /more spatial operators

advantages - expedite the process of accessing the DB

29

Page 30: Chapter 4 Spatial data & spatial DB sys 1. Introduction

Primary Filter -Spatial Index

Large inputdata source

Smaller inputdata source

SecondaryFilter -Spatial

operators

Results ofSpatial queries

Fig 4-13 Spatial query using the method of two-tier filtering

30

Page 31: Chapter 4 Spatial data & spatial DB sys 1. Introduction

4.3.3 Topological relations & predicates

among many spatial operators, topological operators play a significant role in spatial queries

topological relations are used w/ predicates

* predicates = Boolean function, return 1(TRUE) if a comparison meets the function criteria 0(FALSE) otherwise

basic problem w/ the use of topological predicates is to define all possible relationships

DE-9IM (Dimensionally Extended 9 Intersection Model) – define 52 topological relationships

→ too many to be implemented in a spatial DB sys !

thus, most spatial sys include a subset of the possible topological relations (Fig 4-14)

31

Page 32: Chapter 4 Spatial data & spatial DB sys 1. Introduction

x1x2

Disjoin (x1, x2)

x2 x2 x1x1

x1

x2

x1 / x2x1 x2

x2 x1x2 x1

Meet (x1, x2) Overlay (x1, x2) Cover (x1, x2)

Covered-by (x1, x2) Inside (x1, x2)Contain (x1, x2)Equal (x1, x2)

Fig 4-14 The most common topological relations in spatial systems

32

Page 33: Chapter 4 Spatial data & spatial DB sys 1. Introduction

4.3.4 Spatial joins

spatial join : a spatial query that compares two / more geometries

4.3.5 Spatial SQL

standard SQL is extended by spatial operators (from 1980s)

spatially extended SQL consists of 2 parts : query language + presentation language

query language – define what data to retrieve presentation language – specify how the results of a query are displayed

many spatial extensions to conventional DB sys

ex. Oracle Spatial, IBM DB2 Spatial Extender

33

Page 34: Chapter 4 Spatial data & spatial DB sys 1. Introduction

SELECT parcel.nameFROM parcel, subdivisionWHERE within (parcel.loc, subdivision.loc)AND subdivision.name=봠ranebrook?

(a) Preservation of the basic SQL SELECT-FROM-WHERE construct

CREATE TABLE parcel (parcel.ID char(20) geometry ST_polygon)

(b) Defining a spatial object type 뱎arcel?as a spatial data _polygon?

SELECT cityFROM ontario.cityWHERE geometry = PICK;SELECT cityFROM ontario.cityWHERE city.name = 밯aterloo?

(c) Query by location 밣ICK?(by means of a mouse) and by attribute value 밯aterlo

SET CONTEXTFOR parcel.geometrySELECT parcel.geomemtry, building.geometry, road.geometry, easement geometryFROM parcel, building, road, easementWHERE parcel.ID = 밚ONDON00221122145678”

(d) Setting the background information (building, road, easement) for a spatial object 뱎a

SET LEGEND COLOUR green

LINE.TYPE dashedFOR SELECT boundary.geometryFROM parcel

(e) Setting the property of a legend

SELECT parcelFROM parcel.layerWHERE geometry = ZOOM.WINDOW;SELECT parcelFROM parcel.layerWHERE geometry = PICK

(f) Restricting a query to a specific area

Fig 4-15 Examples of using spatial SQL

34