Skip to end of metadata
Go to start of metadata

Spatial functions provide functionality for working with geospatial data. Teiid relies on the JTS Topology Suite to provide partial support for the OpenGIS Simple Features Specification For SQL Revision 1.1. Please refer to the specification for more details about particular functions.

Most Geometry support is limited to two dimensions due to the WKB and WKT formats.

Geometry support is still evolving. There may be minor differences between Teiid and pushdown results that will need to be further refined.

Conversion Functions

ST_GeomFromText

Returns a geometry from a Clob in WKT format.

text is a clob, srid is an optional integer. Return value is a geometry.

ST_GeomFromWKB/ST_GeomFromBinary

Returns a geometry from a blob in WKB format.

bin is a blob, srid is an optional integer. Return value is a geometry.

ST_GeomFromGeoJSON

Returns a geometry from a Clob in GeoJSON format.

text is a clob, srid is an optional integer. Return value is a geometry.

ST_GeomFromGML

Returns a geometry from a Clob in GML2 format.

text is a clob, srid is an optional integer. Return value is a geometry.

ST_AsText

geom is a geometry. Return value is clob in WKT format.

ST_AsBinary

geom is a geometry. Return value is a blob in WKB format.

ST_AsGeoJSON

geom is a geometry. Return value is a clob with the GeoJSON value.

ST_AsGML

geom is a geometry. Return value is a clob with the GML2 value.

ST_AsEWKT

geom is a geometry. Return value is a clob with the EWKT value. The EWKT value is the WKT value with the SRID prefix.

ST_AsKML

geom is a geometry. Return value is a clob with the KML value. The KML value is effectively a simplified GML value and projected into SRID 4326.

Relationship Functions

ST_CONTAINS

Returns true if geom1 contains geom2 contains another.

geom1, geom2 are geometries. Return value is a boolean.

ST_CROSSES

Returns true if the geometries cross.

geom1, geom2 are geometries. Return value is a boolean.

ST_DISJOINT

Returns true if the geometries are disjoint.

geom1, geom2 are geometries. Return value is a boolean.

ST_DISTANCE

Returns the distance between two geometries.

geom1, geom2 are geometries. Return value is a double.

ST_EQUALS

Returns true if the two geometries are spatially equal - the points and order may differ, but neither geometry lies outside of the other.

geom1, geom2 are geometries. Return value is a boolean.

ST_INTERSECTS

Returns true if the geometries intersect.

geom1, geom2 are geometries. Return value is a boolean.

ST_OVERLAPS

Returns true if the geometries overlap.

geom1, geom2 are geometries. Return value is a boolean.

ST_TOUCHES

Returns true if the geometries touch.

geom1, geom2 are geometries. Return value is a boolean.

Misc. Functions

ST_SRID

Returns the SRID for the geometry.

geom is a geometry. Return value is an integer. A 0 value rather than null will be returned for an unknown SRID on a non-null geometry.

ST_SetSRID

Set the SRID for the given geometry.

geom is a geometry. srid is an integer. Return value is a geometry. Only the SRID metadata of the geometry is modified.

ST_TRANSFORM

Transforms the geometry value from one coordinate system to another.

geom is a geometry. srid is an integer. Return value is a geometry. The srid value and the srid of the geometry value must exist in the SPATIAL_REF_SYS view.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Mar 29, 2016

    There is a typo in the examples of functions: ST_AsText, ST_AsBinary, ST_AsGeoJSON, ST_AsGML.
    Each of them contains 'Geom' in the name. ( ST_GeomAsText, ST_GeomAsBinary, ST_GeomAsGeoJSON, ST_GeomAsGML )

    1. Mar 29, 2016

      Thanks for noticing this. The correction has been made to the new document location: https://teiid.gitbooks.io/documents/content/reference/Spatial_Functions.html