A quick tour of using SQL with the ST_Geometry and ST_Raster types

You can use the database management system's (DBMS) Structured Query Language (SQL), data types, and table formats to work with the information stored in a geodatabase. SQL is a database language that supports data definition and data manipulation commands.

Accessing the information in a geodatabase via SQL allows external applications to work with the tabular data managed by the geodatabase. These external applications can be nonspatial database applications or custom spatial applications developed in an environment other than ArcObjects.

You can issue SELECT statements against any of the supported DBMS types for geodatabases, as well as against file-based data sources. The topics About building a SQL expression and SQL reference provide you with information about building SELECT statements for different data sources.

CautionCaution:

Be aware that using SQL to access the geodatabase bypasses geodatabase functionality, such as versioning, topology, networks, terrains, feature-linked annotation, or other class or workspace extensions. It may be possible to use DBMS features such as triggers and stored procedures to maintain the relationships between tables needed for certain geodatabase functionality. However, executing SQL commands against the database without taking this extra functionality into account—for example, issuing INSERT statements to add records to a business table or adding a column to an existing feature class—will circumvent geodatabase functionality and possibly corrupt the relationships between data in your geodatabase.

In general, the following guidelines apply when using SQL to modify information in the geodatabase:

The preceding guidelines apply to any attribute, spatial or nonspatial. This book of the help focuses on using SQL for spatial selections, altering data, and altering the properties of data stored in the ST_Geometry and ST_Raster data storage types.

The ST_Geometry storage type

The ST_Geometry SQL data type is used in geodatabases stored in DB2, Informix, Oracle, and PostgreSQL. This data type can be used within the geodatabase plus it provides SQL access to simple feature class geometry for third-party applications.

ST_Geometry implements the OGC and ISO SQL Multimedia Specification for Spatial. The OGC reference is OpenGIS Implementation Specification for Geographic information —Simple feature access—Part 2: SQL option. The ISO reference is ISO/IEC 13249-3 SQL multimedia and application packages—Part 3: Spatial.

For information on using SQL with the ST_Geomery type in DB2 or Informix, consult the IBM DB2 and Informix documentation. For information on using SQL with the ST_Geometry type in Oracle and PostgreSQL, see the subsequent section.

TipTip:

The "Using spatial types with SQL" section of this help does contain some examples for DB2 and Informix; however, for complete information on using ST_Geometry with these databases, read the IBM documentation.

Using SQL functions with ST_Geometry in Oracle and PostgreSQL

To access, analyze, and manipulate data using SQL, you need to utilize the functions installed with ArcSDE.

These functions can be grouped based on their use.

The ST_Raster storage type

You can use the ST_Raster data type in your ArcSDE geodatabases. This data type can be used within the geodatabase plus it provides SQL access to raster data for third-party applications.

The ST_Raster type is available in ArcSDE geodatabases in Oracle, PostgreSQL, and Microsoft SQL Server.

Two different categories of ST_Raster functions are used to access the ST_Raster type using SQL:

ST_Raster and ST_PixelData functions

These are methods that instantiate and work with the ST_Raster object.

ST_RasterUtil stored procedure utilities

The ST_RasterUtil stored procedures support the creation and maintenance of the ST_Raster type. Available functions are as follows:

ST_RasterUtil_checkLibraryVersion

ST_RasterUtil.describe

ST_RasterUtil.getVersion

ST_RasterUtil_getLibraryVersion

ST_RasterUtil.initialize

Related Topics


11/18/2013