* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Examples of GIS websites
Survey
Document related concepts
Transcript
GIS Databases
Jin Jie, Adrienne MacKay, Laura Saslaw
INLS 623 Database Systems I
April 18, 2007
GIS/Databases
Presentation Outline
• Overview (Adrienne)
*
• Tools (Jimmy)
• Examples (Laura)
* http://www.gis.com/whatisgis/graphics/gislayers.gif
What is GIS?
Geographic Information System:
“GIS is a collection of computer hardware,
software, and geographic data for
capturing, managing, analyzing, and
displaying all forms of geographically
referenced information.” *
* www.gis.com
Features of GIS
• Modern GIS uses digitized material
• Any variable that can be located spatially can be
used
• Primary requirement is knowing location:
– longitude, latitude, elevation
– geocode systems (zipcode, highway mile markers)
• Layers of information can be generated
• Expansive number of maps and databases
available
Working with Spatial Data Sources
Data Sources
– physical maps and records
– existing digital data
– remotely sensed data
• photogrammetry (aerial photography)
• satellite imagery (GPS, LIDAR)
• ground surveying
Integration of sources and challenges
– different coordinate systems, appropriate transformations
– merging maps with varying degrees of accuracy, rubber-banding
– interpolation (for missing data)
(note: enormous amounts of GIS data is available online)
Elmasri R, Navathe SB. Fundamentals of Database Systems. Fourth Ed.
www.wikipedia.org
GIS Across Disciplines
• Help people find resources with interactive maps (city of San
Diego)
• Track weather fronts and hurricanes (Florida Power and Light)
• Establish baseline information about bottle-nosed dolphins in
Florida Bay (The South Florida Ecosystem Restoration Program).
• Study the effects of global warming by the melt of glaciers in the
Himalayas
• Estimate travel time and traffic (city of Baltimore)
• Provide access to information previously difficult to use or
inaccessible (Libraries and Museums)
• Use as powerful visualization tool for education (K-12,
universities)
• Plan for emergency response (SAIC, FEMA)
• Allocate law enforcement resources
• Provide financial users with purchasing habits and behavior of
their customers
http://www.gis.com/whatisgis/geographymatters.pdf
GIS Views
• Database
• Map
• Model
Maps
• Locations
• Nearby Features
• Quantities
• What’s Inside
• Densities
• Changes over time
* http://www.gis.com/whatisgis/dowithgis.html
GIS Databases
• AKA: geodatabases, spatial databases
“…is a database with extensions for storing,
querying, and manipulating geographic
information and spatial data.” *
“the objects in a spatial database are
representations of real-world entities with
associated attributes” **
* http://en.wikipedia.org/wiki/Geodatabase
** http://www.geog.ubc.ca/courses/klink/gis.notes/ncgia/u11.html#SEC11.1
Types of Data
1. Spatial
– Vector
– Raster
– Image
Examples:
transportation networks
political boundaries
climatic regions
elevation features
2. Attribute
–
–
–
–
–
Tabular
Hierarchical
Network
Relational
Object Oriented
Examples:
socio-economic data
economic data
marketing data
geographic names
http://bgis.sanbi.org/GIS-primer/page_09.htm
Raster Data
Spatial data represented by:
• grid of cells
• cell size defines resolution
• each cell has a unique reference
that is used to attribute data
Advantages
• simple data structure and
processing
Disadvantages
• requires a lot of storage space
• high resolution images can be
analyzed by eye
• compatible with remote sensing
data
* http://www.colorado.edu/geography/gcraft/notes/datacon/datacon_f.html
Vector Data
Spatial data represented by:
• points (non-adjacent features)
• lines (represent linear features,
solid, dashed, color, thickness)
• polygons to represent objects
(boundaries, location points, etc);
most commonly used, represent
areas (color or pattern coded)
Disadvantages
Advantages
• can be very high resolution
• structures are complex
• graphical output similar to
hand drawn map
• requires less storage space
* http://www.colorado.edu/geography/gcraft/notes/datacon/datacon_f.html
1
I
4
II
Smith
Estate A34
IV
2
Birch
III
A35
3
Cherry
Spatial Data
Node Table
Node ID Easting Northing
1 126.5
578.1
2 218.6
581.9
3 224.2
470.4
4 129.1
471.9
Arc Table
Arc ID From N To N L Poly
I
4
1
II
1
2
III
2
3 A35
IV
3
4
Polygon Table
Polygon ID
Arc List
A34
I, II, III, IV
A35
III, VI, VII, XI
Relational Representation
R Poly
A34
A34
A34
A34
Attribute Data
Node Feature Attribute Table
Node ID Control
Crosswalk
1 light
yes
2 stop
no
3 yield
no
4 none
yes
ADA?
yes
no
no
no
Arc Feature Attribute Table
Arc ID Length Condition Lanes Name
I
106 good
4
II
92 poor
4 Birch
III
111 fair
2
IV
95 fair
2 Cherry
Polygon Feature AttributeTable
Polygon ID Owner
Address
A34
J. Smith 500 Birch
A35
R. White 200 Main
http://www.utdallas.edu/~briggs/poec5319/struct.ppt
Spatial Data Indexing
Grid (spatial index)
Quadtree
Octree
UB-tree
R-tree – The most common one
R-tree
• R-trees: tree data structures( similar to B-trees), dedicated for
spatial access methods.
• For example: A common real-world usage for an R-tree might
be: "Find all museums within 2 miles of my current location".
http://en.wikipedia.org/wiki/R-tree
-Hierarchically nested
R-tree
- Minimum bounding
rectangles
- Each node has a
variable number of
entries.
- Node stores two pieces
of data 1)Node ID 2)
Bounding box of all
entries within this child
node.
http://en.wikipedia.org/wiki/R-tree
Operations with R-tree Indexing
• Insertion / Deletion: using the bounding boxes from the
nodes to ensure that "nearby" elements are placed in the same
leaf node.
• Searching : using the bounding boxes to decide whether or not
to search inside a child node. (many nodes may never be
touched)
http://en.wikipedia.org/wiki/R-tree
Databases with spatial capability
• MySQL - Mysql Spatial Extensions
• Oracle – Oracle Spatial
• Postgres - PostGIS
Mysql Spatial Extensions
• MySQL 4.1: introduces spatial functionality in MySQL
• Motivation: Database that only works on simple data types,
such as INTEGER or DECIMAL, will just not be good enough
for geographic information.
http://dev.mysql.com/tech-resources/articles/4.1/gis-with-mysql.html
OpenGIS® Simple Features
specifications for SQL
MySQL GIS Datatypes (abstract types in gray)
The Open Geospatial Consortium (OGC) publishes the OpenGIS® Simple Features
Specifications For SQL, to propose conceptual ways for extending an SQL RDBMS to support
spatial data.
http://dev.mysql.com/tech-resources/articles/4.1/gis-with-mysql.html
Geometry Value
Properties of an internal geometry value:
• Type (point, linestring, polygon etc.). Exampel:point(1,1),
• SRID (Spatial Reference Identifier) - identifies the geometry's
associated Spatial Reference System .
• Coordinates. Example. Linestring(1 1, 3 4)
• Interior, Boundary, and Exterior – Exterior: all space
not occupied by the geometry. Interior: the space
occupied by the geometry. Boundary is the interface
between the geometry's interior and exterior.
http://dev.mysql.com/doc/refman/5.0/en/opengis-geometry-model.html
Geometry Value
• MBR (Minimum Bounding Rectangle) – It is formed by the minimum and
maximum (X,Y) coordinates.
• Its dimension (–1, 0, 1, or 2)
– –1: an empty geometry.
– 0 : no length and no area.
– 1: non-zero length and zero area.
– 2: non-zero area.
• Simple / non-simple (LineString, MultiPoint, MultiLineString) - whether
there are two points are equal.
• Closed / not closed (LineString, MultiLineString) – whether it forms a ring.
• Empty / non-empty – whether it has at least one point.
Data Types
Data types holding single geometry values:
•
•
•
•
GEOMETRY (geometry values of any type)
POINT
LINESTRING
POLYGON
Data types hold collections of values:
•
•
•
•
MULTIPOINT
MULTILINESTRING
MULTIPOLYGON
GEOMETRYCOLLECTION( a collection of objects of any type )
http://dev.mysql.com/doc/refman/5.0/en/mysql-spatial-datatypes.html
Creating Spatial columns
• Currently, spatial columns are supported for
MyISAM, InnoDB, NDB, BDB, and ARCHIVE
tables.
• Create a table with a spatial column:
CREATE TABLE geom (g GEOMETRY);
• Add / drop a spatial column:
ALTER TABLE geom ADD pt POINT;
ALTER TABLE geom DROP pt;
http://dev.mysql.com/doc/refman/5.0/en/creating-spatial-columns.html
Populating Spatial Columns
• Values should be stored in internal geometry format, but you
can convert them to that format from either Well-Known Text
(WKT) or Well-Known Binary (WKB) format.
• INSERT INTO geom
VALUES (GeomFromText('POINT(1 1)'));
• INSERT INTO geom
VALUES (GeomFromText(LINESTRING(0 0,1 1,2 2) ));
http://dev.mysql.com/doc/refman/5.0/en/populating-spatial-columns.html
Fetching Spatial Data
• Fetching spatial data in internal format(useful for inter-table transferring)
CREATE TABLE geom2 (g GEOMETRY)
SELECT g
FROM geom;
• In WKT format - The AsText() function converts a geometry from internal
format into a WKT string(text).
SELECT AsText(g)
FROM geom;
• In WKB format: - The AsBinary() function converts a geometry from
internal format into a BLOB containing the WKB value.
SELECT AsBinary(g)
FROM geom;
http://dev.mysql.com/doc/refman/5.0/en/fetching-spatial-data.html
Functions
• Conversion: AsBinary(g) , AsText(g), GeomFromText(wkt[,srid]) ,
GeomFromWKB(wkb[,srid])
• Geometry: Dimension(g), Envelope(g) , GeometryType(g), SRID(g) etc.
• Point: X(p), Y(p)
• LineString: EndPoint(ls), GLength(ls), NumPoints(ls) etc.
• MultiLineString: GLength(mls), IsClosed(mls)
• Polygon / MultiPolygon: Area() etc.
• GeometryCollection: NumGeometries(gc)
• More…….
http://dev.mysql.com/doc/refman/5.0/en/functions.html
Creating / Dropping Spatial Index
• Similar to build regular index, but extended with the
SPATIAL keyword.
CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g));
ALTER TABLE geom ADD SPATIAL INDEX(g);
CREATE SPATIAL INDEX sp_index ON geom (g);
• Drop Index:
ALTER TABLE geom DROP INDEX g;
DROP INDEX sp_index ON geom;
http://dev.mysql.com/doc/refman/5.0/en/creating-spatial-indexes.html
Applications
• ESRI: ArcInfo
- It has a dominant share of the GIS software market with its
software used by 77% of GIS professionals
• Other vendors:
- MapInfo
- Intergraph
Shape Files
• Developed by ESRI
• It is a digital vector storage format for storing geometric location
and associated attribute information.
• They can be stored locally or accessed from remote sites(ie.
Davis Library GIS)
Mandatory files :
• .shp - the file that stores the feature geometry
• .shx - the file that stores the index of the feature geometry
• .dbf - the database of attributes
Optional Files: sbn, .sbx etc.
Connect ArcInfo to Database Server
See ArcInfo Example
GIS Standards
Standards have been developed by industry,
government, and the ISO for managing
geometric objects in RDMSs:
•
•
•
•
•
Storage options
Metadata
Table layer schema
Geometry types
SQL spatial data types
GIS database
standards
• ESRI Developer Network
http://edndoc.esri.com/arcsde/9.1/general_topics
/storing_geo_in_rdbms.html
• GIS open standards:
http://www.opengeospatial.org/ogc
• compliant products:
http://www.opengeospatial.org/resource/product
s/compliant
There are 2 types of file formats we most often see on
websites: raster and vector
The most common GIS raster data are
satellite images:
(my house!)
And vector images look like this:
Vector
Vector graphics…is
the use of geometrical
primitives such as
points, lines, curves,
and polygons, which are
all based upon
mathematical equations
to represent images in
computer graphics.
(http://en.wikipedia.org/wiki/Vec
tor_graphics)
http://ngmdb.usgs.gov/ngmdb/ngm_SMsearch.html
Floods in Argentina
Raster
Raster graphics is the
representation of images as a
collection of pixels (dots).
(http://en.wikipedia.org/wiki/Vector_graphics)
http://earthobservatory.nasa.gov/Newsroom/NewImages/imag
es_index.php3
Raster and vector are often seen together
• The state
boundaries are
______?______
• The colorful stuff
is _____?______
http://www.weather.gov/forecasts/graphical/sectors/
More examples of raster overlaid with vector
• http://www.biodiversity.bz/mapping/map_explore
r/dev_index.phtml
Vector over raster
http://www.zillow.com
Entered my address: 300 Reade Road, 27516
Examples Across Disciplines
• Help people find resources with interactive maps
http://mapmyrun.com/
• Track weather fronts and hurricanes
http://www.wunderground.com/global/Region/g4/2xIRSatellite.html
• Establish baseline information and track marine life.
http://www.esri.com/industries/marine/index.html
• Estimate travel time and traffic
http://www.traffic.com/Raleigh-Durham-Traffic/Raleigh-DurhamTraffic-Reports.html?ct=ma_map
http://www.gis.com/whatisgis/geographymatters.pdf
Trends
• GPS (vehicle navigation systems) have
become inexpensive and accurate
• Mass scale agriculture is using GIS, called
Precision Farming, to yield larger crops
and more profits
• US and other ports are using GPS to find
cargo containers on the lots for security
• Telemitry – http://www.traffic.com
GIS Advantages & Disadvantages
Advantages:
• Data availability
• Make better decisions
• Spans many disciplines
• Project planning
• Visual analysis
• Organizational Integration
Disadvantages:
• Complex system
• Data collection can be time-consuming
• Needs specialized equipment
• Privacy issues
Resources
Information
GIS at UNC (gis.unc.edu)
ESRI’s Guide to GIS (www.gis.com)
GIS on wikipedia (http://en.wikipedia.org/wiki/Gis)
Software
ESRI (available to UNC students for free)
http://www.esri.com/
Open Source GIS packages:
• GRASS GIS
• Quantum GIS