We also aim to add optimizer support for spatial indexes and other forms of query optimization.
A spatial database is a database that is optimized for storing and query data that represents objects defined in a geometric space.
Calcite’s support for spatial data includes:
- A GEOMETRY data type and
- Spatial functions (prefixed
ST_; we have implemented about 35 of the 150 in the OpenGIS specification)
and will at some point also include query rewrites to use spatial indexes.
Enabling spatial support
GEOMETRY data type is built-in, the functions are not enabled by
default. You need to add
fun=spatial to the JDBC connect string to enable
the functions. For example,
Calcite’s OpenGIS implementation uses the Esri geometry API. Thanks for the help we received from their community.
While developing this feature, we made extensive use of the PostGIS documentation and tests, and the H2GIS documentation, and consulted both as reference implementations when the specification wasn’t clear. Thank you to these awesome projects.