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 custom PostgreSQL data types installed by PostGIS to represent spatial data.
Each data type describes its type casting behaviour. A type cast converts values of one data type into another type. PostgreSQL allows defining casting behavior for custom types, along with the functions used to convert type values. Casts can have automatic behaviour, which allows automatic conversion of a function argument to a type supported by the function.
Some casts have explicit behaviour,
which means the cast must be specified using the syntax CAST(myval As sometype)
or myval::sometype
.
Explicit casting avoids the issue of ambiguous casts,
which can occur when using an overloaded function which does not support a given type.
For example, a function may accept a box2d or a box3d, but not a geometry.
Since geometry has an automatic cast to both box types, this produces an "ambiguous function" error.
To prevent the error use an explicit cast to the desired box type.
All data types can be cast to text
, so this does not need to be specified explicitly.
geometry_dump
rows for the components of a geometry.geometry_dump
rows for the points in a geometry.geometry_dump
rows for
the exterior and interior rings of a Polygon.valid_detail
row stating if a geometry is valid, and if not a reason why and a location.LINESTRING
from WKB with the given SRIDTRUE
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.ST_Length
ST_Perimeter
.These functions change the position and shape of geometries using affine transformations.
These functions produce or operate on bounding boxes. They can also provide and accept geometry values, by using automatic or explicit casts.
See also Section 9.7, “PostGIS Box Functions”.
These functions support working with trajectories. A trajectory is a linear geometry with a measure (M value) on each coordinate. The measure values must increase along the line. Spatio-temporal data can be modelled by using relative times (such as the epoch) as the measure values.
true
if the geometry is a valid trajectory.
true
if the closest point of approach of two trajectories
is within the specified distance.
SFCGAL is a C++ wrapper library around CGAL that provides advanced 2D and 3D spatial functions. For robustness, geometry coordinates have an exact rational number representation.
Installation instructions for the library can be found on the SFCGAL home page (http://www.sfcgal.org).
To enable the functions use create extension postgis_sfcgal
.
These functions implement a row locking mechanism to support long transactions. They are provided primarily for implementors of the Web Feature Service specification.
For the locking mechanism to operate correctly the serializable transaction isolation level must be used. |