The functions given below are the ones which a user of PostGIS is likely to need. There are other functions which are required support functions to the PostGIS objects which are not of use to a general user.
![]() | |
PostGIS has begun a transition from the existing naming convention to an SQL-MM-centric convention. As a result, most of the functions that you know and love have been renamed using the standard spatial type (ST) prefix. Previous functions are still available, though are not listed in this document where updated functions are equivalent. The non ST_ functions not listed in this documentation are deprecated and will be removed in a future release so STOP USING THEM. |
This section lists the PostgreSQL data types installed by PostGIS. Note we describe the casting behavior of these which is very important especially when designing your own functions.
A Cast is when one type is coerced into another type. PostgreSQL is unique from most databases in that it allows you to define casting behavior for custom types and the functions used for casting. A cast can be specified as automatic in which case, you do not have to do a CAST(myfoo As otherfootype) or myfoo::otherfootype if you are feeding it to a function that only works with otherfootype and there is an automatic cast in place for it.
The danger of relying on automatic cast behavior is when you have an overloaded function say one that takes a box2d and one that takes a box3d but no geometry. What happens is that both functions are equally good to use with geometry since geometry has an autocast for both -- so you end up with an ambiguous function error. To force PostgreSQL to choose, you do a CAST(mygeom As box3d) or mygeom::box3d.
At least as of PostgreSQL 8.3 - Everything can be CAST to text (presumably because of the magical unknown type), so no defined CASTS for that need to be present for you to CAST an object to text.
geometry_columns view. By default will convert all geometry
columns with no type modifier to ones with type modifiers. To get old behavior set use_typmod=falseLINESTRING from WKB with the given SRIDLINESTRING or CIRCULARLINESTRING
geometry as a POINT.POLYGON geometry. Return
NULL if the geometry is not a polygon. Will not work with MULTIPOLYGONTRUE if the
LINESTRING's start and end points are coincident. For Polyhedral surface is closed (volumetric).
TRUE if the argument is a
collection (MULTI*, GEOMETRYCOLLECTION, ...)
TRUE if this
LINESTRING is both closed and simple.true if the
ST_Geometry is well formed.
LINESTRING
geometry as a POINT.TRUE if A's 2D bounding box intersects B's 2D bounding box.TRUE if a geometry's (cached) 2D bounding box intersects a 2D float precision bounding box (BOX2DF).TRUE if a 2D float precision bounding box (BOX2DF) intersects a geometry's (cached) 2D bounding box.TRUE if two 2D float precision bounding boxes (BOX2DF) intersect each other.TRUE if A's n-D bounding box intersects B's n-D bounding box.TRUE if a geometry's (cached) n-D bounding box intersects a n-D float precision bounding box (GIDX).TRUE if a n-D float precision bounding box (GIDX) intersects a geometry's (cached) n-D bounding box.TRUE if two n-D float precision bounding boxes (GIDX) intersect each other.TRUE if A's bounding box overlaps or is to the left of B's.TRUE if A's bounding box overlaps or is below B's.TRUE if A' bounding box overlaps or is to the right of B's.TRUE if A's bounding box is strictly to the left of B's.TRUE if A's bounding box is strictly below B's.TRUE if the coordinates and coordinate order geometry/geography A
are the same as the coordinates and coordinate order of geometry/geography B.TRUE if A's bounding box is strictly to the right of B's.TRUE if A's bounding box is contained by B's.TRUE if a geometry's 2D bounding box is contained into a 2D float precision bounding box (BOX2DF).TRUE if a 2D float precision bounding box (BOX2DF) is contained into a geometry's 2D bounding box.TRUE if a 2D float precision bounding box (BOX2DF) is contained into another 2D float precision bounding box.TRUE if A's bounding box overlaps or is above B's.TRUE if A's bounding box is strictly above B's.TRUE if A's bounding box contains B's.TRUE if a geometry's 2D bonding box contains a 2D float precision bounding box (GIDX).TRUE if a 2D float precision bounding box (BOX2DF) contains a geometry's 2D bonding box.TRUE if a 2D float precision bounding box (BOX2DF) contains another 2D float precision bounding box (BOX2DF).TRUE if A's bounding box is the same as B's.TRUE if the supplied geometries have some, but not all,
interior points in common.ST_LengthPOINT guaranteed to lie on the surface.POINT projected from a start point using a distance in meters and bearing (azimuth) in radians.TRUE if the geometries have at least one point in common,
but their interiors do not intersect.SFCGAL is a C++ wrapper library around CGAL that provides advanced 2D and 3D functions. For robustness, geometry coordinates have an exact rational number representation.
Installation instructions of the library can be found on SFCGAL home page http://www.sfcgal.org. To load the functions create extension postgis_sfcgal.
Some SFCGAL functions replace standard ones (ST_Intersects, ST_Intersection, ST_Difference, ST_Union, ST_Area and ST_Distance), to switch between standard functions and SFCGAL function use:
SET postgis.backend = sfcgal;
and
SET postgis.backend = geos;
geometry_dump rows, representing
the exterior and interior rings of a polygon.true if the geometry is a valid trajectory.
This module and associated pl/pgsql functions have been implemented to provide long locking support required by Web Feature Service specification.
![]() | |
Users must use serializable transaction level otherwise locking mechanism would break. |
These functions are rarely used functions that should only be used if your data is corrupted in someway. They are used for troubleshooting corruption and also fixing things that should under normal circumstances, never happen.