| Table Management Functions |
AddGeometryColumn 3d Adds a geometry column to an existing table. - table_name, column_name, srid, type, dimension, use_typmod=true
- schema_name, table_name, column_name, srid, type, dimension, use_typmod=true
- catalog_name, schema_name, table_name, column_name, srid, type, dimension, use_typmod=true
|
DropGeometryColumn 3d Removes a geometry column from a spatial table. - table_name, column_name
- schema_name, table_name, column_name
- catalog_name, schema_name, table_name, column_name
|
DropGeometryTable Drops a table and all its references in geometry_columns. - table_name
- schema_name, table_name
- catalog_name, schema_name, table_name
|
| Find_SRID (a_schema_name, a_table_name, a_geomfield_name) Returns the SRID defined for a geometry column. |
Populate_Geometry_Columns Ensures geometry columns are defined with type modifiers or have appropriate spatial constraints. - use_typmod=true
- relation_oid, use_typmod=true
|
UpdateGeometrySRID 3d Updates the SRID of all features in a geometry column, and the table metadata. - table_name, column_name, srid
- schema_name, table_name, column_name, srid
- catalog_name, schema_name, table_name, column_name, srid
|
| Geometry Constructors |
ST_Collect 3d Creates a GeometryCollection or Multi* geometry from a set of geometries. - g1, g2
- g1_array
- g1field agg
|
| ST_LineFromMultiPoint 3d (aMultiPoint) Creates a LineString from a MultiPoint geometry. |
| ST_MakeEnvelope (xmin, ymin, xmax, ymax, srid=unknown) Creates a rectangular Polygon from minimum and maximum coordinates. |
ST_MakeLine 3d Creates a LineString from Point, MultiPoint, or LineString geometries. - geom1, geom2
- geoms_array
- geoms agg
|
ST_MakePoint 3d Creates a 2D, 3DZ or 4D Point. - x, y
- x, y, z
- x, y, z, m
|
| ST_MakePointM (x, y, m) Creates a Point from X, Y and M values. |
ST_MakePolygon 3d Creates a Polygon from a shell and optional list of holes. - linestring
- outerlinestring, interiorlinestrings
|
ST_Point mm Creates a Point with X, Y and SRID values. - x, y
- x, y, srid=unknown
|
| ST_PointZ (x, y, z, srid=unknown) Creates a Point with X, Y, Z and SRID values. |
| ST_PointM (x, y, m, srid=unknown) Creates a Point with X, Y, M and SRID values. |
| ST_PointZM (x, y, z, m, srid=unknown) Creates a Point with X, Y, Z, M and SRID values. |
| ST_Polygon mm 3d (lineString, srid) Creates a Polygon from a LineString with a specified SRID. |
| ST_TileEnvelope (tileZoom, tileX, tileY, bounds=SRID=3857;LINESTRING(-20037508.342789 -20037508.342789,20037508.342789 20037508.342789), margin=0.0) Creates a rectangular Polygon in Web Mercator (SRID:3857) using the XYZ tile system. |
| ST_HexagonGrid (size, bounds) Returns a set of hexagons and cell indices that completely cover the bounds of the geometry argument. |
| ST_Hexagon (size, cell_i, cell_j, origin) Returns a single hexagon, using the provided edge size and cell coordinate within the hexagon grid space. |
| ST_SquareGrid (size, bounds) Returns a set of grid squares and cell indices that completely cover the bounds of the geometry argument. |
| ST_Square (size, cell_i, cell_j, origin='POINT(0 0)') Returns a single square, using the provided edge size and cell coordinate within the square grid space. |
| ST_Letters ( letters, font) Returns the input letters rendered as geometry with a default start position at the origin and default text height of 100. |
| Geometry Accessors |
| GeometryType 3d (geomA) Returns the type of a geometry as text. |
| ST_Boundary mm 3d (geomA) Returns the boundary of a geometry. |
| ST_BoundingDiagonal 3d (geom, fits=false) Returns the diagonal of a geometry's bounding box. |
| ST_CoordDim mm 3d (geomA) Return the coordinate dimension of a geometry. |
| ST_Dimension mm (g) Returns the topological dimension of a geometry. |
| ST_Dump 3d (g1) Returns a set of geometry_dump rows for the components of a geometry. |
| ST_DumpPoints 3d (geom) Returns a set of geometry_dump rows for the coordinates in a geometry. |
| ST_DumpSegments 3d (geom) Returns a set of geometry_dump rows for the segments in a geometry. |
| ST_DumpRings 3d (a_polygon) Returns a set of geometry_dump rows for the exterior and interior rings of a Polygon. |
| ST_EndPoint mm 3d (g) Returns the last point of a LineString or CircularLineString. |
| ST_Envelope mm (g1) Returns a geometry representing the bounding box of a geometry. |
| ST_ExteriorRing mm 3d (a_polygon) Returns a LineString representing the exterior ring of a Polygon. |
| ST_GeometryN mm 3d (geomA, n) Return an element of a geometry collection. |
| ST_GeometryType mm 3d (g1) Returns the SQL-MM type of a geometry as text. |
| ST_HasArc 3d (geomA) Tests if a geometry contains a circular arc |
| ST_InteriorRingN mm 3d (a_polygon, n) Returns the Nth interior ring (hole) of a Polygon. |
| ST_NumCurves mm 3d (a_compoundcurve) Return the number of component curves in a CompoundCurve. |
| ST_CurveN mm 3d (a_compoundcurve, index) Returns the Nth component curve geometry of a CompoundCurve. |
| ST_IsClosed mm 3d (g) Tests if a LineStrings's start and end points are coincident. For a PolyhedralSurface tests if it is closed (volumetric). |
| ST_IsCollection 3d (g) Tests if a geometry is a geometry collection type. |
| ST_IsEmpty mm (geomA) Tests if a geometry is empty. |
| ST_IsPolygonCCW 3d (geom) Tests if Polygons have exterior rings oriented counter-clockwise and interior rings oriented clockwise. |
| ST_IsPolygonCW 3d (geom) Tests if Polygons have exterior rings oriented clockwise and interior rings oriented counter-clockwise. |
| ST_IsRing mm (g) Tests if a LineString is closed and simple. |
| ST_IsSimple mm 3d (geomA) Tests if a geometry has no points of self-intersection or self-tangency. |
| ST_M mm 3d (a_point) Returns the M coordinate of a Point. |
| ST_MemSize 3d (geomA) Returns the amount of memory space a geometry takes. |
| ST_NDims 3d (g1) Returns the coordinate dimension of a geometry. |
| ST_NPoints 3d (g1) Returns the number of points (vertices) in a geometry. |
| ST_NRings 3d (geomA) Returns the number of rings in a polygonal geometry. |
| ST_NumGeometries mm 3d (geom) Returns the number of elements in a geometry collection. |
| ST_NumInteriorRings mm (a_polygon) Returns the number of interior rings (holes) of a Polygon. |
| ST_NumInteriorRing (a_polygon) Returns the number of interior rings (holes) of a Polygon. Aias for ST_NumInteriorRings |
| ST_NumPatches mm 3d (g1) Return the number of faces on a Polyhedral Surface. Will return null for non-polyhedral geometries. |
| ST_NumPoints mm (g1) Returns the number of points in a LineString or CircularString. |
| ST_PatchN mm 3d (geomA, n) Returns the Nth geometry (face) of a PolyhedralSurface. |
| ST_PointN mm 3d (a_linestring, n) Returns the Nth point in the first LineString or circular LineString in a geometry. |
| ST_Points 3d (geom) Returns a MultiPoint containing the coordinates of a geometry. |
| ST_StartPoint mm 3d (geomA) Returns the first point of a LineString. |
ST_Summary G Returns a text summary of the contents of a geometry. - g
- g
|
| ST_X mm 3d (a_point) Returns the X coordinate of a Point. |
| ST_Y mm 3d (a_point) Returns the Y coordinate of a Point. |
| ST_Z mm 3d (a_point) Returns the Z coordinate of a Point. |
| ST_Zmflag 3d (geomA) Returns a code indicating the ZM coordinate dimension of a geometry. |
| ST_HasZ 3d (geom) Checks if a geometry has a Z dimension. |
| ST_HasM 3d (geom) Checks if a geometry has an M (measure) dimension. |
| Geometry Editors |
ST_AddPoint 3d Add a point to a LineString. - linestring, point
- linestring, point, position = -1
|
ST_CollectionExtract Given a geometry collection, returns a multi-geometry containing only elements of a specified type. - collection
- collection, type
|
| ST_CollectionHomogenize (collection) Returns the simplest representation of a geometry collection. |
| ST_CurveToLine mm 3d (curveGeom, tolerance, tolerance_type, flags) Converts a geometry containing curves to a linear geometry. |
| ST_Scroll 3d (linestring, point) Change start point of a closed LineString. |
| ST_FlipCoordinates 3d (geom) Returns a version of a geometry with X and Y axis flipped. |
| ST_Force2D 3d (geomA) Force the geometries into a "2-dimensional mode". |
| ST_Force3D 3d (geomA, Zvalue = 0.0) Force the geometries into XYZ mode. This is an alias for ST_Force3DZ. |
| ST_Force3DZ 3d (geomA, Zvalue = 0.0) Force the geometries into XYZ mode. |
| ST_Force3DM (geomA, Mvalue = 0.0) Force the geometries into XYM mode. |
| ST_Force4D 3d (geomA, Zvalue = 0.0, Mvalue = 0.0) Force the geometries into XYZM mode. |
| ST_ForceCollection 3d (geomA) Convert the geometry into a GEOMETRYCOLLECTION. |
| ST_ForceCurve 3d (g) Upcast a geometry into its curved type, if applicable. |
| ST_ForcePolygonCCW 3d (geom) Orients all exterior rings counter-clockwise and all interior rings clockwise. |
| ST_ForcePolygonCW 3d (geom) Orients all exterior rings clockwise and all interior rings counter-clockwise. |
ST_ForceSFS 3d Force the geometries to use SFS 1.1 geometry types only. - geomA
- geomA, version
|
| ST_ForceRHR 3d (g) Force the orientation of the vertices in a polygon to follow the Right-Hand-Rule. |
| ST_LineExtend (line, distance_forward, distance_backward=0.0) Returns a line extended forwards and backwards by specified distances. |
| ST_LineToCurve 3d (geomANoncircular) Converts a linear geometry to a curved geometry. |
| ST_Multi (geom) Return the geometry as a MULTI* geometry. |
| ST_Normalize (geom) Return the geometry in its canonical form. |
ST_Project G Returns a point projected from a start point by a distance and bearing (azimuth). - g1, distance, azimuth
- g1, g2, distance
- g1, distance, azimuth
- g1, g2, distance
|
| ST_QuantizeCoordinates (g, prec_x, prec_y, prec_z, prec_m) Sets least significant bits of coordinates to zero |
| ST_RemovePoint 3d (linestring, offset) Remove a point from a linestring. |
| ST_RemoveRepeatedPoints 3d (geom, tolerance = 0.0) Returns a version of a geometry with duplicate points removed. |
| ST_RemoveIrrelevantPointsForView (geom, bounds, cartesian_hint = false) Removes points that are irrelevant for rendering a specific rectangular view of a geometry. |
| ST_RemoveSmallParts (geom, minSizeX, minSizeY) Removes small parts (polygon rings or linestrings) of a geometry. |
| ST_Reverse 3d (g1) Return the geometry with vertex order reversed. |
ST_Segmentize G Returns a modified geometry/geography having no segment longer than a given distance. - geom, max_segment_length
- geog, max_segment_length
|
| ST_SetPoint 3d (linestring, zerobasedposition, point) Replace point of a linestring with a given point. |
| ST_ShiftLongitude 3d (geom) Shifts the longitude coordinates of a geometry between -180..180 and 0..360. |
| ST_WrapX 3d (geom, wrap, move) Wrap a geometry around an X value. |
ST_SnapToGrid 3d Snap all points of the input geometry to a regular grid. - geomA, originX, originY, sizeX, sizeY
- geomA, sizeX, sizeY
- geomA, size
- geomA, pointOrigin, sizeX, sizeY, sizeZ, sizeM
|
| ST_Snap (input, reference, tolerance) Snap segments and vertices of input geometry to vertices of a reference geometry. |
| ST_SwapOrdinates 3d (geom, ords) Returns a version of the given geometry with given ordinate values swapped. |
| Spatial Reference System Functions |
| ST_InverseTransformPipeline (geom, pipeline, to_srid) Return a new geometry with coordinates transformed to a different spatial reference system using the inverse of a defined coordinate transformation pipeline. |
| ST_SetSRID (geom, srid) Set the SRID on a geometry. |
| ST_SRID mm (g1) Returns the spatial reference identifier for a geometry. |
ST_Transform mm Return a new geometry with coordinates transformed to a different spatial reference system. - g1, srid
- geom, to_proj
- geom, from_proj, to_proj
- geom, from_proj, to_srid
|
| ST_TransformPipeline (g1, pipeline, to_srid) Return a new geometry with coordinates transformed to a different spatial reference system using a defined coordinate transformation pipeline. |
| postgis_srs_codes (auth_name) Return the list of SRS codes associated with the given authority. |
| postgis_srs (auth_name, auth_srid) Return a metadata record for the requested authority and srid. |
| postgis_srs_all () Return metadata records for every spatial reference system in the underlying Proj database. |
| postgis_srs_search (bounds, auth_name=EPSG) Return metadata records for projected coordinate systems that have areas of usage that fully contain the bounds parameter. |
| Geometry Input |
| ST_BdPolyFromText (WKT, srid) Construct a Polygon given an arbitrary collection of closed linestrings as a MultiLineString Well-Known text representation. |
| ST_BdMPolyFromText (WKT, srid) Construct a MultiPolygon given an arbitrary collection of closed linestrings as a MultiLineString text representation Well-Known text representation. |
| ST_GeogFromText G (EWKT) Return a specified geography value from Well-Known Text representation or extended (WKT). |
| ST_GeographyFromText G (EWKT) Return a specified geography value from Well-Known Text representation or extended (WKT). |
ST_GeomCollFromText mm Makes a collection Geometry from collection WKT with the given SRID. If SRID is not given, it defaults to 0. - WKT, srid
- WKT
|
| ST_GeomFromEWKT 3d (EWKT) Return a specified ST_Geometry value from Extended Well-Known Text representation (EWKT). |
| ST_GeomFromMARC21 (marcxml) Takes MARC21/XML geographic data as input and returns a PostGIS geometry object. |
ST_GeometryFromText mm Return a specified ST_Geometry value from Well-Known Text representation (WKT). This is an alias name for ST_GeomFromText - WKT
- WKT, srid
|
ST_GeomFromText mm Return a specified ST_Geometry value from Well-Known Text representation (WKT). - WKT
- WKT, srid
|
ST_LineFromText mm Makes a Geometry from WKT representation with the given SRID. If SRID is not given, it defaults to 0. - WKT
- WKT, srid
|
ST_MLineFromText mm Return a specified ST_MultiLineString value from WKT representation. - WKT, srid
- WKT
|
ST_MPointFromText mm Makes a Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0. - WKT, srid
- WKT
|
ST_MPolyFromText mm Makes a MultiPolygon Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0. - WKT, srid
- WKT
|
ST_PointFromText mm Makes a point Geometry from WKT with the given SRID. If SRID is not given, it defaults to unknown. - WKT
- WKT, srid
|
ST_PolygonFromText mm Makes a Geometry from WKT with the given SRID. If SRID is not given, it defaults to 0. - WKT
- WKT, srid
|
| ST_WKTToSQL mm (WKT) Return a specified ST_Geometry value from Well-Known Text representation (WKT). This is an alias name for ST_GeomFromText |
| ST_GeogFromWKB G (wkb) Creates a geography instance from a Well-Known Binary geometry representation (WKB) or extended Well Known Binary (EWKB). |
| ST_GeomFromEWKB 3d (EWKB) Return a specified ST_Geometry value from Extended Well-Known Binary representation (EWKB). |
ST_GeomFromWKB mm Creates a geometry instance from a Well-Known Binary geometry representation (WKB) and optional SRID. - geom
- geom, srid
|
ST_LineFromWKB mm Makes a LINESTRING from WKB with the given SRID - WKB
- WKB, srid
|
ST_LinestringFromWKB mm Makes a geometry from WKB with the given SRID. - WKB
- WKB, srid
|
ST_PointFromWKB mm 3d Makes a geometry from WKB with the given SRID - geom
- geom, srid
|
| ST_WKBToSQL mm (WKB) Return a specified ST_Geometry value from Well-Known Binary representation (WKB). This is an alias name for ST_GeomFromWKB that takes no srid |
| ST_Box2dFromGeoHash (geohash, precision=full_precision_of_geohash) Return a BOX2D from a GeoHash string. |
| ST_GeomFromGeoHash (geohash, precision=full_precision_of_geohash) Return a geometry from a GeoHash string. |
ST_GeomFromGML 3d Takes as input GML representation of geometry and outputs a PostGIS geometry object - geomgml
- geomgml, srid
|
ST_GeomFromGeoJSON 3d Takes as input a geojson representation of a geometry and outputs a PostGIS geometry object - geomjson
- geomjson
- geomjson
|
| ST_GeomFromKML 3d (geomkml) Takes as input KML representation of geometry and outputs a PostGIS geometry object |
| ST_GeomFromTWKB (twkb) Creates a geometry instance from a TWKB ("Tiny Well-Known Binary") geometry representation. |
ST_GMLToSQL mm Return a specified ST_Geometry value from GML representation. This is an alias name for ST_GeomFromGML - geomgml
- geomgml, srid
|
| ST_LineFromEncodedPolyline (polyline, precision=5) Creates a LineString from an Encoded Polyline. |
| ST_PointFromGeoHash (geohash, precision=full_precision_of_geohash) Return a point from a GeoHash string. |
| ST_FromFlatGeobufToTable (schemaname, tablename, FlatGeobuf input data) Creates a table based on the structure of FlatGeobuf data. |
| ST_FromFlatGeobuf (Table reference, FlatGeobuf input data) Reads FlatGeobuf data. |
| Geometry Output |
ST_AsEWKT G 3d Return the Well-Known Text (WKT) representation of the geometry with SRID meta data. - g1
- g1, maxdecimaldigits=15
- g1
- g1, maxdecimaldigits=15
|
ST_AsText mm G Return the Well-Known Text (WKT) representation of the geometry/geography without SRID metadata. - g1
- g1, maxdecimaldigits = 15
- g1
- g1, maxdecimaldigits = 15
|
ST_AsBinary mm G 3d Return the OGC/ISO Well-Known Binary (WKB) representation of the geometry/geography without SRID meta data. - g1
- g1, NDR_or_XDR
- g1
- g1, NDR_or_XDR
|
ST_AsEWKB 3d Return the Extended Well-Known Binary (EWKB) representation of the geometry with SRID meta data. - g1
- g1, NDR_or_XDR
|
ST_AsHEXEWKB 3d Returns a Geometry in HEXEWKB format (as text) using either little-endian (NDR) or big-endian (XDR) encoding. - g1, NDRorXDR
- g1
|
| ST_AsEncodedPolyline (geom, precision=5) Returns an Encoded Polyline from a LineString geometry. |
ST_AsFlatGeobuf Return a FlatGeobuf representation of a set of rows. - row agg
- row, index
- row, index, geom_name
|
ST_AsGeobuf Return a Geobuf representation of a set of rows. - row agg
- row, geom_name
|
ST_AsGeoJSON G 3d Return a geometry or feature in GeoJSON format. - feature, geom_column="", maxdecimaldigits=9, pretty_bool=false, id_column=''
- geom, maxdecimaldigits=9, options=8
- geog, maxdecimaldigits=9, options=0
|
ST_AsGML mm G 3d Return the geometry as a GML version 2 or 3 element. - geom, maxdecimaldigits=15, options=0
- geog, maxdecimaldigits=15, options=0, nprefix=null, id=null
- version, geom, maxdecimaldigits=15, options=0, nprefix=null, id=null
- version, geog, maxdecimaldigits=15, options=0, nprefix=null, id=null
|
ST_AsKML G 3d Return the geometry as a KML element. - geom, maxdecimaldigits=15, nprefix=NULL
- geog, maxdecimaldigits=15, nprefix=NULL
|
| ST_AsLatLonText (pt, format='') Return the Degrees, Minutes, Seconds representation of the given point. |
| ST_AsMARC21 (geom, format='hdddmmss') Returns geometry as a MARC21/XML record with a geographic datafield (034). |
| ST_AsMVTGeom (geom, bounds, extent=4096, buffer=256, clip_geom=true) Transforms a geometry into the coordinate space of a MVT tile. |
ST_AsMVT Aggregate function returning a MVT representation of a set of rows. - row agg
- row, name
- row, name, extent
- row, name, extent, geom_name
- row, name, extent, geom_name, feature_id_name
|
ST_AsSVG G Returns SVG path data for a geometry. - geom, rel=0, maxdecimaldigits=15
- geog, rel=0, maxdecimaldigits=15
|
ST_AsTWKB Returns the geometry as TWKB, aka "Tiny Well-Known Binary" - geom, prec=0, prec_z=0, prec_m=0, with_sizes=false, with_boxes=false
- geom, ids, prec=0, prec_z=0, prec_m=0, with_sizes=false, with_boxes=false
|
| ST_AsX3D 3d (g1, maxdecimaldigits=15, options=0) Returns a Geometry in X3D xml node element format: ISO-IEC-19776-1.2-X3DEncodings-XML |
| ST_GeoHash (geom, maxchars=full_precision_of_point) Return a GeoHash representation of the geometry. |
| Operators |
&& G Returns TRUE if A's 2D bounding box intersects B's 2D bounding box. - A, B
- A, B
|
| &&(geometry,box2df) (A, B) Returns TRUE if a geometry's (cached) 2D bounding box intersects a 2D float precision bounding box (BOX2DF). |
| &&(box2df,geometry) (A, B) Returns TRUE if a 2D float precision bounding box (BOX2DF) intersects a geometry's (cached) 2D bounding box. |
| &&(box2df,box2df) (A, B) Returns TRUE if two 2D float precision bounding boxes (BOX2DF) intersect each other. |
| &&& 3d (A, B) Returns TRUE if A's n-D bounding box intersects B's n-D bounding box. |
| &&&(geometry,gidx) 3d (A, B) Returns TRUE if a geometry's (cached) n-D bounding box intersects a n-D float precision bounding box (GIDX). |
| &&&(gidx,geometry) 3d (A, B) Returns TRUE if a n-D float precision bounding box (GIDX) intersects a geometry's (cached) n-D bounding box. |
| &&&(gidx,gidx) 3d (A, B) Returns TRUE if two n-D float precision bounding boxes (GIDX) intersect each other. |
| &< (A, B) Returns TRUE if A's bounding box overlaps or is to the left of B's. |
| &<| (A, B) Returns TRUE if A's bounding box overlaps or is below B's. |
| &> (A, B) Returns TRUE if A' bounding box overlaps or is to the right of B's. |
| << (A, B) Returns TRUE if A's bounding box is strictly to the left of B's. |
| <<| (A, B) Returns TRUE if A's bounding box is strictly below B's. |
= G Returns TRUE if the coordinates and coordinate order geometry/geography A are the same as the coordinates and coordinate order of geometry/geography B. - A, B
- A, B
|
| >> (A, B) Returns TRUE if A's bounding box is strictly to the right of B's. |
| @ (A, B) Returns TRUE if A's bounding box is contained by B's. |
| @(geometry,box2df) (A, B) Returns TRUE if a geometry's 2D bounding box is contained into a 2D float precision bounding box (BOX2DF). |
| @(box2df,geometry) (A, B) Returns TRUE if a 2D float precision bounding box (BOX2DF) is contained into a geometry's 2D bounding box. |
| @(box2df,box2df) (A, B) Returns TRUE if a 2D float precision bounding box (BOX2DF) is contained into another 2D float precision bounding box. |
| |&> (A, B) Returns TRUE if A's bounding box overlaps or is above B's. |
| |>> (A, B) Returns TRUE if A's bounding box is strictly above B's. |
| ~ (A, B) Returns TRUE if A's bounding box contains B's. |
| ~(geometry,box2df) (A, B) Returns TRUE if a geometry's 2D bonding box contains a 2D float precision bounding box (GIDX). |
| ~(box2df,geometry) (A, B) Returns TRUE if a 2D float precision bounding box (BOX2DF) contains a geometry's 2D bonding box. |
| ~(box2df,box2df) (A, B) Returns TRUE if a 2D float precision bounding box (BOX2DF) contains another 2D float precision bounding box (BOX2DF). |
| ~= (A, B) Returns TRUE if A's bounding box is the same as B's. |
<-> G Returns the 2D distance between A and B. - A, B
- A, B
|
| |=| (A, B) Returns the distance between A and B trajectories at their closest point of approach. |
| <#> (A, B) Returns the 2D distance between A and B bounding boxes. |
| <<->> (A, B) Returns the n-D distance between the A and B geometries or bounding boxes |
| Spatial Relationships |
| ST_3DIntersects mm 3d (geomA, geomB) Tests if two geometries spatially intersect in 3D - only for points, linestrings, polygons, polyhedral surface (area) |
| ST_Contains mm (geomA, geomB) Tests if every point of B lies in A, and their interiors have a point in common |
| ST_ContainsProperly (geomA, geomB) Tests if every point of B lies in the interior of A |
ST_CoveredBy G Tests if every point of A lies in B - geomA, geomB
- geogA, geogB
|
ST_Covers G Tests if every point of B lies in A - geomA, geomB
- geogpolyA, geogpointB
|
| ST_Crosses mm (g1, g2) Tests if two geometries have some, but not all, interior points in common |
| ST_Disjoint mm (A, B) Tests if two geometries have no points in common |
| ST_Equals mm (A, B) Tests if two geometries include the same set of points |
ST_Intersects mm G Tests if two geometries intersect (they have at least one point in common) - geomA, geomB
- geogA, geogB
|
| ST_LineCrossingDirection (linestringA, linestringB) Returns a number indicating the crossing behavior of two LineStrings |
| ST_OrderingEquals mm (A, B) Tests if two geometries represent the same geometry and have points in the same directional order |
| ST_Overlaps mm (A, B) Tests if two geometries have the same dimension and intersect, but each has at least one point not in the other |
ST_Relate mm Tests if two geometries have a topological relationship matching an Intersection Matrix pattern, or computes their Intersection Matrix - geomA, geomB, intersectionMatrixPattern
- geomA, geomB
- geomA, geomB, boundaryNodeRule
|
| ST_RelateMatch (intersectionMatrix, intersectionMatrixPattern) Tests if a DE-9IM Intersection Matrix matches an Intersection Matrix pattern |
| ST_Touches mm (A, B) Tests if two geometries have at least one point in common, but their interiors do not intersect |
| ST_Within mm (A, B) Tests if every point of A lies in B, and their interiors have a point in common |
| ST_3DDWithin mm 3d (g1, g2, distance_of_srid) Tests if two 3D geometries are within a given 3D distance |
| ST_3DDFullyWithin 3d (g1, g2, distance) Tests if two 3D geometries are entirely within a given 3D distance |
| ST_DFullyWithin (g1, g2, distance) Tests if a geometry is entirely inside a distance of another |
ST_DWithin G Tests if two geometries are within a given distance - g1, g2, distance_of_srid
- gg1, gg2, distance_meters, use_spheroid = true
|
| ST_PointInsideCircle (a_point, center_x, center_y, radius) Tests if a point geometry is inside a circle defined by a center and radius |
| Measurement Functions |
ST_Area mm G Returns the area of a polygonal geometry. - g1
- geog, use_spheroid = true
|
ST_Azimuth G Returns the north-based azimuth of a line between two points. - origin, target
- origin, target
|
ST_Angle Returns the angle between two vectors defined by 3 or 4 points, or 2 lines. - point1, point2, point3, point4
- line1, line2
|
ST_ClosestPoint G Returns the 2D point on g1 that is closest to g2. This is the first point of the shortest line from one geometry to the other. - geom1, geom2
- geom1, geom2, use_spheroid = true
|
| ST_3DClosestPoint 3d (g1, g2) Returns the 3D point on g1 that is closest to g2. This is the first point of the 3D shortest line. |
ST_Distance mm G Returns the distance between two geometry or geography values. - g1, g2
- geog1, geog2, use_spheroid = true
|
| ST_3DDistance mm 3d (g1, g2) Returns the 3D cartesian minimum distance (based on spatial ref) between two geometries in projected units. |
| ST_DistanceSphere (geomlonlatA, geomlonlatB, radius=6371008) Returns minimum distance in meters between two lon/lat geometries using a spherical earth model. |
| ST_DistanceSpheroid (geomlonlatA, geomlonlatB, measurement_spheroid=WGS84) Returns the minimum distance between two lon/lat geometries using a spheroidal earth model. |
| ST_FrechetDistance (g1, g2, densifyFrac = -1) Returns the Fréchet distance between two geometries. |
ST_HausdorffDistance Returns the Hausdorff distance between two geometries. - g1, g2
- g1, g2, densifyFrac
|
ST_Length mm G Returns the 2D length of a linear geometry. - a_2dlinestring
- geog, use_spheroid = true
|
| ST_Length2D (a_2dlinestring) Returns the 2D length of a linear geometry. Alias for ST_Length |
| ST_3DLength mm 3d (a_3dlinestring) Returns the 3D length of a linear geometry. |
| ST_LengthSpheroid 3d (a_geometry, a_spheroid) Returns the 2D or 3D length/perimeter of a lon/lat geometry on a spheroid. |
| ST_LongestLine (g1, g2) Returns the 2D longest line between two geometries. |
| ST_3DLongestLine 3d (g1, g2) Returns the 3D longest line between two geometries |
| ST_MaxDistance (g1, g2) Returns the 2D largest distance between two geometries in projected units. |
| ST_3DMaxDistance 3d (g1, g2) Returns the 3D cartesian maximum distance (based on spatial ref) between two geometries in projected units. |
| ST_MinimumClearance (g) Returns the minimum clearance of a geometry, a measure of a geometry's robustness. |
| ST_MinimumClearanceLine (g) Returns the two-point LineString spanning a geometry's minimum clearance. |
ST_Perimeter mm G Returns the length of the boundary of a polygonal geometry or geography. - g1
- geog, use_spheroid = true
|
| ST_Perimeter2D (geomA) Returns the 2D perimeter of a polygonal geometry. Alias for ST_Perimeter. |
| ST_3DPerimeter mm 3d (geomA) Returns the 3D perimeter of a polygonal geometry. |
ST_ShortestLine G Returns the 2D shortest line between two geometries - geom1, geom2
- geom1, geom2, use_spheroid = true
|
| ST_3DShortestLine 3d (g1, g2) Returns the 3D shortest line between two geometries |
| Overlay Functions |
| ST_ClipByBox2D (geom, box) Computes the portion of a geometry falling within a rectangle. |
| ST_Difference mm g3.9 3d (geomA, geomB, gridSize = -1) Computes a geometry representing the part of geometry A that does not intersect geometry B. |
ST_Intersection mm G g3.9 3d Computes a geometry representing the shared portion of geometries A and B. - geomA, geomB, gridSize = -1
- geogA, geogB
|
| ST_MemUnion 3d (geomfield) Aggregate function which unions geometries in a memory-efficent but slower way |
| ST_Node 3d (geom) Nodes a collection of lines. |
| ST_Split (input, blade) Returns a collection of geometries created by splitting a geometry by another geometry. |
| ST_Subdivide g3.9 (geom, max_vertices=256, gridSize = -1) Computes a rectilinear subdivision of a geometry. |
| ST_SymDifference mm g3.9 3d (geomA, geomB, gridSize = -1) Computes a geometry representing the portions of geometries A and B that do not intersect. |
| ST_UnaryUnion g3.9 3d (geom, gridSize = -1) Computes the union of the components of a single geometry. |
ST_Union mm g3.9 3d Computes a geometry representing the point-set union of the input geometries. - g1, g2
- g1, g2, gridSize
- g1_array
- g1field agg
- g1field, gridSize agg
|
| Geometry Processing |
ST_Buffer mm G Computes a geometry covering all points within a given distance from a geometry. - g1, radius_of_buffer, buffer_style_parameters = ''
- g1, radius_of_buffer, num_seg_quarter_circle
- g1, radius_of_buffer, buffer_style_parameters
- g1, radius_of_buffer, num_seg_quarter_circle
|
| ST_BuildArea (geom) Creates a polygonal geometry formed by the linework of a geometry. |
ST_Centroid mm G Returns the geometric center of a geometry. - g1
- g1, use_spheroid = true
|
| ST_ChaikinSmoothing 3d (geom, nIterations = 1, preserveEndPoints = false) Returns a smoothed version of a geometry, using the Chaikin algorithm |
| ST_ConcaveHull (param_geom, param_pctconvex, param_allow_holes = false) Computes a possibly concave geometry that contains all input geometry vertices |
| ST_ConvexHull mm 3d (geomA) Computes the convex hull of a geometry. |
| ST_DelaunayTriangles 3d (g1, tolerance = 0.0, flags = 0) Returns the Delaunay triangulation of the vertices of a geometry. |
| ST_FilterByM (geom, min, max = null, returnM = false) Removes vertices based on their M value |
| ST_GeneratePoints (g, npoints, seed = 0) Generates a multipoint of random points contained in a Polygon or MultiPolygon. |
| ST_GeometricMedian 3d (geom, tolerance = NULL, max_iter = 10000, fail_if_not_converged = false) Returns the geometric median of a MultiPoint. |
ST_LineMerge g3.11 Return the lines formed by sewing together a MultiLineString. - amultilinestring
- amultilinestring, directed
|
| ST_MaximumInscribedCircle g3.9 (geom) Computes the largest circle contained within a geometry. |
| ST_LargestEmptyCircle g3.9 (geom, tolerance=0.0, boundary=POINT EMPTY) Computes the largest circle not overlapping a geometry. |
| ST_MinimumBoundingCircle (geomA, num_segs_per_qt_circ=48) Returns the smallest circle polygon that contains a geometry. |
| ST_MinimumBoundingRadius (geom) Returns the center point and radius of the smallest circle that contains a geometry. |
| ST_OrientedEnvelope (geom) Returns a minimum-area rectangle containing a geometry. |
| ST_OffsetCurve (line, signed_distance, style_parameters='') Returns an offset line at a given distance and side from an input line. |
| ST_PointOnSurface mm 3d (g1) Computes a point guaranteed to lie in a polygon, or on a geometry. |
ST_Polygonize Computes a collection of polygons formed from the linework of a set of geometries. - geomfield agg
- geom_array
|
| ST_ReducePrecision g3.9 (g, gridsize) Returns a valid geometry with points rounded to a grid tolerance. |
| ST_SharedPaths (lineal1, lineal2) Returns a collection containing paths shared by the two input linestrings/multilinestrings. |
ST_Simplify Returns a simplified representation of a geometry, using the Douglas-Peucker algorithm. - geom, tolerance
- geom, tolerance, preserveCollapsed
|
| ST_SimplifyPreserveTopology (geom, tolerance) Returns a simplified and valid representation of a geometry, using the Douglas-Peucker algorithm. |
| ST_SimplifyPolygonHull g3.11 (param_geom, vertex_fraction, is_outer = true) Computes a simplified topology-preserving outer or inner hull of a polygonal geometry. |
| ST_SimplifyVW (geom, tolerance) Returns a simplified representation of a geometry, using the Visvalingam-Whyatt algorithm |
| ST_SetEffectiveArea (geom, threshold = 0, set_area = 1) Sets the effective area for each vertex, using the Visvalingam-Whyatt algorithm. |
| ST_TriangulatePolygon g3.11 (geom) Computes the constrained Delaunay triangulation of polygons |
| ST_VoronoiLines (geom, tolerance = 0.0, extend_to = NULL) Returns the boundaries of the Voronoi diagram of the vertices of a geometry. |
| ST_VoronoiPolygons (geom, tolerance = 0.0, extend_to = NULL) Returns the cells of the Voronoi diagram of the vertices of a geometry. |
| Affine Transformations |
ST_Affine 3d Apply a 3D affine transformation to a geometry. - geomA, a, b, c, d, e, f, g, h, i, xoff, yoff, zoff
- geomA, a, b, d, e, xoff, yoff
|
ST_Rotate 3d Rotates a geometry about an origin point. - geomA, rotRadians
- geomA, rotRadians, x0, y0
- geomA, rotRadians, pointOrigin
|
| ST_RotateX 3d (geomA, rotRadians) Rotates a geometry about the X axis. |
| ST_RotateY 3d (geomA, rotRadians) Rotates a geometry about the Y axis. |
| ST_RotateZ 3d (geomA, rotRadians) Rotates a geometry about the Z axis. |
ST_Scale 3d Scales a geometry by given factors. - geomA, XFactor, YFactor, ZFactor
- geomA, XFactor, YFactor
- geom, factor
- geom, factor, origin
|
ST_Translate 3d Translates a geometry by given offsets. - g1, deltax, deltay
- g1, deltax, deltay, deltaz
|
| ST_TransScale 3d (geomA, deltaX, deltaY, XFactor, YFactor) Translates and scales a geometry by given offsets and factors. |
| Bounding Box Functions |
| Box2D (geom) Returns a BOX2D representing the 2D extent of a geometry. |
| Box3D 3d (geom) Returns a BOX3D representing the 3D extent of a geometry. |
ST_EstimatedExtent Returns the estimated extent of a spatial table. - schema_name, table_name, geocolumn_name, parent_only
- schema_name, table_name, geocolumn_name
- table_name, geocolumn_name
|
ST_Expand Returns a bounding box expanded from another bounding box or a geometry. - geom, units_to_expand
- geom, dx, dy, dz=0, dm=0
- box, units_to_expand
- box, dx, dy
- box, units_to_expand
- box, dx, dy, dz=0
|
| ST_Extent (geomfield) Aggregate function that returns the bounding box of geometries. |
| ST_3DExtent 3d (geomfield) Aggregate function that returns the 3D bounding box of geometries. |
| ST_MakeBox2D (pointLowLeft, pointUpRight) Creates a BOX2D defined by two 2D point geometries. |
| ST_3DMakeBox (point3DLowLeftBottom, point3DUpRightTop) Creates a BOX3D defined by two 3D point geometries. |
| ST_XMax 3d (aGeomorBox2DorBox3D) Returns the X maxima of a 2D or 3D bounding box or a geometry. |
| ST_XMin 3d (aGeomorBox2DorBox3D) Returns the X minima of a 2D or 3D bounding box or a geometry. |
| ST_YMax 3d (aGeomorBox2DorBox3D) Returns the Y maxima of a 2D or 3D bounding box or a geometry. |
| ST_YMin 3d (aGeomorBox2DorBox3D) Returns the Y minima of a 2D or 3D bounding box or a geometry. |
| ST_ZMax 3d (aGeomorBox2DorBox3D) Returns the Z maxima of a 2D or 3D bounding box or a geometry. |
| ST_ZMin 3d (aGeomorBox2DorBox3D) Returns the Z minima of a 2D or 3D bounding box or a geometry. |
| Linear Referencing |
ST_LineInterpolatePoint G 3d Returns a point interpolated along a line at a fractional location. - a_linestring, a_fraction
- a_linestring, a_fraction, use_spheroid = true
|
| ST_3DLineInterpolatePoint 3d (a_linestring, a_fraction) Returns a point interpolated along a 3D line at a fractional location. |
ST_LineInterpolatePoints G 3d Returns points interpolated along a line at a fractional interval. - a_linestring, a_fraction, repeat
- a_linestring, a_fraction, use_spheroid = true, repeat = true
|
ST_LineLocatePoint G Returns the fractional location of the closest point on a line to a point. - a_linestring, a_point
- a_linestring, a_point, use_spheroid = true
|
ST_LineSubstring G 3d Returns the part of a line between two fractional locations. - a_linestring, startfraction, endfraction
- a_linestring, startfraction, endfraction
|
| ST_LocateAlong mm (geom_with_measure, measure, offset = 0) Returns the point(s) on a geometry that match a measure value. |
| ST_LocateBetween mm (geom, measure_start, measure_end, offset = 0) Returns the portions of a geometry that match a measure range. |
| ST_LocateBetweenElevations 3d (geom, elevation_start, elevation_end) Returns the portions of a geometry that lie in an elevation (Z) range. |
| ST_InterpolatePoint 3d (linear_geom_with_measure, point) Returns the interpolated measure of a geometry closest to a point. |
| ST_AddMeasure 3d (geom_mline, measure_start, measure_end) Interpolates measures along a linear geometry. |