Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

Manage spatial data with IBM DB2 Spatial Extender, Part 1: Acquiring spatial data and developing applications

Tips and techniques for developing efficient spatial applications

David Adler (dadler@us.ibm.com), Senior Software Engineer, IBM China
David Adler
David Adler has been responsible for the development of spatial database technology in IBM for over 20 years, the past 10 years in DB2 Spatial Extender Development.

Summary:  This tutorial series describes common tasks to manage spatial data with IBM DB2® Spatial Extender, including importing and creating spatial data, constructing and executing spatial queries, working with IBM, third party, and open source spatial tools, tuning performance, and considering special circumstances in a data warehouse environment. In this first article in the series, learn how to acquire spatial data and build applications. Learn how to use shapefiles, spatial data tables, and spatial indexes.

View more content in this series

Date:  16 Feb 2012
Level:  Intermediate PDF:  A4 and Letter (862 KB | 30 pages)Get Adobe® Reader®

Comments:  

Getting started

DB2 Spatial Extender overview

Installing and setting up DB2 Spatial Extender provides the following main features and components:

Spatial datatypes
A set of datatypes that can be used to define table columns that will contain spatial data. This includes ST_Point, ST_Linestring, and ST_Polygon for atomic spatial values. This also includes ST_MultiPoint, ST_MultiLinestring, and ST_MultiPolygon for homogeneous collections of spatial values.
Spatial functions and predicates
A large number of SQL UDFs to create spatial values, return information about spatial values, identify spatial relationships, and perform operations on spatial values. These spatial UDFs can be incorporated into SQL queries, which exploit all the capabilities of the SQL language.
Spatial index
A spatial index mechanism is provided to support the two-dimensional nature of spatial data. Tools are available to help specify a spatial index.
Spatial command line processor (CLP) - db2se
The db2se CLP provides a convenient command line interface to spatial stored procedures for operations such as spatially enabling a database and importing or exporting spatial data.

See Resources for more details about the Spatial Extender in the DB2 Infocenter.

Spatial reference systems and coordinate systems

Spatial data is typically represented by tuples of coordinate values, most often x, y, although support is provided for z and m coordinates as well. This tutorial considers data with only x and y coordinate values. It will also consider data that uses only latitude and longitude values in degrees as decimal values. Note that when working with latitude and longitude, longitude corresponds to x and latitude corresponds to y.

In order to correctly perform spatial operations, every spatial value must have a coordinate system associated with it that describes the relationship of the coordinate values to a position on the earth's surface. Although Spatial Extender provides over 3000 different pre-defined coordinate systems, this tutorial addresses only the two most commonly used: NAD83 for coordinates in North America and WGS84 for worldwide coordinates. Note that most GPS devices report coordinates using WGS84.

In order to efficiently store and process spatial data, Spatial Extender represents coordinates internally as 64-bit integers. Spatial Extender manages this through the use of a spatial reference system (SRS) that specifies offsets and a scale factor used to convert the user representation in a DOUBLE value back and forth from the internal representation. Each SRS also has a coordinate system associated with it. It is actually the SRS that is associated with each spatial value. An SRS may be referred to by either its 128-character-value name (referred to as srsName or SRS_NAME) or its 32-bit-integer identifier (referred to as srid or SRS_ID). The srid is used in SQL statements, and the srsName is used with the db2se CLP, most often when importing spatial data.

Spatial Extender provides the SRS named NAD83_SRS_1 with srid 1 for data using the NAD83 coordinate system. Spatial Extender provides the SRS name WGS84_SRS_1003 with srid 1003 for data using the WGS84 coordinate system. Refer to the documentation in the DB2 Infocenter if you need to work with a different coordinate system.

2 of 11 | Previous | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management
ArticleID=793988
TutorialTitle=Manage spatial data with IBM DB2 Spatial Extender, Part 1: Acquiring spatial data and developing applications
publish-date=02162012
author1-email=dadler@us.ibm.com
author1-email-cc=