Table Management Functions |
AddGeometryColumn3d
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
|
DropGeometryColumn3d
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
|
UpdateGeometrySRID3d
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_Collect3d
Creates a GeometryCollection or Multi* geometry from a set of geometries.- g1, g2
- g1_array
- g1field agg
|
ST_LineFromMultiPoint3d
(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_MakeLine3d
Creates a LineString from Point, MultiPoint, or LineString geometries.- geom1, geom2
- geoms_array
- geoms agg
|
ST_MakePoint3d
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_MakePolygon3d
Creates a Polygon from a shell and optional list of holes.- linestring
- outerlinestring, interiorlinestrings
|
ST_Pointmm
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_Polygonmm 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)
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 |
GeometryType3d
(geomA)
Returns the type of a geometry as text.
|
ST_Boundarymm 3d
(geomA)
Returns the boundary of a geometry.
|
ST_BoundingDiagonal3d
(geom, fits=false)
Returns the diagonal of a geometry's bounding box.
|
ST_CoordDimmm 3d
(geomA)
Return the coordinate dimension of a geometry.
|
ST_Dimensionmm
(g)
Returns the topological dimension of a geometry.
|
ST_Dump3d
(g1)
Returns a set of geometry_dump rows for the components of a geometry.
|
ST_DumpPoints3d
(geom)
Returns a set of geometry_dump rows for the coordinates in a geometry.
|
ST_DumpSegments3d
(geom)
Returns a set of geometry_dump rows for the segments in a geometry.
|
ST_DumpRings3d
(a_polygon)
Returns a set of geometry_dump rows for
the exterior and interior rings of a Polygon.
|
ST_EndPointmm 3d
(g)
Returns the last point of a LineString or CircularLineString.
|
ST_Envelopemm
(g1)
Returns a geometry representing the bounding box of a geometry.
|
ST_ExteriorRingmm 3d
(a_polygon)
Returns a LineString representing the exterior ring of a Polygon.
|
ST_GeometryNmm 3d
(geomA, n)
Return an element of a geometry collection.
|
ST_GeometryTypemm 3d
(g1)
Returns the SQL-MM type of a geometry as text.
|
ST_HasArc3d
(geomA)
Tests if a geometry contains a circular arc
|
ST_InteriorRingNmm 3d
(a_polygon, n)
Returns the Nth interior ring (hole) of a Polygon.
|
ST_IsClosedmm 3d
(g)
Tests if a LineStrings's start and end points are coincident. For a PolyhedralSurface tests if it is closed (volumetric).
|
ST_IsCollection3d
(g)
Tests if a geometry is a geometry collection type.
|
ST_IsEmptymm
(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_IsRingmm
(g)
Tests if a LineString is closed and simple.
|
ST_IsSimplemm 3d
(geomA)
Tests if a geometry has no points of self-intersection or self-tangency.
|
ST_Mmm 3d
(a_point)
Returns the M coordinate of a Point.
|
ST_MemSize3d
(geomA)
Returns the amount of memory space a geometry takes.
|
ST_NDims3d
(g1)
Returns the coordinate dimension of a geometry.
|
ST_NPoints3d
(g1)
Returns the number of points (vertices) in a geometry.
|
ST_NRings3d
(geomA)
Returns the number of rings in a polygonal geometry.
|
ST_NumGeometriesmm 3d
(geom)
Returns the number of elements in a geometry collection.
|
ST_NumInteriorRingsmm
(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_NumPatchesmm 3d
(g1)
Return the number of faces on a Polyhedral Surface. Will return null for non-polyhedral geometries.
|
ST_NumPointsmm
(g1)
Returns the number of points in a LineString or CircularString.
|
ST_PatchNmm 3d
(geomA, n)
Returns the Nth geometry (face) of a PolyhedralSurface.
|
ST_PointNmm 3d
(a_linestring, n)
Returns the Nth point in the first LineString or circular LineString in a
geometry.
|
ST_Points3d
(geom)
Returns a MultiPoint containing the coordinates of a geometry.
|
ST_StartPointmm 3d
(geomA)
Returns the first point of a LineString.
|
ST_SummaryG
Returns a text summary of the contents of a geometry.
- g
- g
|
ST_Xmm 3d
(a_point)
Returns the X coordinate of a Point.
|
ST_Ymm 3d
(a_point)
Returns the Y coordinate of a Point.
|
ST_Zmm 3d
(a_point)
Returns the Z coordinate of a Point.
|
ST_Zmflag3d
(geomA)
Returns a code indicating the ZM coordinate dimension of a geometry.
|
Geometry Editors |
ST_AddPoint3d
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_CurveToLinemm 3d
(curveGeom, tolerance, tolerance_type, flags)
Converts a geometry containing curves to a linear geometry.
|
ST_Scroll3d
(linestring, point)
Change start point of a closed LineString.
|
ST_FlipCoordinates3d
(geom)
Returns a version of a geometry with X and Y axis flipped.
|
ST_Force2D3d
(geomA)
Force the geometries into a "2-dimensional mode".
|
ST_Force3D3d
(geomA, Zvalue = 0.0)
Force the geometries into XYZ mode. This is an alias for ST_Force3DZ.
|
ST_Force3DZ3d
(geomA, Zvalue = 0.0)
Force the geometries into XYZ mode.
|
ST_Force3DM
(geomA, Mvalue = 0.0)
Force the geometries into XYM mode.
|
ST_Force4D3d
(geomA, Zvalue = 0.0, Mvalue = 0.0)
Force the geometries into XYZM mode.
|
ST_ForcePolygonCCW
3d
(geom)
Orients all exterior rings counter-clockwise and all interior rings clockwise.
|
ST_ForceCollection3d
(geomA)
Convert the geometry into a GEOMETRYCOLLECTION.
|
ST_ForcePolygonCW
3d
(geom)
Orients all exterior rings clockwise and all interior rings counter-clockwise.
|
ST_ForceSFS3d
Force the geometries to use SFS 1.1 geometry types only.- geomA
- geomA, version
|
ST_ForceRHR3d
(g)
Force the orientation of the vertices in a polygon to follow the
Right-Hand-Rule.
|
ST_ForceCurve3d
(g)
Upcast a geometry into its curved type, if applicable.
|
ST_LineToCurve3d
(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_QuantizeCoordinates
(g, prec_x, prec_y, prec_z, prec_m)
Sets least significant bits of coordinates to zero
|
ST_RemovePoint3d
(linestring, offset)
Remove a point from a linestring.
|
ST_RemoveRepeatedPoints3d
(geom, tolerance)
Returns a version of a geometry with
duplicate points removed.
|
ST_Reverse3d
(g1)
Return the geometry with vertex order reversed.
|
ST_SegmentizeG
Returns a modified geometry/geography having no segment longer than a
given distance.- geom, max_segment_length
- geog, max_segment_length
|
ST_SetPoint3d
(linestring, zerobasedposition, point)
Replace point of a linestring with a given point.
|
ST_ShiftLongitude3d
(geom)
Shifts the longitude coordinates of a geometry between -180..180 and 0..360.
|
ST_WrapX3d
(geom, wrap, move)
Wrap a geometry around an X value.
|
ST_SnapToGrid3d
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_SwapOrdinates3d
(geom, ords)
Returns a version of the given geometry with
given ordinate values swapped.
|
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_GeogFromTextG
(EWKT)
Return a specified geography value from Well-Known Text representation or extended (WKT).
|
ST_GeographyFromTextG
(EWKT)
Return a specified geography value from Well-Known Text representation or extended (WKT).
|
ST_GeomCollFromTextmm
Makes a collection Geometry from collection WKT with the given SRID. If SRID is
not given, it defaults to 0.- WKT, srid
- WKT
|
ST_GeomFromEWKT3d
(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_GeometryFromTextmm
Return a specified ST_Geometry value from Well-Known Text representation (WKT). This is an alias name for ST_GeomFromText- WKT
- WKT, srid
|
ST_GeomFromTextmm
Return a specified ST_Geometry value from Well-Known Text representation (WKT).- WKT
- WKT, srid
|
ST_LineFromTextmm
Makes a Geometry from WKT representation with the given SRID. If SRID is
not given, it defaults to 0.- WKT
- WKT, srid
|
ST_MLineFromTextmm
Return a specified ST_MultiLineString value from WKT representation.- WKT, srid
- WKT
|
ST_MPointFromTextmm
Makes a Geometry from WKT with the given SRID. If SRID is
not given, it defaults to 0.- WKT, srid
- WKT
|
ST_MPolyFromTextmm
Makes a MultiPolygon Geometry from WKT with the given SRID. If SRID is
not given, it defaults to 0.- WKT, srid
- WKT
|
ST_PointFromTextmm
Makes a point Geometry from WKT with the given SRID. If SRID is
not given, it defaults to unknown.- WKT
- WKT, srid
|
ST_PolygonFromTextmm
Makes a Geometry from WKT with the given SRID. If SRID is
not given, it defaults to 0.- WKT
- WKT, srid
|
ST_WKTToSQLmm
(WKT)
Return a specified ST_Geometry value from Well-Known Text representation (WKT). This is an alias name for ST_GeomFromText
|
ST_GeogFromWKBG
(wkb)
Creates a geography instance from a Well-Known Binary geometry
representation (WKB) or extended Well Known Binary (EWKB).
|
ST_GeomFromEWKB3d
(EWKB)
Return a specified ST_Geometry value from Extended Well-Known Binary representation (EWKB).
|
ST_GeomFromWKBmm
Creates a geometry instance from a Well-Known Binary geometry
representation (WKB) and optional SRID.- geom
- geom, srid
|
ST_LineFromWKBmm
Makes a LINESTRING from WKB with the given SRID- WKB
- WKB, srid
|
ST_LinestringFromWKBmm
Makes a geometry from WKB with the given SRID.- WKB
- WKB, srid
|
ST_PointFromWKBmm 3d
Makes a geometry from WKB with the given SRID- geom
- geom, srid
|
ST_WKBToSQLmm
(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_GeomFromGML3d
Takes as input GML representation of geometry and outputs a PostGIS geometry object- geomgml
- geomgml, srid
|
ST_GeomFromGeoJSON3d
Takes as input a geojson representation of a geometry and outputs a PostGIS geometry object- geomjson
- geomjson
- geomjson
|
ST_GeomFromKML3d
(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_GMLToSQLmm
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_AsEWKTG 3d
Return the Well-Known Text (WKT) representation of the geometry with SRID meta data.- g1
- g1, maxdecimaldigits=15
- g1
- g1, maxdecimaldigits=15
|
ST_AsTextmm G
Return the Well-Known Text (WKT) representation of the geometry/geography without SRID metadata.- g1
- g1, maxdecimaldigits = 15
- g1
- g1, maxdecimaldigits = 15
|
ST_AsBinarymm 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_AsEWKB3d
Return the Extended Well-Known Binary (EWKB) representation of the geometry with SRID meta data.- g1
- g1, NDR_or_XDR
|
ST_AsHEXEWKB3d
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_AsGeoJSONG 3d
Return a geometry as a GeoJSON element.- feature, geomcolumnname, maxdecimaldigits=9, pretty_bool=false
- geom, maxdecimaldigits=9, options=8
- geog, maxdecimaldigits=9, options=0
|
ST_AsGMLmm 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_AsKMLG 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_AsSVGG
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_AsX3D3d
(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 centroids of A and B bounding
boxes.
|
<<#>>
(A, B)
Returns the n-D distance between A and B bounding boxes.
|