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. |
Abstract
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. |
TRUE
if STATS usage has been
enabled.geometry_columns
table.geometry_columns
table if they are not there.LINESTRING
from WKB with the given SRIDReturn the coordinate dimension of the ST_Geometry value.
LINESTRING
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.
TRUE
if this
LINESTRING
is both closed and simple.true
if the
ST_Geometry
is well formed.
LINESTRING
geometry as a POINT
.ST_Geometry
.
TRUE
if A's bounding box overlaps B's.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 A's bounding box is the same as B's (uses float4 boxes).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'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's bounding box is the same as B's.TRUE
if the supplied geometries have some, but not all,
interior points in common.ST_Length
POINT
guaranteed to lie on the surface.TRUE
if the geometries have at least one point in common,
but their interiors do not intersect.geometry_dump
rows, 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.