Skip to content

Latest commit

 

History

History
49 lines (31 loc) · 3.1 KB

README.md

File metadata and controls

49 lines (31 loc) · 3.1 KB

Table of Contents

Geospatial functions

Exasol implements a subset of the geometry types, methods and functions of the ISO/IEC 13249-3:2016 Information technology -- Database languages -- SQL multimedia and application packages -- Part 3: Spatial standard.

Various additonal geospatial functions have been produced as SQL function or as UDF to extend the coverage.

Generic geospatial functions

geospatial_functions.sql

NOTE: Function overloading in Exasol SQL is not supported. Since a GEOMETRY datatype without spatial reference is a different from a GEOMETRY datatype with geospatial reference (e.g. GEOMETRY(4326)), separate functions are required to serve the different data types (used as input parameters). This file contains implementations for GEOMETRY datatype without spatial reference and with World Geodetic System (WGS 1984 / EPSG:432) spatial reference. You will need to adjust the function definitions if you need to use a different spatial reference. The list of supported spatial references can be found in the EXA_SPATIAL_REF_SYS table.

NOTE: Exasol stores geomatry objects internally as Well-Known Text (WKT), practically as VARCHAR(2000000) with the spatial reference metadata.

  • Geometry constructors
    • ST_Point : Returns an ST_Point with the given coordinate values.
    • ST_WKTToSQL / ST_GeomFromText : Returns a specified ST_Geometry value from WKT.
  • Geometry accessors
    • ST_XMax / ST_MaxX : Returns X maxima of the bounding box of a geometry (as FLOAT).
    • ST_XMin / ST_MinX : Returns X minima of the bounding box of a geometry (as FLOAT).
    • ST_YMax / ST_MaxY : Returns Y maxima of the bounding box of a geometry (as FLOAT).
    • ST_YMin / ST_MinY : Returns Y minima of the bounding box of a geometry (as FLOAT).
  • Geometry outputs
    • ST_AsText : Returns the WKT representation of the geometry/geography without SRID metadata.

The above functions with GEOMETRY(4326) are implemented as *WGS (e.g. ST_MinXWGS).

ST_HaversineDistance

ST_HaversineDistance.sql

Implementation of the Haversine formula to the great-circle distance between two points on a sphere given their longitudes and latitudes. It uses World Geodetic System (WGS 1984 / EPSG:432) spatial reference.

ST_GeomFromGeoJSON

ST_GeomFromGeoJSON.sql

Generates a WKT output from a GeoJSON input.