Geometry Functions

The Geometry type in Sedona represents planar (2D Euclidean) spatial objects such as points, lines, and polygons. All coordinates are treated as Cartesian (x, y) values, and spatial operations — distance, area, intersection, etc. — use flat-plane math.

Geometry Constructors

These functions create geometry objects from various textual or binary formats, or from coordinate values.

FunctionReturn typeDescriptionSince
ST_GeomCollFromTextGeometryConstructs a GeometryCollection from the WKT with the given SRID. If SRID is not provided then it defaults to 0. It returns null if the WKT is not a GEOMETRYCOLLECTION.v1.6.1
ST_GeometryFromTextGeometryConstruct a Geometry from WKT. If SRID is not set, it defaults to 0 (unknown). Alias of ST_GeomFromWKTv1.6.1
ST_GeomFromEWKBGeometryConstruct a Geometry from EWKB string or Binary. This function is an alias of ST_GeomFromWKB.v1.6.1
ST_GeomFromEWKTGeometryConstruct a Geometry from OGC Extended WKTv1.5.0
ST_GeomFromGeoHashGeometryCreate Geometry from geohash string and optional precisionv1.1.1
ST_GeomFromGeoJSONGeometryConstruct a Geometry from GeoJsonv1.0.0
ST_GeomFromGMLGeometryConstruct a Geometry from GML.v1.3.0
ST_GeomFromKMLGeometryConstruct a Geometry from KML.v1.3.0
ST_GeomFromMySQLGeometryConstruct a Geometry from MySQL Geometry binary.v1.8.0
ST_GeomFromTextGeometryConstruct a Geometry from WKT. If SRID is not set, it defaults to 0 (unknown). Alias of ST_GeomFromWKTv1.0.0
ST_GeomFromWKBGeometryConstruct a Geometry from WKB string or Binary. This function also supports EWKB format.v1.0.0
ST_GeomFromWKTGeometryConstruct a Geometry from WKT. If SRID is not set, it defaults to 0 (unknown).v1.0.0
ST_LineFromTextGeometryConstruct a Line from Wkt textv1.2.1
ST_LineFromWKBGeometryConstruct a LineString geometry from WKB string or Binary and an optional SRID. This function also supports EWKB format.v1.6.1
ST_LineStringFromTextGeometryConstruct a LineString from Text, delimited by Delimiterv1.0.0
ST_LinestringFromWKBGeometryConstruct a LineString geometry from WKB string or Binary and an optional SRID. This function also supports EWKB format and it is an alias of ST_LineFromWKB.v1.6.1
ST_MakeEnvelopeGeometryConstruct a Polygon from MinX, MinY, MaxX, MaxY, and an optional SRID.v1.7.0
ST_MakePointGeometryCreates a 2D, 3D Z or 4D ZM Point geometry. Use ST_MakePointM to make points with XYM coordinates. Z and M values are optional.v1.5.0
ST_MakePointMGeometryCreates a point with X, Y, and M coordinate. Use ST_MakePoint to make points with XY, XYZ, or XYZM coordinates.v1.6.1
ST_MLineFromTextGeometryConstruct a MultiLineString from Wkt. If srid is not set, it defaults to 0 (unknown).v1.3.1
ST_MPointFromTextGeometryConstructs a MultiPoint from the WKT with the given SRID. If SRID is not provided then it defaults to 0. It returns null if the WKT is not a MULTIPOINT.v1.6.1
ST_MPolyFromTextGeometryConstruct a MultiPolygon from Wkt. If srid is not set, it defaults to 0 (unknown).v1.3.1
ST_PointGeometryConstruct a Point from X and Yv1.0.0
ST_PointFromGeoHashGeometryGenerates a Point geometry representing the center of the GeoHash cell defined by the input string. If precision is not specified, the full GeoHash precision is used. Providing a precision value...v1.6.1
ST_PointFromTextGeometryConstruct a Point from Text, delimited by Delimiterv1.0.0
ST_PointFromWKBGeometryConstruct a Point geometry from WKB string or Binary and an optional SRID. This function also supports EWKB format.v1.6.1
ST_PointMGeometryConstruct a Point from X, Y and M and an optional srid. If srid is not set, it defaults to 0 (unknown). Must use ST_AsEWKT function to print the Z and M coordinates.v1.6.1
ST_PointZGeometryConstruct a Point from X, Y and Z and an optional srid. If srid is not set, it defaults to 0 (unknown). Must use ST_AsEWKT function to print the Z coordinate.v1.4.0
ST_PointZMGeometryConstruct a Point from X, Y, Z, M and an optional srid. If srid is not set, it defaults to 0 (unknown). Must use ST_AsEWKT function to print the Z and M coordinates.v1.6.1
ST_PolygonFromEnvelopeGeometryConstruct a Polygon from MinX, MinY, MaxX, MaxY.v1.0.0
ST_PolygonFromTextGeometryConstruct a Polygon from Text, delimited by Delimiter. Path must be closedv1.0.0

Geometry Accessors

These functions extract information and properties from geometry objects.

FunctionReturn typeDescriptionSince
GeometryTypeStringReturns the type of the geometry as a string. Eg: ‘LINESTRING’, ‘POLYGON’, ‘MULTIPOINT’, etc. This function also indicates if the geometry is measured, by returning a string of the form ‘POINTM’.v1.5.0
ST_BoundaryGeometryReturns the closure of the combinatorial boundary of this Geometry.v1.0.0
ST_CoordDimIntegerReturns the coordinate dimensions of the geometry. It is an alias of ST_NDims.v1.5.0
ST_CrossesDateLineBooleanThis function determines if a given geometry crosses the International Date Line. It operates by checking if the difference in longitude between any pair of consecutive points in the geometry excee...v1.6.0
ST_DimensionIntegerReturn the topological dimension of this Geometry object, which must be less than or equal to the coordinate dimension. OGC SPEC s2.1.1.1 - returns 0 for POINT, 1 for LINESTRING, 2 for POLYGON, and...v1.5.0
ST_DumpArray<Geometry>It expands the geometries. If the geometry is simple (Point, Polygon Linestring etc.) it returns the geometry itself, if the geometry is collection or multi it returns record for each of collection...v1.0.0
ST_DumpPointsArray<Geometry>Returns list of Points which geometry consists of.v1.0.0
ST_EndPointGeometryReturns last point of given linestring.v1.0.0
ST_ExteriorRingGeometryReturns a line string representing the exterior ring of the POLYGON geometry. Return NULL if the geometry is not a polygon.v1.0.0
ST_GeometryNGeometryReturn the 0-based Nth geometry if the geometry is a GEOMETRYCOLLECTION, (MULTI)POINT, (MULTI)LINESTRING, MULTICURVE or (MULTI)POLYGON. Otherwise, return nullv1.0.0
ST_GeometryTypeStringReturns the type of the geometry as a string. EG: ‘ST_Linestring’, ‘ST_Polygon’ etc.v1.0.0
ST_HasMBooleanChecks for the presence of M coordinate values representing measures or linear references. Returns true if the input geometry includes an M coordinate, false otherwise.v1.6.1
ST_HasZBooleanChecks for the presence of Z coordinate values representing measures or linear references. Returns true if the input geometry includes an Z coordinate, false otherwise.v1.6.1
ST_InteriorRingNGeometryReturns the Nth interior linestring ring of the polygon geometry. Returns NULL if the geometry is not a polygon or the given N is out of rangev1.0.0
ST_IsClosedBooleanRETURNS true if the LINESTRING start and end point are the same.v1.0.0
ST_IsCollectionBooleanReturns TRUE if the geometry type of the input is a geometry collection type. Collection types are the following:v1.5.0
ST_IsEmptyBooleanTest if a geometry is empty geometryv1.2.1
ST_IsPolygonCCWBooleanReturns true if all polygonal components in the input geometry have their exterior rings oriented counter-clockwise and interior rings oriented clockwise.v1.6.0
ST_IsPolygonCWBooleanReturns true if all polygonal components in the input geometry have their exterior rings oriented counter-clockwise and interior rings oriented clockwise.v1.6.0
ST_IsRingBooleanRETURN true if LINESTRING is ST_IsClosed and ST_IsSimple.v1.0.0
ST_IsSimpleBooleanTest if geometry's only self-intersections are at boundary points.v1.0.0
ST_MDoubleReturns M Coordinate of given Point, null otherwise.v1.6.1
ST_NDimsIntegerReturns the coordinate dimension of the geometry.v1.3.1
ST_NPointsIntegerReturn points of the geometryv1.0.0
ST_NRingsIntegerReturns the number of rings in a Polygon or MultiPolygon. Contrary to ST_NumInteriorRings, this function also takes into account the number of exterior rings.v1.4.1
ST_NumGeometriesIntegerReturns the number of Geometries. If geometry is a GEOMETRYCOLLECTION (or MULTI*) return the number of geometries, for single geometries will return 1.v1.0.0
ST_NumInteriorRingIntegerReturns number of interior rings of polygon geometries. It is an alias of ST_NumInteriorRings.v1.6.1
ST_NumInteriorRingsIntegerRETURNS number of interior rings of polygon geometries.v1.0.0
ST_NumPointsIntegerReturns number of points in a LineStringv1.4.1
ST_PointNGeometryReturn the Nth point in a single linestring or circular linestring in the geometry. Negative values are counted backwards from the end of the LineString, so that -1 is the last point. Returns NULL ...v1.2.1
ST_PointsGeometryReturns a MultiPoint geometry consisting of all the coordinates of the input geometry. It preserves duplicate points as well as M and Z coordinates.v1.6.1
ST_StartPointGeometryReturns first point of given linestring.v1.0.0
ST_XDoubleReturns X Coordinate of given Point null otherwise.v1.0.0
ST_YDoubleReturns Y Coordinate of given Point, null otherwise.v1.0.0
ST_ZDoubleReturns Z Coordinate of given Point, null otherwise.v1.2.0
ST_ZmflagIntegerReturns a code indicating the Z and M coordinate dimensions present in the input geometry.v1.6.1

Geometry Editors

These functions create modified geometries by changing type, structure, or vertices.

FunctionReturn typeDescriptionSince
ST_AddPointGeometryRETURN Linestring with additional point at the given index, if position is not available the point will be added at the end of line.v1.0.0
ST_CollectGeometryReturns MultiGeometry object based on geometry column/s or array with geometriesv1.2.0
ST_CollectionExtractGeometryReturns a homogeneous multi-geometry from a given geometry collection.v1.2.1
ST_FlipCoordinatesGeometryReturns a version of the given geometry with X and Y axis flipped.v1.0.0
ST_Force2DGeometryForces the geometries into a “2-dimensional mode” so that all output representations will only have the X and Y coordinates. This function is an alias of ST_Force_2D.v1.8.0
ST_Force3DGeometryForces the geometry into a 3-dimensional model so that all output representations will have X, Y and Z coordinates. An optionally given zValue is tacked onto the geometry if the geometry is 2-dimen...v1.4.1
ST_Force3DMGeometryForces the geometry into XYM mode. Retains any existing M coordinate, but removes the Z coordinate if present. Assigns a default M value of 0.0 if mValue is not specified.v1.6.1
ST_Force3DZGeometryForces the geometry into a 3-dimensional model so that all output representations will have X, Y and Z coordinates. An optionally given zValue is tacked onto the geometry if the geometry is 2-dimen...v1.6.1
ST_Force4DGeometryConverts the input geometry to 4D XYZM representation. Retains original Z and M values if present. Assigning 0.0 defaults if mValue and zValue aren't specified. The output contains X, Y, Z, and...v1.6.1
ST_Force_2DGeometryForces the geometries into a “2-dimensional mode” so that all output representations will only have the X and Y coordinates. This function is an alias of ST_Force2D.v1.2.1
ST_ForceCollectionGeometryThis function converts the input geometry into a GeometryCollection, regardless of the original geometry type. If the input is a multipart geometry, such as a MultiPolygon or MultiLineString, it wi...v1.6.1
ST_ForcePolygonCCWGeometryFor (Multi)Polygon geometries, this function sets the exterior ring orientation to counter-clockwise and interior rings to clockwise orientation. Non-polygonal geometries are returned unchanged.v1.6.0
ST_ForcePolygonCWGeometryFor (Multi)Polygon geometries, this function sets the exterior ring orientation to clockwise and interior rings to counter-clockwise orientation. Non-polygonal geometries are returned unchanged.v1.6.0
ST_ForceRHRGeometrySets the orientation of polygon vertex orderings to follow the Right-Hand-Rule convention. The exterior ring will have a clockwise winding order, while any interior rings are oriented counter-clock...v1.6.1
ST_LineFromMultiPointGeometryCreates a LineString from a MultiPoint geometry.v1.3.0
ST_LineMergeGeometryReturns a LineString or MultiLineString formed by sewing together the constituent line work of a MULTILINESTRING.v1.0.0
ST_LineSegmentsArray<Geometry>This function transforms a LineString containing multiple coordinates into an array of LineStrings, each with precisely two coordinates. The lenient argument, true by default, prevents an excepti...v1.7.1
ST_MakeLineGeometryCreates a LineString containing the points of Point, MultiPoint, or LineString geometries. Other geometry types cause an error.v1.5.0
ST_MakePolygonGeometryFunction to convert closed linestring to polygon including holes. If holes are provided, they should be fully contained within the shell. Holes outside the shell will produce an invalid polygon (ma...v1.1.0
ST_MultiGeometryReturns a MultiGeometry object based on the geometry input. ST_Multi is basically an alias for ST_Collect with one geometry.v1.2.0
ST_NormalizeGeometryReturns the input geometry in its normalized form.v1.3.0
ST_PolygonGeometryFunction to create a polygon built from the given LineString and sets the spatial reference system from the sridv1.5.0
ST_ProjectGeometryCalculates a new point location given a starting point, distance, and azimuth. The azimuth indicates the direction, expressed in radians, and is measured in a clockwise manner starting from true no...v1.7.0
ST_RemovePointGeometryRETURN Line with removed point at given index, position can be omitted and then last one will be removed.v1.0.0
ST_RemoveRepeatedPointsGeometryThis function eliminates consecutive duplicate points within a geometry, preserving endpoints of LineStrings. It operates on (Multi)LineStrings, (Multi)Polygons, and MultiPoints, processing Geometr...v1.7.0
ST_ReverseGeometryReturn the geometry with vertex order reversedv1.2.1
ST_SegmentizeGeometryReturns a modified geometry having no segment longer than the given max_segment_length.v1.8.0
ST_SetPointGeometryReplace Nth point of linestring with given point. Index is 0-based. Negative index are counted backwards, e.g., -1 is last point.v1.3.0
ST_ShiftLongitudeGeometryModifies longitude coordinates in geometries, shifting values between -180..0 degrees to 180..360 degrees and vice versa. This is useful for normalizing data across the International Date Line and ...v1.6.0

Geometry Output

These functions convert geometry objects into various textual or binary formats.

FunctionReturn typeDescriptionSince
ST_AsBinaryBinaryReturn the Well-Known Binary representation of a geometryv1.1.1
ST_AsEWKBBinaryReturn the Extended Well-Known Binary representation of a geometry. EWKB is an extended version of WKB which includes the SRID of the geometry. The format originated in PostGIS but is supported by ...v1.1.1
ST_AsEWKTStringReturn the Extended Well-Known Text representation of a geometry. EWKT is an extended version of WKT which includes the SRID of the geometry. The format originated in PostGIS but is supported by ma...v1.2.1
ST_AsGeoJSONStringReturn the GeoJSON string representation of a geometryv1.6.1
ST_AsGMLStringReturn the GML string representation of a geometryv1.3.0
ST_AsHEXEWKBStringThis function returns the input geometry encoded to a text representation in HEXEWKB format. The HEXEWKB encoding can use either little-endian (NDR) or big-endian (XDR) byte ordering. If no encoding...v1.6.1
ST_AsKMLStringReturn the KML string representation of a geometryv1.3.0
ST_AsTextStringReturn the Well-Known Text string representation of a geometry. It will support M coordinate if present since v1.5.0.v1.0.0
ST_GeoHashStringReturns GeoHash of the geometry with given precisionv1.1.1

Predicates

These functions test spatial relationships between geometries, returning boolean values.

FunctionReturn typeDescriptionSince
ST_ContainsBooleanReturn true if A fully contains Bv1.0.0
ST_CoveredByBooleanReturn true if A is covered by Bv1.3.0
ST_CoversBooleanReturn true if A covers Bv1.3.0
ST_CrossesBooleanReturn true if A crosses Bv1.0.0
ST_DisjointBooleanReturn true if A and B are disjointv1.2.1
ST_DWithinBooleanReturns true if ‘leftGeometry’ and ‘rightGeometry’ are within a specified ‘distance’.v1.5.1
ST_EqualsBooleanReturn true if A equals to Bv1.0.0
ST_IntersectsBooleanReturn true if A intersects Bv1.0.0
ST_OrderingEqualsBooleanReturns true if the geometries are equal and the coordinates are in the same orderv1.2.1
ST_OverlapsBooleanReturn true if A overlaps Bv1.0.0
ST_RelateStringThe first variant of the function computes and returns the Dimensionally Extended 9-Intersection Model (DE-9IM) matrix string representing the spatial relati...v1.6.1
ST_RelateMatchBooleanThis function tests the relationship between two Dimensionally Extended 9-Intersection Model (DE-9IM) matrices representing geometry intersections. It evalua...v1.6.1
ST_TouchesBooleanReturn true if A touches Bv1.0.0
ST_WithinBooleanReturn true if A is fully contained by Bv1.0.0

Measurement Functions

These functions compute measurements of distance, area, length, and angles.

FunctionReturn typeDescriptionSince
ST_3DDistanceDoubleReturn the 3-dimensional minimum cartesian distance between A and Bv1.2.0
ST_AngleDoubleComputes and returns the angle between two vectors represented by the provided points or linestrings.v1.5.0
ST_AreaDoubleReturn the area of Av1.0.0
ST_AreaSpheroidDoubleReturn the geodesic area of A using WGS84 spheroid. Unit is square meter. Works better for large geometries (country level) compared to ST_Area + ST_Transform. It is equivalent to PostGIS `ST_A...v1.4.1
ST_AzimuthDoubleReturns Azimuth for two given points in radians. Returns null if the two points are identical.v1.0.0
ST_ClosestPointGeometryReturns the 2-dimensional point on geom1 that is closest to geom2. This is the first point of the shortest line between the geometries. If using 3D geometries, the Z coordinates will be ignored. If...v1.5.0
ST_DegreesDoubleConvert an angle in radian to degrees.v1.5.0
ST_DistanceDoubleReturn the Euclidean distance between A and Bv1.0.0
ST_DistanceSphereDoubleReturn the haversine / great-circle distance of A using a given earth radius (default radius: 6371008.0). Unit is meter. Compared to ST_Distance + ST_Transform, it works better for datasets that...v1.4.1
ST_DistanceSpheroidDoubleReturn the geodesic distance of A using WGS84 spheroid. Unit is meter. Compared to ST_Distance + ST_Transform, it works better for datasets that cover large regions such as continents or the en...v1.4.1
ST_FrechetDistanceDoubleComputes and returns discrete Frechet Distance between the given two geometries, based on [Computing Discrete Frechet Distance](http://www.kr....v1.5.0
ST_HausdorffDistanceDoubleReturns a discretized (and hence approximate) Hausdorff distance between the given 2 geometries. Optionally, a densityFraction parameter can be s...v1.5.0
ST_LengthDoubleReturns the perimeter of A.v1.0.0
ST_Length2DDoubleReturns the perimeter of A. This function is an alias of ST_Length.v1.6.1
ST_LengthSpheroidDoubleReturn the geodesic perimeter of A using WGS84 spheroid. Unit is meter. Works better for large geometries (country level) compared to ST_Length + ST_Transform. It is equivalent to PostGIS `ST_L...v1.4.1
ST_LongestLineGeometryReturns the LineString geometry representing the maximum distance between any two points from the input geometries.v1.6.1
ST_MaxDistanceDoubleCalculates and returns the length value representing the maximum distance between any two points across the input geometries. This function is an alias for ST_LongestDistance.v1.6.1
ST_MinimumClearanceDoubleThe minimum clearance is a metric that quantifies a geometry's tolerance to changes in coordinate precision or vertex positions. It represents the maximum distance by which vertices can be adjusted...v1.6.1
ST_MinimumClearanceLineGeometryThis function returns a two-point LineString geometry representing the minimum clearance distance of the input geometry. If the input geometry does not have a defined minimum clearance, such as for...v1.6.1
ST_PerimeterDoubleThis function calculates the 2D perimeter of a given geometry. It supports Polygon, MultiPolygon, and GeometryCollection geometries (as long as the GeometryCollection contains polygonal geometries)...v1.7.0
ST_Perimeter2DDoubleThis function calculates the 2D perimeter of a given geometry. It supports Polygon, MultiPolygon, and GeometryCollection geometries (as long as the GeometryCollection contains polygonal geometries)...v1.7.1

Geometry Processing

These functions compute geometric constructions, or alter geometry size or shape.

FunctionReturn typeDescriptionSince
ST_ApproximateMedialAxisGeometryComputes an approximate medial axis of a polygonal geometry. The medial axis is a representation of the “centerline” or “skeleton” of the polygon. This function first computes the straight skeleton...v1.8.0
ST_BufferGeometryReturns a geometry/geography that represents all points whose distance from this Geometry/geography is less than or equal to distance. The function supports both Planar/Euclidean and Spheroidal/Geo...v1.6.0
ST_BuildAreaGeometryReturns the areal geometry formed by the constituent linework of the input geometry.v1.2.1
ST_CentroidGeometryReturn the centroid point of Av1.0.0
ST_ConcaveHullGeometryReturn the Concave Hull of polygon A, with alpha set to pctConvex[0, 1] in the Delaunay Triangulation method, the concave hull will not contain a hole unless allowHoles is set to truev1.4.0
ST_ConvexHullGeometryReturn the Convex Hull of polygon Av1.0.0
ST_DelaunayTrianglesGeometryThis function computes the Delaunay triangulation for the set of vertices in the input geometry. An optional tolerance parameter allows sna...v1.6.1
ST_GeneratePointsGeometryGenerates a specified quantity of pseudo-random points within the boundaries of the provided polygonal geometry. When seed is either zero or not defined then output will be random.v1.6.1
ST_GeometricMedianGeometryComputes the approximate geometric median of a MultiPoint geometry using the Weiszfeld algorithm. The geometric median provides a centrality measure that is less sensitive to outlier points than th...v1.4.1
ST_LabelPointGeometryST_LabelPoint computes and returns a label point for a given polygon or geometry collection. The label point is chosen to be sufficiently far from boundaries of the geometry. For a regular Polygo...v1.7.1
ST_MaximumInscribedCircleStructFinds the largest circle that is contained within a (multi)polygon, or which does not overlap any lines and points. Returns a row with fields:v1.6.1
ST_MinimumBoundingCircleGeometryReturns the smallest circle polygon that contains a geometry. The optional quadrantSegments parameter determines how many segments to use per quadrant and the default number of segments has been ch...v1.0.1
ST_MinimumBoundingRadiusStructReturns a struct containing the center point and radius of the smallest circle that contains a geometry.v1.0.1
ST_OrientedEnvelopeGeometryReturns the minimum-area rotated rectangle enclosing a geometry. The rectangle may be rotated relative to the coordinate axes. Degenerate inputs may result in a Point or LineString being returned.v1.8.1
ST_PointOnSurfaceGeometryReturns a POINT guaranteed to lie on the surface.v1.2.1
ST_PolygonizeGeometryGenerates a GeometryCollection composed of polygons that are formed from the linework of an input GeometryCollection. When the input does not contain any linework that forms a polygon, the function...v1.6.0
ST_ReducePrecisionGeometryReduce the decimals places in the coordinates of the geometry to the given number of decimal places. The last decimal place will be rounded. This function was called ST_PrecisionReduce in versions ...v1.0.0
ST_SimplifyGeometryThis function simplifies the input geometry by applying the Douglas-Peucker algorithm.v1.7.0
ST_SimplifyPolygonHullGeometryThis function computes a topology-preserving simplified hull, either outer or inner, for a polygonal geometry input. An outer hull fully encloses the original geometry, while an inner hull lies ent...v1.6.1
ST_SimplifyPreserveTopologyGeometrySimplifies a geometry and ensures that the result is a valid geometry having the same dimension and number of components as the input, and with the components having the same topological relationship.v1.0.0
ST_SimplifyVWGeometryThis function simplifies the input geometry by applying the Visvalingam-Whyatt algorithm.v1.6.1
ST_SnapGeometrySnaps the vertices and segments of the input geometry to reference geometry within the specified tolerance distance. The tolerance parameter controls the maximum snap distance.v1.6.0
ST_StraightSkeletonGeometryComputes the straight skeleton of a polygonal geometry. The straight skeleton is a method of representing a polygon by a topological skeleton, formed by a continuous shrinking process where each ed...v1.8.0
ST_TriangulatePolygonGeometryGenerates the constrained Delaunay triangulation for the input Polygon. The constrained Delaunay triangulation is a set of triangles created from the Polygon's vertices that covers the Polygon area...v1.6.1
ST_VoronoiPolygonsGeometryReturns a two-dimensional Voronoi diagram from the vertices of the supplied geometry. The result is a GeometryCollection of Polygons that covers an envelope larger than the extent of the input vert...v1.5.0

Overlay Functions

These functions compute results arising from the overlay of two geometries. These are also known as point-set theoretic boolean operations.

FunctionReturn typeDescriptionSince
ST_DifferenceGeometryReturn the difference between geometry A and B (return part of geometry A that does not intersect geometry B)v1.2.0
ST_IntersectionGeometryReturn the intersection geometry of A and Bv1.0.0
ST_SplitGeometrySplit an input geometry by another geometry (called the blade). Linear (LineString or MultiLineString) geometry can be split by a Point, MultiPoint, LineString, MultiLineString, Polygon, or MultiPo...v1.4.0
ST_SubDivideArray<Geometry>Returns list of geometries divided based of given maximum number of vertices.v1.1.0
ST_SubDivideExplodeGeometryIt works the same as ST_SubDivide but returns new rows with geometries instead of list.v1.1.0
ST_SymDifferenceGeometryReturn the symmetrical difference between geometry A and B (return parts of geometries which are in either of the sets, but not in their intersection)v1.2.0
ST_UnaryUnionGeometryThis variant of ST_Union operates on a single geometry input. The input geometry can be a simple Geometry type, a MultiGeometry, or a GeometryCollection. The function calculates the ge...v1.6.1
ST_UnionGeometryVariant 1: Return the union of geometry A and B.v1.2.0

Affine Transformations

These functions change the position and shape of geometries using affine transformations.

FunctionReturn typeDescriptionSince
ST_AffineGeometryApply an affine transformation to the given geometry.
ST_RotateGeometryRotates a geometry by a specified angle in radians counter-clockwise around a given origin point. The origin for rotation can be specified as either a POINT geometry or x and y coordinates. If the ...v1.6.1
ST_RotateXGeometryPerforms a counter-clockwise rotation of the specified geometry around the X-axis by the given angle measured in radians.v1.6.1
ST_RotateYGeometryPerforms a counter-clockwise rotation of the specified geometry around the Y-axis by the given angle measured in radians.v1.7.0
ST_ScaleGeometryThis function scales the geometry to a new size by multiplying the ordinates with the corresponding scaling factors provided as parameters scaleX and scaleY.v1.7.0
ST_ScaleGeomGeometryThis function scales the input geometry (geometry) to a new size. It does this by multiplying the coordinates of the input geometry with corresponding values from another geometry (factor) repr...v1.7.0
ST_TranslateGeometryReturns the input geometry with its X, Y and Z coordinates (if present in the geometry) translated by deltaX, deltaY and deltaZ (if specified)v1.4.1

Aggregate Functions

These functions perform aggregate operations on groups of geometries.

FunctionReturn typeDescriptionSince
ST_Collect_AggGeometryCollects all geometries in a geometry column into a single multi-geometry (MultiPoint, MultiLineString, MultiPolygon, or GeometryCollection). Unlike ST_Union_Agg, this function does not dissolve ...v1.8.1
ST_Envelope_AggGeometryReturn the entire envelope boundary of all geometries in A. Empty geometries and null values are skipped. If all inputs are empty or null, the result is null. This behavior is consistent with PostG...v1.0.0
ST_Intersection_AggGeometryReturn the polygon intersection of all polygons in Av1.0.0
ST_Union_AggGeometryReturn the polygon union of all polygons in Av1.0.0

Linear Referencing

These functions work with linear referencing, measures along lines, and trajectory data.

FunctionReturn typeDescriptionSince
ST_AddMeasureGeometryComputes a new geometry with measure (M) values linearly interpolated between start and end points. For geometries lacking M dimensions, M values are added. Existing M values are overwritten by the...v1.6.1
ST_InterpolatePointDoubleReturns the interpolated measure value of a linear measured LineString at the point closest to the specified point.v1.7.0
ST_IsValidTrajectoryBooleanThis function checks if a geometry is a valid trajectory representation. For a trajectory to be considered valid, it must be a LineString that includes measure (M) values. The key requirement is th...v1.6.1
ST_LineInterpolatePointGeometryReturns a point interpolated along a line. First argument must be a LINESTRING. Second argument is a Double between 0 and 1 representing fraction of total linestring length the point has to be loca...v1.0.1
ST_LineLocatePointDoubleReturns a double between 0 and 1, representing the location of the closest point on the LineString as a fraction of its total length. The first argument must be a LINESTRING, and the second argument...v1.5.1
ST_LineSubstringGeometryReturn a linestring being a substring of the input one starting and ending at the given fractions of total 2d length. Second and third arguments are Double values between 0 and 1. This only works w...v1.0.1
ST_LocateAlongGeometryThis function computes Point or MultiPoint geometries representing locations along a measured input geometry (LineString or MultiLineString) corresponding to the provided measure value(s). Polygona...v1.6.1

Spatial Reference System

These functions work with the Spatial Reference System of geometries.

FunctionReturn typeDescriptionSince
ST_BestSRIDIntegerReturns the estimated most appropriate Spatial Reference Identifier (SRID) for a given geometry, based on its spatial extent and location. It evaluates the geometry's bounding envelope and selects ...v1.6.0
ST_SetSRIDGeometrySets the spatial reference system identifier (SRID) of the geometry.v1.1.1
ST_SRIDIntegerReturn the spatial reference system identifier (SRID) of the geometry.v1.1.1
ST_TransformGeometryTransform the Spatial Reference System / Coordinate Reference System of A, from SourceCRS to TargetCRS. If the SourceCRS is not specified, CRS will be fetched from the geometry using [ST_SRID](#s...v1.2.0

Geometry Validation

These functions test whether geometries are valid and can repair invalid geometries.

FunctionReturn typeDescriptionSince
ST_IsValidBooleanTest if a geometry is well-formed. The function can be invoked with just the geometry or with an additional flag (from v1.5.1). The flag alters the validity checking behavior. The flags parameter...v1.0.0
ST_IsValidDetailStructReturns a row, containing a boolean valid stating if a geometry is valid, a string reason stating why it is invalid and a geometry location pointing out where it is invalid.v1.6.1
ST_IsValidReasonStringReturns text stating if the geometry is valid. If not, it provides a reason why it is invalid. The function can be invoked with just the geometry or with an additional flag. The flag alters the val...v1.5.1
ST_MakeValidGeometryGiven an invalid geometry, create a valid representation of the geometry.v1.0.0

Bounding Box Functions

These functions produce or operate on bounding boxes and compute extent values.

FunctionReturn typeDescriptionSince
ST_BoundingDiagonalGeometryReturns a linestring spanning minimum and maximum values of each dimension of the given geometry's coordinates as its start and end point respectively. If an empty geometry is provided, the returned...v1.5.0
ST_EnvelopeGeometryReturn the envelope boundary of Av1.0.0
ST_ExpandGeometryReturns a geometry expanded from the bounding box of the input. The expansion can be specified in two ways:v1.6.1
ST_MMaxDoubleReturns M maxima of the given geometry or null if there is no M coordinate.v1.6.1
ST_MMinDoubleReturns M minima of the given geometry or null if there is no M coordinate.v1.6.1
ST_XMaxDoubleReturns the maximum X coordinate of a geometryv1.2.1
ST_XMinDoubleReturns the minimum X coordinate of a geometryv1.2.1
ST_YMaxDoubleReturn the minimum Y coordinate of Av1.2.1
ST_YMinDoubleReturn the minimum Y coordinate of Av1.2.1
ST_ZMaxDoubleReturns Z maxima of the given geometry or null if there is no Z coordinate.v1.3.1
ST_ZMinDoubleReturns Z minima of the given geometry or null if there is no Z coordinate.v1.3.1

Spatial Indexing

These functions work with spatial indexing systems including Bing Tiles, H3, S2, and GeoHash.

FunctionReturn typeDescriptionSince
ST_BingTileStringCreates a Bing Tile quadkey from tile XY coordinates and a zoom level.v1.9.0
ST_BingTileAtStringReturns the Bing Tile quadkey for a given point (longitude, latitude) at a specified zoom level.v1.9.0
ST_BingTileCellIDsArray<String>Returns an array of Bing Tile quadkey strings that cover the given geometry at the specified zoom level.v1.9.0
ST_BingTilePolygonGeometryReturns the bounding polygon (Geometry) of the Bing Tile identified by the given quadkey.v1.9.0
ST_BingTilesAroundArray<String>Returns an array of Bing Tile quadkey strings representing the neighborhood tiles around the tile that contains the given point (longitude, latitude) at the specified zoom level. Returns the 3×3 ne...v1.9.0
ST_BingTileToGeomArray<Geometry>Returns an array of Polygons for the corresponding Bing Tile quadkeys.v1.9.0
ST_BingTileXIntegerReturns the tile X coordinate of the Bing Tile identified by the given quadkey.v1.9.0
ST_BingTileYIntegerReturns the tile Y coordinate of the Bing Tile identified by the given quadkey.v1.9.0
ST_BingTileZoomLevelIntegerReturns the zoom level of the Bing Tile identified by the given quadkey.v1.9.0
ST_GeoHashNeighborStringReturns the neighbor geohash cell in the given direction. Valid directions are: n, ne, e, se, s, sw, w, nw (case-insensitive).v1.9.0
ST_GeoHashNeighborsArray<String>Returns the 8 neighboring geohash cells of a given geohash string. The result is an array of 8 geohash strings in the order: N, NE, E, SE, S, SW, W, NW.v1.9.0
ST_H3CellDistanceLongreturn result of h3 function gridDistance(cel1, cell2). As described by H3 documentation > Finding the distance can fail because the two indexes...v1.5.0
ST_H3CellIDsArray<Long>Cover the geometry by H3 cell IDs with the given resolution(level). To understand the cell statistics please refer to H3 Doc H3 native fill functions...v1.5.0
ST_H3KRingArray<Long>return the result of H3 function gridDisk(cell, k).v1.5.0
ST_H3ToGeomArray<Geometry>Return the result of H3 function cellsToMultiPolygon(cells).v1.6.0
ST_S2CellIDsArray<Long>Cover the geometry with Google S2 Cells, return the corresponding cell IDs with the given level. The level indicates the size of cells. With...v1.4.0
ST_S2ToGeomArray<Geometry>Returns an array of Polygons for the corresponding S2 cell IDs.v1.6.0

Clustering Functions

These functions implement spatial clustering algorithms.

FunctionReturn typeDescriptionSince
ST_DBSCANStructPerforms a DBSCAN clustering across the entire dataframe.v1.7.1
ST_LocalOutlierFactorDoubleComputes the Local Outlier Factor (LOF) for each point in the input dataset.v1.7.1

Spatial Statistics

These functions compute spatial statistics and spatial weights.

FunctionReturn typeDescriptionSince
ST_BinaryDistanceBandColumnArray<Struct>Introduction: Returns a weights column containing every record in a dataframe within a specified threshold distance.v1.7.1
ST_GLocalStructRuns Getis and Ord's G Local (Gi or Gi*) statistic on the geometry given the weights and level.v1.7.1
ST_WeightedDistanceBandColumnArray<Struct>Introduction: Returns a weights column containing every record in a dataframe within a specified threshold distance.v1.7.1

Address Functions

These functions parse and expand street addresses using the libpostal library.

FunctionReturn typeDescriptionSince
ExpandAddressArray<String>Returns an array of expanded forms of the input address string. This is backed by the libpostal library's address expanding functionality.v1.8.0
ParseAddressArray<Struct>Returns an array of the components (e.g. street, postal code) of the input address string. This is backed by the libpostal library's address parsing funct...v1.8.0