Table of Contents
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_columnsview. By default will convert all geometry columns with no type modifier to ones with type modifiers. To get old behavior set
LINESTRINGfrom WKB with the given SRID
CIRCULARLINESTRINGgeometry as a
POLYGONgeometry. Return NULL if the geometry is not a polygon. Will not work with MULTIPOLYGON
LINESTRING's start and end points are coincident. For Polyhedral surface is closed (volumetric).
TRUEif the argument is a collection (
LINESTRINGis both closed and simple.
ST_Geometryis well formed.
LINESTRINGgeometry as a
TRUEif A's 2D bounding box intersects B's 2D bounding box.
TRUEif a geometry's (cached) 2D bounding box intersects a 2D float precision bounding box (BOX2DF).
TRUEif a 2D float precision bounding box (BOX2DF) intersects a geometry's (cached) 2D bounding box.
TRUEif two 2D float precision bounding boxes (BOX2DF) intersect each other.
TRUEif A's n-D bounding box intersects B's n-D bounding box.
TRUEif a geometry's (cached) n-D bounding box intersects a n-D float precision bounding box (GIDX).
TRUEif a n-D float precision bounding box (GIDX) intersects a geometry's (cached) n-D bounding box.
TRUEif two n-D float precision bounding boxes (GIDX) intersect each other.
TRUEif A's bounding box overlaps or is to the left of B's.
TRUEif A's bounding box overlaps or is below B's.
TRUEif A' bounding box overlaps or is to the right of B's.
TRUEif A's bounding box is strictly to the left of B's.
TRUEif A's bounding box is strictly below B's.
TRUEif the coordinates and coordinate order geometry/geography A are the same as the coordinates and coordinate order of geometry/geography B.
TRUEif A's bounding box is strictly to the right of B's.
TRUEif A's bounding box is contained by B's.
TRUEif a geometry's 2D bounding box is contained into a 2D float precision bounding box (BOX2DF).
TRUEif a 2D float precision bounding box (BOX2DF) is contained into a geometry's 2D bounding box.
TRUEif a 2D float precision bounding box (BOX2DF) is contained into another 2D float precision bounding box.
TRUEif A's bounding box overlaps or is above B's.
TRUEif A's bounding box is strictly above B's.
TRUEif A's bounding box contains B's.
TRUEif a geometry's 2D bonding box contains a 2D float precision bounding box (GIDX).
TRUEif a 2D float precision bounding box (BOX2DF) contains a geometry's 2D bonding box.
TRUEif a 2D float precision bounding box (BOX2DF) contains another 2D float precision bounding box (BOX2DF).
TRUEif A's bounding box is the same as B's.
TRUEif the supplied geometries have some, but not all, interior points in common.
POINTguaranteed to lie on the surface.
POINTprojected from a start point using a distance in meters and bearing (azimuth) in radians.
TRUEif 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;
SET postgis.backend = geos;
geometry_dumprows, representing the exterior and interior rings of a polygon.
trueif 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.