Postgis 2.1 Cheatsheet: Postgresql Postgis Geometry/Geography/Box Types Operators
Postgis 2.1 Cheatsheet: Postgresql Postgis Geometry/Geography/Box Types Operators
0dev r11091
>> (A, B) Returns TRUE if A's bounding box is strictly to the right of
DropGeometryColumn3d Removes a geometry column from a spatial table. B's.
1. table_name, column_name @ (A, B) Returns TRUE if A's bounding box is contained by B's.
2. schema_name, table_name, column_name |&> (A, B) Returns TRUE if A's bounding box overlaps or is above
3. catalog_name, schema_name, table_name, column_name B's.
|>> (A, B) Returns TRUE if A's bounding box is strictly above B's.
DropGeometryTable Drops a table and all its references in
geometry_columns. ~ (A, B) Returns TRUE if A's bounding box contains B's.
1. table_name
~= (A, B) Returns TRUE if A's bounding box is the same as B's.
2. schema_name, table_name
3. catalog_name, schema_name, table_name <-> (A, B) Returns the distance between two points. For point / point
checks it uses floating point accuracy (as opposed to the double
PostGIS_Full_Version () Reports full postgis version and build configuration precision accuracy of the underlying point geometry). For other
infos. geometry types the distance between the floating point bounding box
PostGIS_GEOS_Version () Returns the version number of the GEOS library. centroids is returned. Useful for doing distance ordering and nearest
neighbor limits using KNN gist functionality.
PostGIS_LibXML_Version () Returns the version number of the libxml2 library.
<#> (A, B) Returns the distance between bounding box of 2
PostGIS_Lib_Build_Date () Returns build date of the PostGIS library. geometries. For point / point checks it's almost the same as distance
PostGIS_Lib_Version () Returns the version number of the PostGIS library. (though may be different since the bounding box is at floating point
PostGIS_PROJ_Version () Returns the version number of the PROJ4 library. accuracy and geometries are double precision). Useful for doing
distance ordering and nearest neighbor limits using KNN gist
PostGIS_Scripts_Build_Date () Returns build date of the PostGIS scripts. functionality.
PostGIS_Scripts_Installed () Returns version of the postgis scripts installed in
this database. Spatial Relationships and Measurements
PostGIS_Scripts_Released () Returns the version number of the postgis.sql
script released with the installed postgis lib. ST_3DClosestPoint3d (g1, g2) Returns the 3-dimensional point on
g1 that is closest to g2. This is the first point of the 3D shortest line.
PostGIS_Version () Returns PostGIS version number and compile-time
options. ST_3DDistancemm 3d (g1, g2) For geometry type Returns the
Populate_Geometry_Columns Ensures geometry columns are defined with 3-dimensional cartesian minimum distance (based on spatial ref)
type modifiers or have appropriate spatial constraints This ensures they will be between two geometries in projected units.
registered correctly in geometry_columns view. By default will convert all ST_3DDWithinmm 3d (g1, g2, distance_of_srid) For 3d (z)
geometry columns with no type modifier to ones with type modifiers. To get old geometry type Returns true if two geometries 3d distance is within
behavior set use_typmod=false number of units.
1. use_typmod=true
2. relation_oid, use_typmod=true ST_3DDFullyWithin3d (g1, g2, distance) Returns true if all of the
3D geometries are within the specified distance of one another.
UpdateGeometrySRID3d Updates the SRID of all features in a geometry
ST_3DIntersectsmm 3d (geomA, geomB) Returns TRUE if the
column, geometry_columns metadata and srid. If it was enforced with constraints,
Geometries "spatially intersect" in 3d - only for points and linestrings
the constraints will be updated with new srid constraint. If the old was enforced by
type definition, the type definition will be changed. ST_3DLongestLine3d (g1, g2) Returns the 3-dimensional longest
line between two geometries
1. table_name, column_name, srid
2. schema_name, table_name, column_name, srid ST_3DMaxDistance3d (g1, g2) For geometry type Returns the
3. catalog_name, schema_name, table_name, column_name, 3-dimensional cartesian maximum distance (based on spatial ref)
srid between two geometries in projected units.
ST_3DShortestLine3d (g1, g2) Returns the 3-dimensional shortest
Geometry Constructors line between two geometries
ST_BdPolyFromText (WKT, srid) Construct a Polygon given an arbitrary ST_Areamm G Returns the area of the surface if it is a polygon or
collection of closed linestrings as a MultiLineString Well-Known text multi-polygon. For "geometry" type area is in SRID units. For
representation. "geography" area is in square meters.
ST_BdMPolyFromText (WKT, srid) Construct a MultiPolygon given an 1. g1
arbitrary collection of closed linestrings as a MultiLineString text representation 2. geog, use_spheroid=true
Well-Known text representation.
1 of 7
PostGIS 2.1 Cheat Sheet 2.1.0dev r11091
ST_GeogFromTextG (EWKT) Return a specified geography value from ST_AzimuthG Returns the angle in radians from the horizontal of
Well-Known Text representation or extended (WKT). the vector defined by pointA and pointB. Angle is computed clockwise
from down-to-up: on the clock: 12=0; 3=PI/2; 6=PI; 9=3PI/2.
ST_GeographyFromTextG (EWKT) Return a specified geography value from
Well-Known Text representation or extended (WKT). 1. pointA, pointB
2. pointA, pointB
ST_GeogFromWKBG (geom) Creates a geography instance from a
Well-Known Binary geometry representation (WKB) or extended Well Known
Binary (EWKB). ST_Centroidmm (g1) Returns the geometric center of a geometry.
ST_ClosestPoint (g1, g2) Returns the 2-dimensional point on g1
ST_GeomCollFromTextmm Makes a collection Geometry from collection WKT
that is closest to g2. This is the first point of the shortest line.
with the given SRID. If SRID is not give, it defaults to -1.
1. WKT, srid
ST_Containsmm (geomA, geomB) Returns true if and only if no
2. WKT
points of B lie in the exterior of A, and at least one point of the interior
of B lies in the interior of A.
ST_GeomFromEWKB3d (EWKB) Return a specified ST_Geometry value from
ST_ContainsProperly (geomA, geomB) Returns true if B intersects
Extended Well-Known Binary representation (EWKB).
the interior of A but not the boundary (or exterior). A does not contain
ST_GeomFromEWKT3d (EWKT) Return a specified ST_Geometry value from properly itself, but does contain itself.
Extended Well-Known Text representation (EWKT).
ST_CoversG Returns 1 (TRUE) if no point in Geometry B is outside
mm Geometry A
ST_GeometryFromText Return a specified ST_Geometry value from
Well-Known Text representation (WKT). This is an alias name for 1. geomA, geomB
2. geogpolyA, geogpointB
ST_GeomFromText
1. WKT
2. WKT, srid ST_CoveredByG Returns 1 (TRUE) if no point in
Geometry/Geography A is outside Geometry/Geography B
ST_GeomFromGML3d Takes as input GML representation of geometry and
1. geomA, geomB
outputs a PostGIS geometry object
1. geomgml 2. geogA, geogB
2. geomgml, srid
ST_Crossesmm (g1, g2) Returns TRUE if the supplied geometries
3d have some, but not all, interior points in common.
ST_GeomFromGeoJSON (geomjson) Takes as input a geojson
representation of a geometry and outputs a PostGIS geometry object ST_LineCrossingDirection (linestringA, linestringB) Given 2
3d
ST_GeomFromKML (geomkml) Takes as input KML representation of linestrings, returns a number between -3 and 3 denoting what kind of
geometry and outputs a PostGIS geometry object crossing behavior. 0 is no crossing.
ST_GMLToSQLmm Return a specified ST_Geometry value from GML ST_Disjointmm (A, B) Returns TRUE if the Geometries do not
representation. This is an alias name for ST_GeomFromGML "spatially intersect" - if they do not share any space together.
ST_Distance2 mm G For geometry type Returns the 2-dimensional
1. geomgml
cartesian minimum distance (based on spatial ref) between two
2. geomgml, srid
geometries in projected units. For geography type defaults to return
spheroidal minimum distance between two geographies in meters.
ST_GeomFromTextmm Return a specified ST_Geometry value from
Well-Known Text representation (WKT). 1. g1, g2
1. WKT 2. gg1, gg2
2. WKT, srid 3. gg1, gg2, use_spheroid
ST_GeomFromWKBmm Creates a geometry instance from a Well-Known ST_HausdorffDistance Returns the Hausdorff distance between
Binary geometry representation (WKB) and optional SRID. two geometries. Basically a measure of how similar or dissimilar 2
1. geom geometries are. Units are in the units of the spatial reference system
2. geom, srid of the geometries.
1. g1, g2
2. g1, g2, densifyFrac
ST_LineFromMultiPoint3d (aMultiPoint) Creates a LineString from a MultiPoint
geometry.
ST_MaxDistance (g1, g2) Returns the 2-dimensional largest
ST_LineFromTextmm Makes a Geometry from WKT representation with the distance between two geometries in projected units.
given SRID. If SRID is not given, it defaults to -1. ST_Distance_Sphere (geomlonlatA, geomlonlatB) Returns minimum
1. WKT
2. WKT, srid distance in meters between two lon/lat geometries. Uses a spherical
earth and radius of 6370986 meters. Faster than
ST_Distance_Spheroid , but less accurate. PostGIS versions prior to
ST_LineFromWKBmm Makes a LINESTRING from WKB with the given SRID 1.5 only implemented for points.
1. WKB ST_Distance_Spheroid (geomlonlatA, geomlonlatB,
2. WKB, srid measurement_spheroid) Returns the minimum distance between two
lon/lat geometries given a particular spheroid. PostGIS versions prior
ST_LinestringFromWKBmm Makes a geometry from WKB with the given to 1.5 only support points.
SRID. ST_DFullyWithin (g1, g2, distance) Returns true if all of the
1. WKB geometries are within the specified distance of one another
2. WKB, srid
ST_DWithin2 G Returns true if the geometries are within the
ST_MakeBox2D (pointLowLeft, pointUpRight) Creates a BOX2D defined by the specified distance of one another. For geometry units are in those of
given point geometries. spatial reference and For geography units are in meters and
measurement is defaulted to use_spheroid=true (measure around
ST_3DMakeBox3d (point3DLowLeftBottom, point3DUpRightTop) Creates a spheroid), for faster check, use_spheroid=false to measure along
BOX3D defined by the given 3d point geometries. sphere.
1. g1, g2, distance_of_srid
ST_MakeLine3d Creates a Linestring from point or line geometries. 2. gg1, gg2, distance_meters
3. gg1, gg2, distance_meters, use_spheroid
1. geoms
2. geom1, geom2
3. geoms_array ST_Equalsmm (A, B) Returns true if the given geometries represent
the same geometry. Directionality is ignored.
ST_MakeEnvelope (xmin, ymin, xmax, ymax, srid=unknown) Creates a
ST_HasArc3d (geomA) Returns true if a geometry or geometry
rectangular Polygon formed from the given minimums and maximums. Input
collection contains a circular string
values must be in SRS specified by the SRID.
2 of 7
PostGIS 2.1 Cheat Sheet 2.1.0dev r11091
ST_MakePolygon3d Creates a Polygon formed by the given shell. Input ST_Intersectsmm G Returns TRUE if the Geometries/Geography
geometries must be closed LINESTRINGS. "spatially intersect in 2D" - (share any portion of space) and FALSE if
they don't (they are Disjoint). For geography -- tolerance is 0.00001
1. linestring meters (so any points that close are considered to intersect)
2. outerlinestring, interiorlinestrings
1. geomA, geomB
ST_MakePoint3d Creates a 2D,3DZ or 4D point geometry. 2. geogA, geogB
3 of 7
PostGIS 2.1 Cheat Sheet 2.1.0dev r11091
ST_InteriorRingNmm 3d (a_polygon, n) Return the Nth interior linestring ring of ST_Touchesmm (g1, g2) Returns TRUE if the geometries have at
the polygon geometry. Return NULL if the geometry is not a polygon or the given least one point in common, but their interiors do not intersect.
N is out of range.
ST_Withinmm (A, B) Returns true if the geometry A is completely
mm 3d
ST_IsClosed (g) Returns TRUE if the LINESTRING's start and end points inside geometry B
are coincident. For Polyhedral surface is closed (volumetric).
ST_IsCollection3d (g) Returns TRUE if the argument is a collection (MULTI*, Geometry Processing
GEOMETRYCOLLECTION, ...) ST_Buffer mm G
(T) For geometry: Returns a geometry that represents all
ST_IsEmptymm (geomA) Returns true if this Geometry is an empty points whose distance from this Geometry is less than or equal to distance.
geometrycollection, polygon, point etc. Calculations are in the Spatial Reference System of this Geometry. For
geography: Uses a planar transform wrapper. Introduced in 1.5 support for
ST_IsRingmm (g) Returns TRUE if this LINESTRING is both closed and simple. different end cap and mitre settings to control shape. buffer_style options:
ST_IsSimple mm 3d
(geomA) Returns (TRUE) if this Geometry has no quad_segs=#,endcap=round|flat|square,join=round|mitre|bevel,mitre_limit=#.#
anomalous geometric points, such as self intersection or self tangency. 1. g1, radius_of_buffer
ST_IsValidmm Returns true if the ST_Geometry is well formed. 2. g1, radius_of_buffer, num_seg_quarter_circle
3. g1, radius_of_buffer, buffer_style_parameters
1. g 4. g1, radius_of_buffer_in_meters
2. g, flags
ST_BuildArea (A) Creates an areal geometry formed by the constituent
ST_IsValidReason Returns text stating if a geometry is valid or not and if not linework of given geometry
valid, a reason why.
1. geomA ST_Collect3d Return a specified ST_Geometry value from a collection of
2. geomA, flags other geometries.
1. g1field
2. g1, g2
ST_IsValidDetail Returns a valid_detail (valid,reason,location) row stating if a 3. g1_array
geometry is valid or not and if not valid, a reason why and a location where.
ST_PatchNmm 3d (geomA, n) Return the 1-based Nth geometry (face) if the ST_Intersectionmm G (T) Returns a geometry that represents the shared
geometry is a POLYHEDRALSURFACE, POLYHEDRALSURFACEM. Otherwise, portion of geomA and geomB. The geography implementation does a
return NULL. transform to geometry to do the intersection and then transform back to
WGS84.
ST_PointNmm 3d (a_linestring, n) Return the Nth point in the first linestring or 1. geomA, geomB
circular linestring in the geometry. Return NULL if there is no linestring in the 2. geogA, geogB
geometry.
ST_SRIDmm (g1) Returns the spatial reference identifier for the ST_Geometry ST_LineToCurve3d (geomANoncircular) Converts a
as defined in spatial_ref_sys table. LINESTRING/POLYGON to a CIRCULARSTRING, CURVED POLYGON
ST_StartPointmm 3d (geomA) Returns the first point of a LINESTRING ST_MakeValid2 3d (input) Attempts to make an invalid geometry valid w/out
geometry as a POINT. loosing vertices.
ST_SummaryG Returns a text summary of the contents of the geometry. ST_MemUnion3d (geomfield) Same as ST_Union, only memory-friendly
(uses less memory and more processor time).
1. g ST_MinimumBoundingCircle (geomA, num_segs_per_qt_circ=48)
2. g Returns the smallest circle polygon that can fully contain a geometry. Default
uses 48 segments per quarter circle.
ST_Xmm 3d (a_point) Return the X coordinate of the point, or NULL if not ST_Polygonize Aggregate. Creates a GeometryCollection containing
available. Input must be a point. possible polygons formed from the constituent linework of a set of geometries.
ST_XMax3d (aGeomorBox2DorBox3D) Returns X maxima of a bounding box 2d 1. geomfield
or 3d or a geometry. 2. geom_array
ST_XMin3d (aGeomorBox2DorBox3D) Returns X minima of a bounding box 2d
or 3d or a geometry. ST_Node3d (geom) Node a set of linestrings.
mm 3d ST_OffsetCurve (line, signed_distance, style_parameters='') Return an
ST_Y (a_point) Return the Y coordinate of the point, or NULL if not
available. Input must be a point. offset line at a given distance and side from an input line. Useful for
computing parallel lines about a center line
4 of 7
PostGIS 2.1 Cheat Sheet 2.1.0dev r11091
ST_YMax3d (aGeomorBox2DorBox3D) Returns Y maxima of a bounding box 2d ST_RemoveRepeatedPoints3d (geom) Returns a version of the given
or 3d or a geometry. geometry with duplicated points removed.
ST_YMin3d (aGeomorBox2DorBox3D) Returns Y minima of a bounding box 2d ST_SharedPaths (lineal1, lineal2) Returns a collection containing paths
or 3d or a geometry. shared by the two input linestrings/multilinestrings.
ST_Zmm 3d (a_point) Return the Z coordinate of the point, or NULL if not ST_Shift_Longitude3d (geomA) Reads every point/vertex in every
available. Input must be a point. component of every feature in a geometry, and if the longitude coordinate is
<0, adds 360 to it. The result would be a 0-360 version of the data to be
ST_ZMax3d (aGeomorBox2DorBox3D) Returns Z minima of a bounding box 2d plotted in a 180 centric map
or 3d or a geometry.
ST_Simplify (geomA, tolerance) Returns a "simplified" version of the given
ST_Zmflag3d (geomA) Returns ZM (dimension semantic) flag of the geometries geometry using the Douglas-Peucker algorithm.
as a small int. Values are: 0=2d, 1=3dm, 2=3dz, 3=4d. ST_SimplifyPreserveTopology (geomA, tolerance) Returns a "simplified"
ST_ZMin3d (aGeomorBox2DorBox3D) Returns Z minima of a bounding box 2d version of the given geometry using the Douglas-Peucker algorithm. Will
or 3d or a geometry. avoid creating derived geometries (polygons in particular) that are invalid.
ST_Split (input, blade) Returns a collection of geometries resulting by
splitting a geometry.
Geometry Editors
ST_SymDifferencemm 3d (geomA, geomB) Returns a geometry that
ST_AddPoint3d Adds a point to a LineString before point (0-based index).
represents the portions of A and B that do not intersect. It is called a
1. linestring, point symmetric difference because ST_SymDifference(A,B) =
2. linestring, point, position ST_SymDifference(B,A).
ST_Unionmm Returns a geometry that represents the point set union of the
ST_Affine3d Applies a 3d affine transformation to the geometry to do things like Geometries.
translate, rotate, scale in one step. 1. g1field
2. g1, g2
1. geomA, a, b, c, d, e, f, g, h, i, xoff, yoff, zoff 3. g1_array
2. geomA, a, b, d, e, xoff, yoff
ST_UnaryUnion3d (geom) Like ST_Union, but working at the geometry
ST_Force_2D3d (geomA) Forces the geometries into a "2-dimensional mode" component level.
so that all output representations will only have the X and Y coordinates.
ST_Force_3D3d (geomA) Forces the geometries into XYZ mode. This is an Linear Referencing
alias for ST_Force_3DZ. ST_Line_Interpolate_Point3d (a_linestring, a_fraction) Returns a
ST_Force_3DZ3d (geomA) Forces the geometries into XYZ mode. This is a point interpolated along a line. Second argument is a float8 between 0
synonym for ST_Force_3D. and 1 representing fraction of total length of linestring the point has to
be located.
ST_Force_3DM (geomA) Forces the geometries into XYM mode.
ST_Line_Locate_Point (a_linestring, a_point) Returns a float
ST_Force_4D3d (geomA) Forces the geometries into XYZM mode. between 0 and 1 representing the location of the closest point on
ST_Force_Collection3d (geomA) Converts the geometry into a LineString to the given Point, as a fraction of total 2d line length.
GEOMETRYCOLLECTION. ST_Line_Substring3d (a_linestring, startfraction, endfraction)
3d
ST_ForceRHR (g) Forces the orientation of the vertices in a polygon to Return a linestring being a substring of the input one starting and
follow the Right-Hand-Rule. ending at the given fractions of total 2d length. Second and third
arguments are float8 values between 0 and 1.
ST_LineMerge (amultilinestring) Returns a (set of) LineString(s) formed by
sewing together a MULTILINESTRING. ST_LocateAlong (ageom_with_measure, a_measure, offset) Return
a derived geometry collection value with elements that match the
ST_CollectionExtract (collection, type) Given a (multi)geometry, returns a specified measure. Polygonal elements are not supported.
(multi)geometry consisting only of elements of the specified type.
ST_LocateBetween (geomA, measure_start, measure_end, offset)
ST_CollectionHomogenize (collection) Given a geometry collection, returns Return a derived geometry collection value with elements that match
the "simplest" representation of the contents. the specified range of measures inclusively. Polygonal elements are
ST_Multi (g1) Returns the geometry as a MULTI* geometry. If the geometry is not supported.
already a MULTI*, it is returned unchanged.
ST_LocateBetweenElevations3d (geom_mline, elevation_start,
ST_RemovePoint3d (linestring, offset) Removes point from a linestring. Offset elevation_end) Return a derived geometry (collection) value with
is 0-based. elements that intersect the specified range of elevations inclusively.
ST_Reverse (g1) Returns the geometry with vertex order reversed. Only 3D, 4D LINESTRINGS and MULTILINESTRINGS are supported.
ST_Rotate3d Rotate a geometry rotRadians counter-clockwise about an origin. ST_InterpolatePoint3d (line, point) Return the value of the measure
dimension of a geometry at the point closed to the provided point.
1. geomA, rotRadians
2. geomA, rotRadians, x0, y0 ST_AddMeasure3d (geom_mline, measure_start, measure_end)
3. geomA, rotRadians, pointOrigin Return a derived geometry with measure elements linearly interpolated
between the start and end points. If the geometry has no measure
dimension, one is added. If the geometry has a measure dimension, it
ST_RotateX3d (geomA, rotRadians) Rotate a geometry rotRadians about the X
is over-written with new values. Only LINESTRINGS and
axis.
MULTILINESTRINGS are supported.
ST_RotateY3d (geomA, rotRadians) Rotate a geometry rotRadians about the Y
axis. Long Transactions Support
ST_RotateZ3d (geomA, rotRadians) Rotate a geometry rotRadians about the Z AddAuth (auth_token) Add an authorization token to be used in
axis. current transaction.
ST_Scale3d Scales the geometry to a new size by multiplying the ordinates with CheckAuth Creates trigger on a table to prevent/allow updates and
the parameters. Ie: ST_Scale(geom, Xfactor, Yfactor, Zfactor). deletes of rows based on authorization token.
ST_Segmentize2 G Return a modified geometry/geography having no segment DisableLongTransactions () Disable long transaction support. This
longer than the given distance. Distance computation is performed in 2d only. For function removes the long transaction support metadata tables, and
geometry, length units are in units of spatial reference. For geography, units are drops all triggers attached to lock-checked tables.
in meters.
1. geom, max_segment_length
2. geog, max_segment_length
5 of 7
PostGIS 2.1 Cheat Sheet 2.1.0dev r11091
ST_SetPoint3d (linestring, zerobasedposition, point) Replace point N of EnableLongTransactions () Enable long transaction support. This
linestring with given point. Index is 0-based. function creates the required metadata tables, needs to be called once
before using the other functions in this section. Calling it twice is
ST_SetSRID (geom, srid) Sets the SRID on a geometry to a particular integer harmless.
value.
LockRow Set lock/authorization for specific row in table
ST_SnapToGrid3d Snap all points of the input geometry to a regular grid.
1. a_schema_name, a_table_name, a_row_key,
1. geomA, originX, originY, sizeX, sizeY an_auth_token, expire_dt
2. geomA, sizeX, sizeY 2. a_table_name, a_row_key, an_auth_token,
3. geomA, size expire_dt
4. geomA, pointOrigin, sizeX, sizeY, sizeZ, sizeM 3. a_table_name, a_row_key, an_auth_token
ST_Snap (input, reference, tolerance) Snap segments and vertices of input UnlockRows (auth_token) Remove all locks held by specified
geometry to vertices of a reference geometry. authorization id. Returns the number of locks released.
ST_Transformmm (g1, srid) Returns a new geometry with its coordinates
transformed to the SRID referenced by the integer parameter. Miscellaneous Functions
3d 3d
ST_Translate Translates the geometry to a new location using the numeric ST_Accum (geomfield) Aggregate. Constructs an array of
parameters as offsets. Ie: ST_Translate(geom, X, Y) or ST_Translate(geom, X, geometries.
Y,Z). Box2D (geomA) Returns a BOX2D representing the maximum
1. g1, deltax, deltay
extents of the geometry.
2. g1, deltax, deltay, deltaz
Box3D3d (geomA) Returns a BOX3D representing the maximum
3d extents of the geometry.
ST_TransScale (geomA, deltaX, deltaY, XFactor, YFactor) Translates the
geometry using the deltaX and deltaY args, then scales it using the XFactor, ST_EstimatedExtent Return the 'estimated' extent of the given
YFactor args, working in 2D only. spatial table. The estimated is taken from the geometry column's
statistics. The current schema will be used if not specified.
Geometry Outputs 1. schema_name, table_name, geocolumn_name
mm G 3d 2. table_name, geocolumn_name
ST_AsBinary Return the Well-Known Binary (WKB) representation of
the geometry/geography without SRID meta data.
1. g1 ST_Expand Returns bounding box expanded in all directions from
2. g1, NDR_or_XDR the bounding box of the input geometry. Uses double-precision
3. g1
4. g1, NDR_or_XDR 1. g1, units_to_expand
2. g1, units_to_expand
3. g1, units_to_expand
ST_AsEWKB3d Return the Well-Known Binary (WKB) representation of the
geometry with SRID meta data.
1. g1 ST_Extent (geomfield) an aggregate function that returns the
2. g1, NDR_or_XDR bounding box that bounds rows of geometries.
ST_3DExtent3d (geomfield) an aggregate function that returns the
ST_AsEWKTG 3d Return the Well-Known Text (WKT) representation of the box3D bounding box that bounds rows of geometries.
geometry with SRID meta data.
1. g1 Find_SRID (a_schema_name, a_table_name, a_geomfield_name)
2. g1 The syntax is find_srid(a_db_schema, a_table, a_column) and the
function returns the integer SRID of the specified column by
searching through the GEOMETRY_COLUMNS table.
ST_AsGeoJSONG 3d Return the geometry as a GeoJSON element.
ST_Mem_Size3d (geomA) Returns the amount of space (in bytes)
1. geom, maxdecimaldigits=15, options=0 the geometry takes.
2. geog, maxdecimaldigits=15, options=0
3. gj_version, geom, maxdecimaldigits=15, options=0 ST_Point_Inside_Circle (a_point, center_x, center_y, radius) Is the
4. gj_version, geog, maxdecimaldigits=15, options=0 point geometry insert circle defined by center_x, center_y, radius
1. geom, maxdecimaldigits=15
2. geog, maxdecimaldigits=15
3. version, geom, maxdecimaldigits=15, nprefix=NULL
4. version, geog, maxdecimaldigits=15, nprefix=NULL
6 of 7
PostGIS 2.1 Cheat Sheet 2.1.0dev r11091
7 of 7