Spatial Functions

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 or to PostGIS for more details about particular functions.

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

Note
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.

ST_GeomFromText(text [, srid])

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.

ST_GeomFromWKB(bin [, srid])

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

ST_GeomFromEWKB

Returns a geometry from a blob in EWKB format.

ST_GeomFromEWKB(bin)

bin is a blob. Return value is a geometry. Only 2 dimensions are supported.

ST_GeomFromText

Returns a geometry from a Clob in EWKT format.

ST_GeomFromEWKT(text)

text is a clob. Return value is a geometry. Only 2 dimensions are supported.

ST_GeomFromGeoJSON

Returns a geometry from a Clob in GeoJSON format.

ST_GeomFromGeoJson(text [, srid])

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.

ST_GeomFromGML(text [, srid])

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

ST_AsText

ST_AsText(geom)

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

ST_AsBinary

ST_AsBinary(geom)

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

ST_AsEWKB

ST_AsEWKB(geom)

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

ST_AsGeoJSON

ST_AsGeoJSON(geom)

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

ST_AsGML

ST_AsGML(geom)

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

ST_AsEWKT

ST_AsEWKT(geom)

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

ST_AsKML(geom)

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.

Operators

&&

Returns true if the bounding boxes of geom1 and geom2 intersect.

geom1 && geom2

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

Relationship Functions

ST_CONTAINS

Returns true if geom1 contains geom2 contains another.

ST_CONTAINS(geom1, geom2)

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

ST_CROSSES

Returns true if the geometries cross.

ST_CROSSES(geom1, geom2)

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

ST_DISJOINT

Returns true if the geometries are disjoint.

ST_DISJOINT(geom1, geom2)

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

ST_DISTANCE

Returns the distance between two geometries.

ST_DISTANCE(geom1, geom2)

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

ST_DWITHIN

Returns true if the geometries are within a given distance of one another.

ST_DWITHIN(geom1, geom2, dist)

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

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.

ST_EQUALS(geom1, geom2)

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

ST_INTERSECTS

Returns true if the geometries intersect.

ST_INTERSECT(geom1, geom2)

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

ST_OVERLAPS

Returns true if the geometries overlap.

ST_OVERLAPS(geom1, geom2)

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

ST_TOUCHES

Returns true if the geometries touch.

ST_TOUCHES(geom1, geom2)

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

ST_WITHIN

Returns true if geom1 is completely inside geom2.

ST_WITHIN(geom1, geom2)

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

Misc. Functions

ST_FORCE_2D

Removes the z coordinate value if present.

ST_FORCE_2D(geom)

geom is a geometry. Return value is a geometry.

ST_ENVELOPE

Computes the 2D bounding box of the given geometry.

ST_ENVELOPE(geom)

geom is a geometry. Return value is a geometry.

ST_HASARC

Test if the geometry has a circular string.

ST_HASARC(geom)

geom is a geometry. Return value is a geometry. Will currently only report false as curved geometry types are not supported.

ST_SRID

Returns the SRID for the geometry.

ST_SRID(geom)

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.

ST_SetSRID(geom, srid)

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

ST_SIMPLIFY

Simplifies a Geometry using the Douglas-Peucker algorithm.

ST_SIMPLIFY(geom, distanceTolerance)

geom is a geometry. distanceTolerance is a double. Return value is a geometry.

ST_TRANSFORM

Transforms the geometry value from one coordinate system to another.

ST_TRANSFORM(geom, srid)

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.

Aggregate Functions

ST_EXTENT

Computes the 2D bounding box around all of the geometry values. All values should have the same srid.

ST_EXTENT(geom)

geom is a geometry. Return value is a geometry.

results matching ""

    No results matching ""