Beruflich Dokumente
Kultur Dokumente
Spatial Join(*)
A spatial join associates two tables based on a
spatial relationship, rather than an the classic
non-spatial relational attribute. A spatial join
operation is used to combine two or more dataset
with respect to a spatial predicate or spatial
operation. Predicates can be a combination of
directional, distance, and topological spatial
relations (e.g. overlap, contains). In case of nonspatial join, the joining attributes must of the
same type, but for spatial join they can be of
different types.
Query: For all the rivers listed in the River table, find the
countries through which they pass.
SELECT R.Name, C.Name
FROM River R, Country C
WHERE Cross(R.Shape,C.Shape)=1
The spatial predicate Cross is used to join River and
Country tables.
Spatial Joins(*)
In practice, spatial join operations are
divided into a filter step and a refinement
step to efficiently process complex spatial
data types such as point collections in a
row instance. In the filter step, the spatial
objects are represented by simpler
approximations such as their Minimum
Bounding Rectangle or Box (MBR or
MBB).
select
m.name,
sum(v.ndp) as ndp,
sum(v.lib) as liberal,
sum(v.gp) as green,
sum(v.upbc) as unity,
sum(v.vtotal) as total
from bc_voting_areas v, bc_municipality
m,
where
v.the_geom && m.the_geom
and
intersects(v.the_geom, m.the_geom)
group by m.name
order by m.name;
connected to a DBMS.
A GIS cannot efficiently manage large quantities
of non-spatial data (e.g. at government
department level).
They lack ad hoc querying capability (they
provide a restricted form of predefined queries)
They lack indexing structures for fast external
data access (they use in memory techniques).
They lack a 'logic' (e.g. first order logic of the
relational calculus)
Data independence
Data Abstraction
Self-describing
Concurrency
Distributed capabilities
High performance
Supports spatial data
types using ADTs.
Alternative: files
Composed
Geometry
SpatialReferenceSystem
Sub Type
Relationship
Point
Curve
Surface
LineString
Polygon
Line
LinearRing
GeometryCollection
MultiSurface
MultiCurve
MultiPolygon
MultiLineString
MultiPoint
following headings.
Basic Methods on Geometry
Methods for testing Spatial Relations
between geometric objects
Methods that support Spatial Analysis
Geometry Collection
Contains Relation
Does the base geometry (small circles) contain the comparison geometry
(big circles)?
Touches Relation
Does the base geometry (small circles) touch the comparison geometry
(big circles) ?
Spatial Methods
Convex Hull
The convex hull of a set of points is the intersection of all convex sets which
contain the points. A set of points is convex if and only if for every pair of
points p,q in S, the line segment pq is completely contained in S.
Latin languages
Anglo-Saxon
Indexing
Indexing is used to speed up queries and locate
rows quickly
Traditional RDBMS use 1-d indexing (B-tree)
Spatial DBMS need 2-d, hierarchical indexing
Grid
Quadtree
R-tree
Others
R-tree
Minimum
Bounding
Rectangle
Study
Area
approach.
Uses a RDBMS to store 'attribute' or descriptive
information e.g. the name of a road not its geometry.
A specific module for spatial data management.
Drawbacks
The coexistence of heterogeneous data models, which
implies difficulties in modeling use and integration.
A partial loss of DBMS techniques e.g. recovery,
querying, optimization.
Geometric Processing
(GIS)
Database
Files
Crosses
Within
Overlaps
Contains
Area
Length
Point on surface
Return geometry
as SVG
PostGIS
Spatial Functions
OpenGIS
Coord Transform
Spatial Aggregates
Informix
DB2
Oracle
Spatial Objects
R-Tree Index
Internet
Editing
Loading
Analysis
Mapping
Database
Features
GIS
GIS
Web
Client
Other
ProstgreSQL
PostgreSQL itself provides the main
Inheritance
Functions
Constraints
Triggers
Rules
Transactional integrity
PostgreSQL/PostGIS
The data is stored in a relatively simple format with
the attributes and geometry stored in a single
table.
Spatial
Attribute Data
name
Brio Refining
Crystal Chemical
North Cavalcade
Dixie Oil Processors
Federated Metals
city
Friendswood
Houston
Houston
Friendswood
Houston
hrs
50.38
60.9
37.08
34.21
21.28
status
active
active
active
active
active
st_fed
the_geom
Fed
SRID=32140;POINT(968024.87474318
4198600.9516049)
Fed
SRID=32140;POINT(932279.183664999
4213955.37498466)
Fed
SRID=32140;POINT(952855.717021537
4223859.84524946)
Fed
SRID=32140;POINT(967568.655313907
4198112.19404211)
State
SRID=32140;POINT(961131.619598681
4220206.32109146)
Coordinate Projection
SRID=3005;MULTILINESTRING((1004687.04355194594291.
053764096,1004729.74799931 594258.821943696))
SRID=4326;MULTILINESTRING((125.934150.364070000000
1,-125.9335 50.36378))
Coordinates of one table can be converted to those of another table. This
permits the geometry in each table to match. Relatively easy to do in PostGIS
table name
geometry
column
coord
dim
brazos
texas_counties
the_geom
32139
MULTIPOLYGON
brazos
texas_rivers
the_geom
32139
MULTILINESTRING
brazos
texas_roads
the_geom
32139
MULTILINESTRING
brazos
tx_maj_aquifers
the_geom
32139
MULTIPOLYGON
brazos
tx_min_aquifers
the_geom
32139
MULTIPOLYGON
brazos
txzip_codes
the_geom
32139
MULTIPOLYGON
brazos
bz_landmarks
the_geom
32139
POINT
srid
type
spatial_ref_sys
postgis=# \d spatial_ref_sys
Table "public.spatial_ref_sys"
Column
|
Type
| Modifiers
-----------+-------------------------+----------srid
| integer
| not null
auth_name | character varying(256) |
auth_srid | integer
|
srtext
| character varying(2048) |
proj4text | character varying(2048) |
Indexes:
"spatial_ref_sys_pkey" PRIMARY KEY, btree (srid)
geometry_columns
postgis=# \d geometry_columns
Table "public.geometry_columns"
Column
|
Type
| Modifiers
-------------------+------------------------+----------f_table_catalog
| character varying(256) | not null
f_table_schema
| character varying(256) | not null
f_table_name
| character varying(256) | not null
f_geometry_column | character varying(256) | not null
coord_dimension
| integer
| not null
srid
| integer
| not null
type
| character varying(30) | not null
Indexes:
"geometry_columns_pk" PRIMARY KEY, btree
(f_table_catalog, f_table_schema, f
_table_name, f_geometry_column)
Database Rules
Rules help prevent human error when
modifying a data set
Rules are user defined
Rules are such things as;
A fire hydrant must be located on a water
line
Rivers should flow down hill.
Constraints
Constraints are similar to rules, but are
less assertive.
Constraints are provided by the DBMS
and are applied by the user
A Constraint would be Parcel_ID Not Null
- meaning a number ID has to be
provided when a parcel is created.
Constraints
Constraint
GIS examples
Two spatial objects cannot exist at the same point
Uniqueness
Non-Null
Range
Relationship
Cardinality
Inclusion
Covering
Disjointedness
Referential Integrity
Geometrical
Orientation
Topological
General
Constraints
How can we define in front of?
Data integrity
Valid
Invalid
Joins(*)
Dynamic tables can be joined with the
geometry tables for querying purposes
A primary key is used to relate the 2 tables
together
A primary key is a unique identifier for
each row in a table
Primary Key
ID
1
2
3
4
5
1
2
3
4
5
the_geom
SRID=32140;POINT(968024.87474318 4198600.9516049)
SRID=32140;POINT(932279.183664999 4213955.37498466)
SRID=32140;POINT(952855.717021537 4223859.84524946)
SRID=32140;POINT(967568.655313907 4198112.19404211)
SRID=32140;POINT(961131.619598681 4220206.32109146)
Spatial Join
Temporal Queries
Find where (x,y) and when(t) will it snow :
Clouds(X, Y, T, humidity)
Region(X, Y, T, temperature)
(SELECT x, y, t
FROM
Clouds
WHERE humidity >= 80)
INTERSECT
(SELECT x, y, t
FROM
Region
WHERE temperature <= 32)
A
F1
B
Purple line segment
represents both a road
and a fence.
A
F1
B
Lets add an administrative region (outer red rectangle) and some houses
A
F2
F3
B
Time2
A
F1
F2 F3
B
assumed)
Was there a route from A to B in Time1?
Does the route in query 1 pass through
the administrative region?
Does the route in query 1 pass touch the
administrative region ?
What fields were adjacent to F2 in
Time2?
References
http://www.spatial.cs.umn.edu/Book/
Spatial Databases:
With Application to GIS
Rigaux, Scholl, Voisard
Geography Mark-Up
Language:
Foundation for the
Geo-Web
References