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.
| Function | Description | Since |
|---|---|---|
| ST_GeomCollFromText | Constructs 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_GeometryFromText | Construct a Geometry from WKT. If SRID is not set, it defaults to 0 (unknown). Alias of ST_GeomFromWKT | v1.6.1 |
| ST_GeomFromEWKB | Construct a Geometry from EWKB string or Binary. This function is an alias of ST_GeomFromWKB. | v1.6.1 |
| ST_GeomFromEWKT | Construct a Geometry from OGC Extended WKT | v1.5.0 |
| ST_GeomFromGeoHash | Create Geometry from geohash string and optional precision | v1.2.1 |
| ST_GeomFromGeoJSON | Construct a Geometry from GeoJson | v1.2.0 |
| ST_GeomFromGML | Construct a Geometry from GML. | v1.3.0 |
| ST_GeomFromKML | Construct a Geometry from KML. | v1.3.0 |
| ST_GeomFromText | Construct a Geometry from WKT. Alias of ST_GeomFromWKT | v1.2.1 |
| ST_GeomFromWKB | Construct a Geometry from WKB string or Binary. This function also supports EWKB format. | v1.2.0 |
| ST_GeomFromWKT | Construct a Geometry from WKT | v1.2.0 |
| ST_LineFromText | Construct a LineString from Text | v1.2.1 |
| ST_LineFromWKB | Construct a LineString geometry from WKB string or Binary and an optional SRID. This function also supports EWKB format. | v1.6.1 |
| ST_LineStringFromText | Construct a LineString from Text, delimited by Delimiter (Optional). Alias of ST_LineFromText | v1.2.1 |
| ST_LinestringFromWKB | Construct 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_MakeEnvelope | Construct a Polygon from MinX, MinY, MaxX, MaxY, and an optional SRID. | v1.7.0 |
| ST_MakePoint | Creates 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_MakePointM | Creates a point with X, Y, and M coordinate. Use ST_MakePoint to make points with XY, XYZ, or XYZM coordinates. | v1.6.1 |
| ST_MLineFromText | Construct a MultiLineString from Text and Optional SRID | |
| ST_MPointFromText | Constructs 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_MPolyFromText | Construct a MultiPolygon from Text and Optional SRID | |
| ST_Point | Construct a Point from X and Y | v1.2.1 |
| ST_PointFromGeoHash | Generates 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_PointFromText | Construct a Point from Text, delimited by Delimiter | v1.2.0 |
| ST_PointFromWKB | Construct a Point geometry from WKB string or Binary and an optional SRID. This function also supports EWKB format. | v1.6.1 |
| ST_PointM | Construct 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_PointZ | Construct 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.5.0 |
| ST_PointZM | Construct 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_PolygonFromEnvelope | Construct a Polygon from MinX, MinY, MaxX, MaxY. | v1.2.0 |
| ST_PolygonFromText | Construct a Polygon from Text, delimited by Delimiter. Path must be closed | v1.2.0 |
Geometry Accessors¶
These functions extract information and properties from geometry objects.
| Function | Description | Since |
|---|---|---|
| GeometryType | Returns 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_Boundary | Returns the closure of the combinatorial boundary of this Geometry. | v1.3.0 |
| ST_CoordDim | Returns the coordinate dimensions of the geometry. It is an alias of ST_NDims. |
v1.5.0 |
| ST_CrossesDateLine | This 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_Dimension | Return 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_Dump | 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.5.0 |
| ST_DumpPoints | Returns list of Points which geometry consists of. | v1.5.0 |
| ST_EndPoint | Returns last point of given linestring. | v1.5.0 |
| ST_ExteriorRing | Returns a LINESTRING representing the exterior ring (shell) of a POLYGON. Returns NULL if the geometry is not a polygon. | v1.2.1 |
| ST_GeometryN | Return the 0-based Nth geometry if the geometry is a GEOMETRYCOLLECTION, (MULTI)POINT, (MULTI)LINESTRING, MULTICURVE or (MULTI)POLYGON. Otherwise, return null | v1.3.0 |
| ST_GeometryType | Returns the type of the geometry as a string. EG: 'ST_Linestring', 'ST_Polygon' etc. | v1.5.0 |
| ST_HasM | Checks 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_HasZ | Checks 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_InteriorRingN | Returns 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 range | v1.3.0 |
| ST_IsClosed | RETURNS true if the LINESTRING start and end point are the same. | v1.3.0 |
| ST_IsCollection | Returns TRUE if the geometry type of the input is a geometry collection type. Collection types are the following: |
v1.5.0 |
| ST_IsEmpty | Test if a geometry is empty geometry | v1.2.1 |
| ST_IsPolygonCCW | Returns 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_IsPolygonCW | Returns 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_IsRing | RETURN true if LINESTRING is ST_IsClosed and ST_IsSimple. | v1.3.0 |
| ST_IsSimple | Test if geometry's only self-intersections are at boundary points. | v1.3.0 |
| ST_M | Returns M Coordinate of given Point, null otherwise. | v1.6.1 |
| ST_NDims | Returns the coordinate dimension of the geometry. | v1.3.1 |
| ST_NPoints | Returns the number of points of the geometry | v1.3.0 |
| ST_NRings | Returns 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_NumGeometries | Returns the number of Geometries. If geometry is a GEOMETRYCOLLECTION (or MULTI*) return the number of geometries, for single geometries will return 1. | v1.3.0 |
| ST_NumInteriorRing | Returns number of interior rings of polygon geometries. It is an alias of ST_NumInteriorRings. | v1.6.1 |
| ST_NumInteriorRings | Returns number of interior rings of polygon geometries. | v1.3.0 |
| ST_NumPoints | Returns number of points in a LineString. | v1.4.1 |
| ST_PointN | Return 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_Points | Returns 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_StartPoint | Returns first point of given linestring. | v1.5.0 |
| ST_X | Returns X Coordinate of given Point, null otherwise. | v1.3.0 |
| ST_Y | Returns Y Coordinate of given Point, null otherwise. | v1.3.0 |
| ST_Z | Returns Z Coordinate of given Point, null otherwise. | v1.3.0 |
| ST_Zmflag | Returns 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.
| Function | Description | Since |
|---|---|---|
| ST_AddPoint | Return Linestring with additional point at the given index, if position is not available the point will be added at the end of line. | v1.3.0 |
| ST_Collect | Returns MultiGeometry object based on geometry column/s or array with geometries | v1.5.0 |
| ST_CollectionExtract | Returns a homogeneous multi-geometry from a given geometry collection. | v1.5.0 |
| ST_FlipCoordinates | Returns a version of the given geometry with X and Y axis flipped. | v1.2.0 |
| ST_Force2D | Forces 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_Force3D | Forces 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_Force3DM | Forces 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_Force3DZ | Forces 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_Force4D | Converts 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_2D | Forces 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_ForceCollection | This 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_ForcePolygonCCW | For (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_ForcePolygonCW | For (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_ForceRHR | Sets 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_LineFromMultiPoint | Creates a LineString from a MultiPoint geometry. | v1.3.0 |
| ST_LineMerge | Returns a LineString or MultiLineString formed by sewing together the constituent line work of a MULTILINESTRING. | v1.5.0 |
| ST_LineSegments | 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_MakeLine | Creates a LineString containing the points of Point, MultiPoint, or LineString geometries. Other geometry types cause an error. | v1.5.0 |
| ST_MakePolygon | Function 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.5.0 |
| ST_Multi | Returns a MultiGeometry object based on the geometry input. ST_Multi is basically an alias for ST_Collect with one geometry. | v1.5.0 |
| ST_Normalize | Returns the input geometry in its normalized form. | v1.3.0 |
| ST_Polygon | Function to create a polygon built from the given LineString and sets the spatial reference system from the srid | v1.5.0 |
| ST_Project | Calculates 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_RemovePoint | Return Linestring with removed point at given index, position can be omitted and then last one will be removed. | v1.3.0 |
| ST_RemoveRepeatedPoints | This 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_Reverse | Return the geometry with vertex order reversed | v1.2.1 |
| ST_Segmentize | Returns a modified geometry having no segment longer than the given max_segment_length. | v1.8.0 |
| ST_SetPoint | Replace 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_ShiftLongitude | Modifies 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.
| Function | Description | Since |
|---|---|---|
| ST_AsBinary | Return the Well-Known Binary representation of a geometry | v1.3.0 |
| ST_AsEWKB | Return 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.3.0 |
| ST_AsEWKT | Return 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_AsGeoJSON | Return the GeoJSON string representation of a geometry. | v1.6.1 |
| ST_AsGML | Return the GML string representation of a geometry | v1.3.0 |
| ST_AsHEXEWKB | This 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_AsKML | Return the KML string representation of a geometry | v1.3.0 |
| ST_AsText | Return the Well-Known Text string representation of a geometry. It will support M coordinate if present since v1.5.0. | v1.3.0 |
| ST_GeoHash | Returns GeoHash of the geometry with given precision | v1.2.0 |
Predicates¶
These functions test spatial relationships between geometries, returning boolean values.
| Function | Description | Since |
|---|---|---|
| ST_Contains | Return true if A fully contains B | v1.2.0 |
| ST_CoveredBy | Return true if A is covered by B | v1.3.0 |
| ST_Covers | Return true if A covers B | v1.3.0 |
| ST_Crosses | Return true if A crosses B | v1.5.0 |
| ST_Disjoint | Return true if A and B are disjoint | v1.2.1 |
| ST_DWithin | Returns true if 'leftGeometry' and 'rightGeometry' are within a specified 'distance'. | v1.5.1 |
| ST_Equals | Return true if A equals to B | v1.5.0 |
| ST_Intersects | Return true if A intersects B | v1.2.0 |
| ST_OrderingEquals | Returns true if the geometries are equal and the coordinates are in the same order | v1.2.1 |
| ST_Overlaps | Return true if A overlaps B | v1.5.0 |
| ST_Relate | The 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_RelateMatch | This function tests the relationship between two Dimensionally Extended 9-Intersection Model (DE-9IM) matrices representing geometry intersections. It evalua... | v1.6.1 |
| ST_Touches | Return true if A touches B | v1.5.0 |
| ST_Within | Return true if A is within B | v1.3.0 |
Measurement Functions¶
These functions compute measurements of distance, area, length, and angles.
| Function | Description | Since |
|---|---|---|
| ST_3DDistance | Return the 3-dimensional minimum cartesian distance between A and B | v1.3.0 |
| ST_Angle | Compute and return the angle between two vectors represented by the provided points or linestrings. | v1.5.0 |
| ST_Area | Return the area of A | v1.3.0 |
| ST_AreaSpheroid | Return the geodesic area of A using WGS84 spheroid. Unit is meter. Works better for large geometries (country level) compared to ST_Area + ST_Transform. It is equivalent to PostGIS `ST_Area(geo... |
v1.4.1 |
| ST_Azimuth | Returns Azimuth for two given points in radians. Returns null if the two points are identical. | v1.3.0 |
| ST_ClosestPoint | Returns 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_Degrees | Convert an angle in radian to degrees. | v1.5.0 |
| ST_Distance | Return the Euclidean distance between A and B | v1.2.0 |
| ST_DistanceSphere | Return the haversine / great-circle distance of A using a given earth radius (default radius: 6371008.0). Unit is meter. Works better for large geometries (country level) compared to ST_Distance ... |
v1.4.1 |
| ST_DistanceSpheroid | Return the geodesic distance of A using WGS84 spheroid. Unit is meter. Works better for large geometries (country level) compared to ST_Distance + ST_Transform. It is equivalent to PostGIS `ST_... |
v1.4.1 |
| ST_FrechetDistance | Computes and returns discrete Frechet Distance between the given two geometries, based on [Computing Discrete Frechet Distance](http://www.kr.... | v1.5.0 |
| ST_HausdorffDistance | Returns a discretized (and hence approximate) Hausdorff distance between the given 2 geometries. Optionally, a densityFraction parameter can be s... | v1.5.0 |
| ST_Length | Returns the perimeter of A. | v1.3.0 |
| ST_Length2D | Returns the perimeter of A. This function is an alias of ST_Length. | v1.6.1 |
| ST_LengthSpheroid | Return 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_LongestLine | Returns the LineString geometry representing the maximum distance between any two points from the input geometries. | v1.6.1 |
| ST_MaxDistance | Calculates 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_MinimumClearance | The 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_MinimumClearanceLine | This 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_Perimeter | This 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_Perimeter2D | This 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.
| Function | Description | Since |
|---|---|---|
| ST_ApproximateMedialAxis | Computes 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_Buffer | Returns 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_BuildArea | Returns the areal geometry formed by the constituent linework of the input geometry. | v1.2.1 |
| ST_Centroid | Return the centroid point of A | v1.5.0 |
| ST_ConcaveHull | Return 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 true | v1.4.0 |
| ST_ConvexHull | Return the Convex Hull of polygon A | v1.5.0 |
| ST_DelaunayTriangles | This function computes the Delaunay triangulation for the set of vertices in the input geometry. An optional tolerance parameter allows sna... |
v1.6.1 |
| ST_GeneratePoints | Generates 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_GeometricMedian | Computes 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_LabelPoint | ST_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_MinimumBoundingCircle | Returns 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 is 48. | v1.5.0 |
| ST_MinimumBoundingRadius | Returns a struct containing the center point and radius of the smallest circle that contains a geometry. | v1.5.0 |
| ST_OrientedEnvelope | Returns 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_PointOnSurface | Returns a POINT guaranteed to lie on the surface. | v1.2.1 |
| ST_Polygonize | Generates 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_ReducePrecision | Reduce the decimals places in the coordinates of the geometry to the given number of decimal places. The last decimal place will be rounded. | v1.5.0 |
| ST_Simplify | This function simplifies the input geometry by applying the Douglas-Peucker algorithm. | v1.7.0 |
| ST_SimplifyPolygonHull | This 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_SimplifyPreserveTopology | Simplifies 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.5.0 |
| ST_SimplifyVW | This function simplifies the input geometry by applying the Visvalingam-Whyatt algorithm. | v1.6.1 |
| ST_Snap | Snaps 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_StraightSkeleton | Computes 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_TriangulatePolygon | Generates 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_VoronoiPolygons | Returns 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.
| Function | Description | Since |
|---|---|---|
| ST_Difference | Return the difference between geometry A and B (return part of geometry A that does not intersect geometry B) | v1.5.0 |
| ST_Intersection | Return the intersection geometry of A and B | v1.5.0 |
| ST_SubDivide | Returns list of geometries divided based of given maximum number of vertices. | v1.5.0 |
| ST_SymDifference | Return 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.5.0 |
| ST_UnaryUnion | This 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_Union | Variant 1: Return the union of geometry A and B. | v1.6.0 |
Affine Transformations¶
These functions change the position and shape of geometries using affine transformations.
| Function | Description | Since |
|---|---|---|
| ST_Affine | Apply an affine transformation to the given geometry. | v1.5.0 |
| ST_Rotate | Rotates 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_RotateX | Performs a counter-clockwise rotation of the specified geometry around the X-axis by the given angle measured in radians. | v1.6.1 |
| ST_RotateY | Performs a counter-clockwise rotation of the specified geometry around the Y-axis by the given angle measured in radians. | v1.7.0 |
| ST_Scale | This 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_ScaleGeom | This 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_Translate | Returns 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.
| Function | Description | Since |
|---|---|---|
| ST_Envelope_Agg | Return 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.3.0 |
| ST_Intersection_Agg | Return the polygon intersection of all polygons in A | v1.5.0 |
| ST_Union_Agg | Return the polygon union of all polygons in A. All inputs must be polygons. | v1.3.0 |
Linear Referencing¶
These functions work with linear referencing, measures along lines, and trajectory data.
| Function | Description | Since |
|---|---|---|
| ST_AddMeasure | Computes 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_InterpolatePoint | Returns the interpolated measure value of a linear measured LineString at the point closest to the specified point. | v1.7.0 |
| ST_IsValidTrajectory | This 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_LineInterpolatePoint | Returns 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.5.0 |
| ST_LineLocatePoint | Returns 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_LineSubstring | Return 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.5.0 |
| ST_LocateAlong | This 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.
| Function | Description | Since |
|---|---|---|
| ST_BestSRID | Returns 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_SetSRID | Sets the spatial reference system identifier (SRID) of the geometry. | v1.3.0 |
| ST_SRID | Return the spatial reference system identifier (SRID) of the geometry. | v1.3.0 |
| ST_Transform | Transform the Spatial Reference System / Coordinate Reference System of A, from SourceCRS to TargetCRS. | v1.2.0 |
Geometry Validation¶
These functions test whether geometries are valid and can repair invalid geometries.
| Function | Description | Since |
|---|---|---|
| ST_IsValid | Test 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_IsValidReason | Returns 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_MakeValid | Given an invalid geometry, create a valid representation of the geometry. | v1.5.0 |
Bounding Box Functions¶
These functions produce or operate on bounding boxes and compute extent values.
| Function | Description | Since |
|---|---|---|
| ST_BoundingDiagonal | Returns 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_Envelope | Return the envelope boundary of A | v1.3.0 |
| ST_Expand | Returns a geometry expanded from the bounding box of the input. The expansion can be specified in two ways: | v1.6.1 |
| ST_MMax | Returns M maxima of the given geometry or null if there is no M coordinate. | v1.6.1 |
| ST_MMin | Returns M minima of the given geometry or null if there is no M coordinate. | v1.6.1 |
| ST_XMax | Returns the maximum X coordinate of a geometry | v1.2.1 |
| ST_XMin | Returns the minimum X coordinate of a geometry | v1.2.1 |
| ST_YMax | Return the minimum Y coordinate of A | v1.2.1 |
| ST_YMin | Return the minimum Y coordinate of A | v1.2.1 |
| ST_ZMax | Returns Z maxima of the given geometry or null if there is no Z coordinate. | v1.3.1 |
| ST_ZMin | Returns 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.
| Function | Description | Since |
|---|---|---|
| ST_BingTile | Creates a Bing Tile quadkey from tile XY coordinates and a zoom level. | v1.9.0 |
| ST_BingTileAt | Returns the Bing Tile quadkey for a given point (longitude, latitude) at a specified zoom level. | v1.9.0 |
| ST_BingTileCellIDs | Returns an array of Bing Tile quadkey strings that cover the given geometry at the specified zoom level. | v1.9.0 |
| ST_BingTilePolygon | Returns the bounding polygon (Geometry) of the Bing Tile identified by the given quadkey. | v1.9.0 |
| ST_BingTilesAround | 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_BingTileToGeom | Returns an array of Polygons for the corresponding Bing Tile quadkeys. | v1.9.0 |
| ST_BingTileX | Returns the tile X coordinate of the Bing Tile identified by the given quadkey. | v1.9.0 |
| ST_BingTileY | Returns the tile Y coordinate of the Bing Tile identified by the given quadkey. | v1.9.0 |
| ST_BingTileZoomLevel | Returns the zoom level of the Bing Tile identified by the given quadkey. | v1.9.0 |
| ST_GeoHashNeighbor | Returns 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_GeoHashNeighbors | 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_H3CellDistance | return 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_H3CellIDs | 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_H3KRing | return the result of H3 function gridDisk(cell, k). | v1.5.0 |
| ST_H3ToGeom | Return the result of H3 function cellsToMultiPolygon(cells). | v1.6.0 |
| ST_S2CellIDs | 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_S2ToGeom | Returns an array of Polygons for the corresponding S2 cell IDs. | v1.6.0 |