Geospatial functions
At the core of Geospatial Analytics are the scalar functions and table functions provided as part of Db2® for i.
The implementation of these geospatial functions follows the OGC Simple Features for SQL
specification and parts of the ISO SQL/MM Part 3: Spatial standard.
- Construction of geometries from data exchange formats or coordinate data
- Conversion of a geometry into a data exchange format
- Comparison of geometries and discovery of relations between geometries
- Construction of new geometries from existing geometries
- Information about geometries
- Creation of geohashes
Construction of geometries from data exchange formats or coordinate data
The following scalar functions create a geometry of the ST_GEOMETRY type or one of its subtypes from coordinate data, or from a well-known text (WKT), or a well-known binary (WKB) data exchange format:
Function Use | Function Name |
---|---|
Construct any geometry from a WKT, WKB | ST_GEOMETRY scalar function |
Construct any geometry from a WKT object | ST_WKTTOSQL scalar function |
Construct any geometry from a WKB object | ST_WKBTOSQL scalar function |
Construct a specific geometry from a WKT or WKB |
ST_GEOMCOLLECTION scalar function ST_MULTILINESTRING scalar function |
Construct a specific geometry from coordinates | ST_POINT scalar function |
Conversion of a geometry to a different geometry type
The following scalar functions convert one geometry type to a different geometry type:
Function Use | Function Name |
---|---|
Convert a geometry into a linestring geometry | ST_TOLINESTRING scalar function |
Convert a geometry into a multiline geometry | ST_TOMULTILINE scalar function |
Convert a geometry into a multipoint geometry | ST_TOMULTIPOINT scalar function |
Convert a geometry into a multipolygon geometry | ST_TOMULTIPOLYGON scalar function |
Convert a geometry into a point geometry | ST_TOPOINT scalar function |
Convert a geometry into a polygon geometry | ST_TOPOLYGON scalar function |
Conversion of a geometry into a data exchange format
The following scalar functions convert a geometry of the ST_GEOMETRY type or one of its subtypes into a data exchange format:
Function Use | Function Name |
---|---|
Convert a geometry into a WKT object | ST_ASTEXT scalar function |
Convert a geometry into a WKB object | ST_ASBINARY scalar function |
Comparison of geometries and discovery of relations between geometries
These geospatial scalar functions return information that is the result of a comparison between geometries. They return information about ways in which geographic features relate to one another or compare with one another.
Function Use | Function Name |
---|---|
Check whether two items geometries are identical | ST_EQUALS scalar function |
Determine the distance between geometries | ST_DISTANCE scalar function |
Determine whether geometries intersect | |
Determine whether a geometry contains another one |
Construction of new geometries from existing geometries
The following scalar functions modify properties of a geometry of type ST_GEOMETRY or one of its subtypes to construct a new geometry:
Function Use | Function Name |
---|---|
Create new geometries with different space configurations | |
Create a new geometry by combining multiple geometries | ST_UNION scalar function |
Information about geometries
The following scalar functions return information about geometric properties such as coordinates, measures, and boundaries:
Function Use | Function Name |
---|---|
Return information about geometry types | ST_GEOMETRYTYPE scalar function |
Return information to indicate whether a geometry is simple | ST_ISSIMPLE scalar function |
Return information about geometry dimensions | ST_AREA scalar function |
Return information about geometry definitions | ST_NUMPOINTS scalar function |
Return information about coordinates and measures | |
Return information about spatial reference systems |
Creation of geohashes
The following table functions create geohashes
Function Use | Function Name |
---|---|
Create the geohash value for a specific point | |
Create the set of geohash cells that are needed to completely cover a particular geometry | |
Create the set of geohash cells that are needed to create a boundary box around a particular geometry |