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
LINESTRINGgeometry 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's 3D bounding box intersects B's 3D bounding box.
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 A's bounding box is the same as B's. Uses double precision bounding box.
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'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'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.
geometry_dumprows, representing the exterior and interior rings of a polygon.
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.