---
title: Geospatial Functions
slug: TCGbbDU6RmyP_q7ipBMDt
description: Discover geospatial functions in Ocient with OcientGeo, designed for handling and analyzing geographic data.
docTags: 
createdAt: Thu Jul 21 2022 17:05:13 GMT+0000 (Coordinated Universal Time)
updatedAt: Mon Mar 30 2026 18:52:30 GMT+0000 (Coordinated Universal Time)
---

The Ocient Data Intelligence Platform™ has OcientGeo™ that supports three different geospatial geographies: `POLYGON`, `LINESTRING`, and `POINT`.

- A `POLYGON` can be constructed with a closed LINESTRING or an outer shell and array of inner rings.&#x20;
- A `LINESTRING` represents a series of points connected by line segments. It can be constructed with either `LINESTRING` or `POINT` data types.&#x20;
- A `POINT` represents a point in space defined by an (x, y) or (longitude, latitude) coordinate pair.

:::hint{type="info"}
Each `LINESTRING` or `POLYGON` value can be up to a maximum of 512 MB in size. This means a `LINESTRING` or `POLYGON` can contain approximately 32 million point values.&#x20;
:::

These supported geospatial data types require Well-Known Text (WKT) formatting. For formatting examples, see [Data Types](<./Data Types.md>) or [WKT Representation of Geometry](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry#Geometric_objects). The OcientGeo functionality reference also contains examples with supported formatting and syntax.&#x20;

Each geospatial geography has a number of functions and operators that can be used in SQL queries to perform analyses. Some functions apply to specific geography types. For operators specific to geospatial data types, refer to [Geospatial Operators](./#geospatial-operators).

OcientGeo uses the authalic radius of the Earth, 6371007.1810824 meters, as the reference for many measurement calculations.

:::hint{type="info"}
The authalic radius reference might cause slight differences in measurements compared to other geospatial systems that use a different radius definition.
:::

## Geospatial Operators

OcientGeo supports special operators that perform operations on two different geographies. These can be used in queries to compare geographies or calculate values based on the geographies.

| **Operator**          | **Syntax**        | **Purpose**                                                                                  |
| --------------------- | ----------------- | -------------------------------------------------------------------------------------------- |
| intersects            | `geoA && geoB`    | Returns `TRUE` if the bounding box of geography A intersects with the bounding box of B.     |
| contained             | `geoA @ geoB`     | Returns `TRUE` if the bounding box of geography A is contained within the bounding box of B. |
| equal                 | `geoA ~= geoB`    | Returns `TRUE` if the bounding box of geography A is the same as bounding box of B.          |
| contains              | `geoA ~ geoB`     | Returns `TRUE` if the bounding box of geography A contains the bounding box of B.            |
| distance              | `geoA <-> geoB`   | Returns the distance in meters between the two geography parameters.                         |
| bounding box distance | `geoA <#> geoB`   | Returns the distance in meters between the bounding box of the two geography parameters.     |
| centroid distance     | `geoA <<->> geoB` | Returns the distance in meters between the centroids of the two geography parameters.        |

## Geospatial Functions Overview

OcientGeo supports many geospatial functions that operate on POINT, LINESTRING, and POLYGON values. Each function, its expected inputs, and return type are described in the following section.&#x20;

## Geospatial Filtering

Queries that involve geospatial filtering can make use of functions in the [Spatial Relationships](<./Geospatial Functions/Spatial Relationships.md>) section.&#x20;

To optimize these queries, OcientGeo provides a `SPATIAL` index that you can apply to columns with geospatial data types. For details about the `SPATIAL` index, see [Secondary Indexes](<././Database Administration/Schema Design/Secondary Indexes.md>).

## [Attribute Functions](<./Geospatial Functions/Attribute Functions.md>)&#x20;

Attribute functions return descriptive information on the specified data set.&#x20;

- ST\_COORDDIM
- ST\_DIMENSION
- ST\_GEOMETRYTYPE
- ST\_ISEMPTY
- ST\_MEMSIZE
- ST\_NDIMS
- ST\_NDIMENSION
- ST\_NPOINTS
- ST\_NUMPOINTS
- ST\_SRID
- ST\_X
- ST\_XMAX
- ST\_XMIN
- ST\_Y
- ST\_YMAX
- ST\_YMIN

## [Conversion Functions](<./Geospatial Functions/Conversion Functions.md>)&#x20;

Conversion functions transform a specified operand to a different data type.&#x20;

- ST\_ASBINARY
- ST\_ASWKB
- ST\_ASGEOJSON
- ST\_ASEWKT
- ST\_ASLATLONTEXT
- ST\_ASTEXT
- ST\_ASWKT
- ST\_GEOHASH

## [Linestring Constructors](<./Geospatial Functions/Linestring Constructors.md>)&#x20;

LINESTRING constructors use geospatial data to create a LINESTRING object.&#x20;

- ST\_LINEFROMTEXT
- ST\_LINEFROMGEOJSON
- ST\_LINEFROMWKB
- ST\_LINEFROMEWKT
- ST\_LINESTRING
- ST\_MAKELINE

## [Linestring Functions](<./Geospatial Functions/Linestring Functions.md>)&#x20;

LINESTRING functions can perform alterations or access descriptive information on LINESTRING objects.&#x20;

- ST\_ADDPOINT
- ST\_ENDPOINT
- ST\_LINEINTERPOLATEPOINT
- ST\_LINELOCATEPOINT
- ST\_LINESUBSTRING
- ST\_POINTN
- ST\_REMOVEPOINT
- ST\_SETPOINT
- ST\_STARTPOINT

## [Point Constructors](<./Geospatial Functions/Point Constructors.md>)&#x20;

POINT constructors use geospatial data to create a POINT object.&#x20;

- ST\_CENTROID
- ST\_GEOGPOINT
- ST\_MAKEPOINT
- ST\_POINT
- ST\_POINTFROMEWKT
- ST\_POINTFROMGEOHASH
- ST\_POINTFROMGEOJSON
- ST\_POINTFROMTEXT
- ST\_POINTFROMWKB

## [Polygon Constructors](<./Geospatial Functions/Polygon Constructors.md>)&#x20;

POLYGON constructors use geospatial data to create a POLYGON object.&#x20;

- ST\_FORCECCW
- ST\_MAKEPOLYGON
- ST\_POLYGON
- ST\_POLYGONFROMGEOJSON
- ST\_POLYGONFROMWKB
- ST\_POLYGONFROMEWKT
- ST\_POLYGONFROMTEXT
- ST\_WHOLEEARTH

## [Spatial Measurement](<./Geospatial Functions/Spatial Measurement.md>)

Spatial measurement functions can perform basic calculations on geospatial data, such as measuring the distance between two POINT objects or the area of a POLYGON object.&#x20;

- ST\_AREA
- ST\_ANGLE
- ST\_AZIMUTH
- ST\_DISTANCE
- ST\_DISTANCESPHERE
- ST\_DISTANCESPHEROID
- ST\_EUCLIDEANDISTANCE3D
- ST\_HAUSDORFFDISTANCE
- ST\_LENGTH
- ST\_LENGTH2D
- ST\_MINIMUMDISTANCETOSURFACE
- ST\_MAXDISTANCE
- ST\_PERIMETER
- ST\_PERIMETER2D

## [Spatial Operators](<./Geospatial Functions/Spatial Operators.md>)&#x20;

Spatial operators perform geometry calculations on geospatial data to return a different type of geospatial data.&#x20;

- ST\_BOUNDINGDIAGONAL
- ST\_BUFFER
- ST\_CLOSESTPOINT
- ST\_CONVEXHULL
- ST\_DIFFERENCEARRAY
- ST\_ENVELOPE
- ST\_EXPAND
- ST\_EXTERIORRING
- ST\_FLIPCOORDINATES
- ST\_FORCE2D
- ST\_INTERIORRINGN
- ST\_INTERSECTALL
- ST\_INTERSECTIONARRAY
- ST\_LONGESTLINE
- ST\_MAKEENVELOPE
- ST\_MINIMUMBOUNDINGCIRCLE
- ST\_MULTIDIFFERENCEARRAY
- ST\_MULTIINTERSECTIONARRAY
- ST\_MULTISYMDIFFERENCEARRAY
- ST\_MULTIUNIONARRAY
- ST\_NRINGS
- ST\_NUMINTERIORRING
- ST\_NUMINTERIORRINGS
- ST\_POINTONSURFACE
- ST\_PROJECT
- ST\_REDUCEPRECISION
- ST\_REMOVEREPEATEDPOINTS
- ST\_REVERSE
- ST\_SEGMENTIZE
- ST\_SHORTESTLINE
- ST\_SIMPLIFY
- ST\_SIMPLIFYARRAY
- ST\_SNAPTOGRID
- ST\_SYMDIFFERENCEARRAY
- ST\_UNIONARRAY

## [Spatial Relationships](<./Geospatial Functions/Spatial Relationships.md>)&#x20;

Spatial relationship functions use arguments to test for different types of spatial relationships. 

- ST\_CLUSTERDBSCAN
- ST\_CONTAINS
- ST\_CONTAINSPROPERLY
- ST\_COVERS
- ST\_COVEREDBY
- ST\_CROSSES
- ST\_DISJOINT
- ST\_DWITHIN
- ST\_EQUALS
- ST\_INTERSECTS
- ST\_ISCCW
- ST\_ISPOLYGONCCW
- ST\_ISPOLYGONCW
- ST\_ISCLOSED
- ST\_ISRING
- ST\_ISSIMPLE
- ST\_ISVALID
- ST\_OVERLAPS
- ST\_POINTINSIDECIRCLE
- ST\_RELATE
- ST\_TOUCHES
- ST\_WITHIN

## [Spatiotemporal Measurement](<./Geospatial Functions/Spatiotemporal Measurement.md>)&#x20;

Spatiotemporal measurement functions can perform basic calculations on geospatial data paired with TIMESTAMP data.&#x20;

- ST\_DISTANCE
- ST\_MAXDISTANCE
- ST\_TOTALSECONDSININTERSECTION

## [Spatiotemporal Operators](<./Geospatial Functions/Spatiotemporal Operators.md>)&#x20;

Spatiotemporal operators perform calculations on geospatial data using an array of TIMESTAMP arguments.&#x20;

- ST\_LONGESTLINE
- ST\_LINEGETALLTIMESATPOINT
- ST\_LINEGETPOINTATTIME
- ST\_LINEGETTIMEATPOINT
- ST\_INTERSECTION
- ST\_SHORTESTLINE

## Related Videos

[At the Whiteboard with Ocient: Geospatial Analytics](https://youtu.be/tIlTpbCP0Rg)

