View
215
Download
0
Category
Tags:
Preview:
Citation preview
GIS Databases
Jin Jie, Adrienne MacKay, Laura SaslawINLS 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 • Quantities
• Nearby Features
• Densities
• What’s Inside • 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
http://bgis.sanbi.org/GIS-primer/page_09.htm
2. Attribute
– Tabular – Hierarchical – Network – Relational – Object Oriented
Examples:
transportation networkspolitical boundariesclimatic regionselevation features
Examples:
socio-economic dataeconomic datamarketing datageographic names
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
• high resolution images can be analyzed by eye
• compatible with remote sensing data
Disadvantages
• requires a lot of storage space
* http://www.colorado.edu/geography/gcraft/notes/datacon/datacon_f.html
Vector Data
* http://www.colorado.edu/geography/gcraft/notes/datacon/datacon_f.html
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)
Advantages
• can be very high resolution
• graphical output similar to hand drawn map
• requires less storage space
Disadvantages
• structures are complex
Node TableNode ID Easting Northing
1 126.5 578.12 218.6 581.93 224.2 470.44 129.1 471.9
Node Feature Attribute TableNode ID Control Crosswalk ADA?
1 light yes yes2 stop no no3 yield no no4 none yes no
Arc TableArc ID From N To N L Poly R PolyI 4 1 A34II 1 2 A34III 2 3 A35 A34IV 3 4 A34 Polygon Feature AttributeTable
Polygon ID Owner AddressA34 J. Smith 500 BirchA35 R. White 200 Main
Polygon TablePolygon ID Arc ListA34 I, II, III, IVA35 III, VI, VII, XI
Arc Feature Attribute TableArc ID Length Condition Lanes NameI 106 good 4II 92 poor 4 BirchIII 111 fair 2IV 95 fair 2 Cherry
Birch
Cherry
I
II
III
IV
1
4 3
Relational Representation
Spatial DataAttribute Data
A35SmithEstateA34
2
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
R-tree
http://en.wikipedia.org/wiki/R-tree
-Hierarchically nested
- 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.
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 TypesData 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/products/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:
And vector images look like this:
(my house!)
Vector
http://ngmdb.usgs.gov/ngmdb/ngm_SMsearch.html
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/Vector_graphics)
Raster
http://earthobservatory.nasa.gov/Newsroom/NewImages/images_index.php3
Floods in Argentina
Raster graphics is the representation of images as a collection of pixels (dots).
(http://en.wikipedia.org/wiki/Vector_graphics)
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_explorer/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 traffichttp://www.traffic.com/Raleigh-Durham-Traffic/Raleigh-Durham-Traffic-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
ResourcesInformation
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
Recommended