DIST(x1, y1, x2, y2)
DIST(x1, y1, x2, y2)
SQRT( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) ).GEODIST(lon1, lat1, lon2, lat2)
GEODIST(lon1, lat1, lon2, lat2)
GEOHASH_DECODE_LATITUDE(geohash)
GEOHASH_DECODE_LATITUDE(geohash)
geohash and returns the latitude value for the given hash string. Supports a
maximum geohash character length of 16.GEOHASH_DECODE_LONGITUDE(geohash)
GEOHASH_DECODE_LONGITUDE(geohash)
geohash and returns the longitude value for the given hash string. Supports a
maximum geohash character length of 16.GEOHASH_ENCODE(lat, lon, precision)
GEOHASH_ENCODE(lat, lon, precision)
precision. The maximum precision is 15.GEOMETRY(wkt)
GEOMETRY(wkt)
ST_GEOMFROMTEXT(wkt)ST_ADDPOINT (linestring, point[, position])
ST_ADDPOINT (linestring, point[, position])
point geometry to the given linestring geometry at the specified
position, which is a 0-based index. If no position is specified, the point will be added to the end.ST_ALMOSTEQUALS (geom1, geom2[, decimal])
ST_ALMOSTEQUALS (geom1, geom2[, decimal])
1 (true) if given geometries, geom1 and geom2, are almost spatially equal within
the given amount of decimal scale. Note that geometries will still be considered equal if the
decimal scale for the geometries is within a half order of magnitude of each other; e.g., if
decimal is set to 2, then POINT(63.4 123.45) and POINT(63.4 123.454) are equal, but
POINT(63.4 123.45) and POINT(63.4 123.459) are not equal. The geometry types must match to be
considered equal.If no decimal scale is specified, a default scale of 6 will be applied.ST_AREA(geom[, solution])
ST_AREA(geom[, solution])
geom if it is a POLYGON or MULTIPOLYGON using the
specified solution type. Returns 0 if the input geometry type is (MULTI)POINT or
(MULTI)LINESTRING. Solution types available:0(default) - 2D Euclidean area1- curved surface area on a sphere in square meters2- curved surface area on a spheroid in square meters
ST_AZIMUTH(geom1, geom2)
ST_AZIMUTH(geom1, geom2)
geom1 and geom2.
Returns a null if the input geometry type is MULTIPOINT, (MULTI)LINESTRING, or (MULTI)POLYGON.ST_BOUNDARY(geom)
ST_BOUNDARY(geom)
geom. Returns an empty
geometry if geom is an empty geometry. Returns a null if geom is a GEOMETRYCOLLECTIONST_BOUNDINGDIAGONAL(geom)
ST_BOUNDINGDIAGONAL(geom)
geom) bounding box.ST_BUFFER (geom, radius[, style[, solution]])
ST_BUFFER (geom, radius[, style[, solution]])
geom is
less than or equal to the given distance radius. The radius units can be specified by the
solution type (default is in degrees) and the radius is created in the provided style.
The style options are specified as a list of blank-separated key-value pairs, e.g.,
'quad_segs=8 endcap=round'. If an empty style list ('') is provided, the default settings
will be used. The style parameter must be specified to provide a solution type.Available style options:quad_segs- the number of segments used to approximate a quarter circle (default is8)endcap- the endcap style of the buffer (default isround); options areround,flat(orbutt), andsquarejoin- the join style of the buffer (default isround); options areround,mitre(ormiter), andbevelmitre_limit- the mitre ratio limit expressed as a floating-point number (miter_limitis also acceptable)
solution types:0(default) - 2D Euclidean radius distance in degrees1- curved surface radius distance on a sphere in meters2- curved surface radius distance on a spheroid in meters
ST_BUFFERBYCOMPONENT (geom, radius[, style[, solution]])
ST_BUFFERBYCOMPONENT (geom, radius[, style[, solution]])
ST_BUFFER using the same parameters. The only
difference is the buffered geometry is calculated by independently buffering each individual component
and then the buffered components are dissolved (i.e. unioned) together to produce the final output. This
can produce very similar (but not identical) results to ST_BUFFER but will often run much faster.ST_CENTROID(geom)
ST_CENTROID(geom)
geom as a POINT. For (MULTI)POINTs, the center is
calculated as the average of the input coordinates. For (MULTI)LINESTRINGs, the center is calculated
as the weighted length of each given LINESTRING. For (MULTI)POLYGONs, the center is calculated as
the weighted area of each given POLYGON. If geom is an empty geometry, an empty
GEOMETRYCOLLECTION is returnedST_CLIP(geom1, geom2)
ST_CLIP(geom1, geom2)
geom1 and geom2ST_CLOSESTPOINT (geom1, geom2[, solution])
ST_CLOSESTPOINT (geom1, geom2[, solution])
POINT in geom1 that is closest to geom2 using the specified solution
type. If geom1 or geom2 is empty, a null is returned. Solution types available:0(default) - Euclidean; calculates the closest point using 2-D Euclidean distance1- Haversine; calculates the closest point using sphere distance in meters2- Vincenty; returns minimum spheroid distance in meters, more accurate than Haversine but slower performance
ST_COLLECT(geom1, geom2)
ST_COLLECT(geom1, geom2)
geom1 and geom2. If geom1 and geom2
are the same, singular geometry type, a MULTI* is returned, e.g., if geom1 and geom2 are both
POINTs (empty or no), a MULTIPOINT is returned. If geom1 and geom2 are neither the same type
nor singular geometries, a GEOMETRYCOLLECTION is returned.ST_COLLECTIONEXTRACT (collection, type)
ST_COLLECTIONEXTRACT (collection, type)
type from the given geometry collection. Type is a number that
maps to the following:1=POINT2=LINESTRING3=POLYGON
ST_COLLECTIONHOMOGENIZE(collection)
ST_COLLECTIONHOMOGENIZE(collection)
collection, e.g., a collection with a single POINT will
be returned as POINT(x y), and a collection with multiple individual points will be returned as a
MULTIPOINT.ST_CONCAVEHULL (geom, target_percent[, allow_holes])
ST_CONCAVEHULL (geom, target_percent[, allow_holes])
geom set.
Use target_percent (values between 0 and 1) to determine the percent of area of a convex hull the
concave hull will attempt to fill; 1 will return the same geometry as an ST_CONVEXHULL
operation. Set allow_holes to 1 (true) to allow holes in the resulting geometry; default
value is 0 (false). Note that allow_holes is independent of the area of target_percent.ST_CONTAINS(geom1, geom2)
ST_CONTAINS(geom1, geom2)
1 (true) if no points of geom2 lie in the exterior of geom1 and at least one
point of geom2 lies in the interior of geom1. Note that geom1 does not contain its
boundary but does contain itself.ST_CONTAINSPROPERLY(geom1, geom2)
ST_CONTAINSPROPERLY(geom1, geom2)
1 (true) if geom2 intersects the interior of geom1 but not the boundary
(or exterior). Note that geom1 does not contain its boundary but does contain itself.ST_CONVEXHULL(geom)
ST_CONVEXHULL(geom)
geom set.ST_COORDDIM(geom)
ST_COORDDIM(geom)
geom, e.g., a geometry with x, y, and z
coordinates would return 3.ST_COVEREDBY(geom1, geom2)
ST_COVEREDBY(geom1, geom2)
1 (true) if no point in geom1 is outside geom2.ST_COVERS(geom1, geom2)
ST_COVERS(geom1, geom2)
1 (true) if no point in geom2 is outside geom1.ST_CROSSES(geom1, geom2)
ST_CROSSES(geom1, geom2)
1 (true) if the given geometries, geom1 and geom2, spatially cross, meaning some
but not all interior points in common. If geom1 and/or geom2 are a GEOMETRYCOLLECTION, a
0 is returned regardless of if the two geometries crossST_DIFFERENCE(geom1, geom2)
ST_DIFFERENCE(geom1, geom2)
geom1 that does not intersect with geom2.ST_DIMENSION(geom)
ST_DIMENSION(geom)
geom, which is less than or equal to the coordinate
dimension. If geom is a single geometry, a 0 is for POINT, a 1 is for LINESTRING,
and a 2 is for POLYGON. If geom is a collection, it will return the largest dimension from
the collection. If geom is empty, 0 is returned.ST_DISJOINT(geom1, geom2)
ST_DISJOINT(geom1, geom2)
1 (true) if the given geometries, geom1 and geom2, do not spatially intersect.ST_DISTANCE(geom1, geom2[, solution])
ST_DISTANCE(geom1, geom2[, solution])
geom1 and geom2, using the
specified solution type. Solution types available:0(default) - Euclidean; returns 2-D Euclidean distance1- Haversine; returns minimum sphere distance in meters2- Vincenty; returns minimum spheroid distance in meters, more accurate than Haversine but slower performance
geom1 and geom2 intersect (verify using ST_INTERSECTS), the distance will
always be 0.ST_DISTANCEPOINTS (x1, y1, x2, y2[, solution])
ST_DISTANCEPOINTS (x1, y1, x2, y2[, solution])
x1, y1 and x2, y2, using the
specified solution type. Solution types available:0(default) - Euclidean; returns 2-D Euclidean distance1- Haversine; returns minimum sphere distance in meters2- Vincenty; returns minimum spheroid distance in meters, more accurate than Haversine but slower performance
ST_DFULLYWITHIN (geom1, geom2, distance[, solution])
ST_DFULLYWITHIN (geom1, geom2, distance[, solution])
1 (true) if the maximum distance between geometries geom1 and geom2 is less than
or equal to the specified distance of each other using the specified solution type. If geom1
or geom2 is null, 0 (false) is returned. Solution types available:0(default) - Euclidean; uses degrees to calculate distance1- Sphere; uses meters to calculate distance2- Spheroid; uses meters to calculate distance, more accurate than sphere but slower performance
ST_DWITHIN (geom1, geom2, distance[, solution])
ST_DWITHIN (geom1, geom2, distance[, solution])
1 (true) if the minimum distance between geometries geom1 and geom2 is within the
specified distance of each other using the specified solution type. Solution types available:0(default) - Euclidean; uses degrees to calculate distance1- Sphere; uses meters to calculate distance2- Spheroid; uses meters to calculate distance, more accurate than sphere but slower performance
ST_ELLIPSE(x, y, height, width)
ST_ELLIPSE(x, y, height, width)
x- the x coordinate or longitude used to center the ellipsey- the y coordinate or latitude used to center the ellipseheight- the height of the ellipse (in degrees)width- the width of the ellipse (in degrees)
ST_ENDPOINT(geom)
ST_ENDPOINT(geom)
geom as a POINT if it’s a LINESTRING. If geom is not
a LINESTRING, null is returned.ST_ENVDWITHIN (geom1, geom2, distance[, solution])
ST_ENVDWITHIN (geom1, geom2, distance[, solution])
1 (true) if geom1 is within the specified distance of the bounding box of
geom2 using the specified solution type. Solution types available:0(default) - Euclidean; uses degrees to calculate distance1- Sphere; uses meters to calculate distance
ST_ENVELOPE(geom)
ST_ENVELOPE(geom)
geom.ST_ENVINTERSECTS(geom1, geom2)
ST_ENVINTERSECTS(geom1, geom2)
1 (true) if the bounding box of the given geometries, geom1 and geom2, intersect.ST_EQUALS(geom1, geom2)
ST_EQUALS(geom1, geom2)
1 (true) if the given geometries, geom1 and geom2, are spatially equal. Note that
order does not matter.ST_EQUALSEXACT (geom1, geom2[, tolerance])
ST_EQUALSEXACT (geom1, geom2[, tolerance])
1 (true) if the given geometries, geom1 and geom2, are almost spatially equal
within some given tolerance. If the values within the given geometries are within the
tolerance value of each other, they’re considered equal, e.g., if tolerance is 2,
POINT(1 1) and POINT(1 3) are considered equal, but POINT(1 1) and POINT(1 3.1) are not. Note that
the geometry types have to match for them to be considered equal. The default tolerance is 0,
which makes this function effectively equivalent to ST_EQUALS(geom1, geom2) in the default case.ST_ERASE(geom1, geom2)
ST_ERASE(geom1, geom2)
geom1 equal to the size of geom2.ST_EXPAND(geom, units)
ST_EXPAND(geom, units)
units of the given geom. The
expansion can also be defined for separate directions by providing separate parameters for each
direction, e.g., ST_EXPAND(geom, unitsx, unitsy, unitsz, unitsm).ST_EXPANDBYRATE(geom, rate)
ST_EXPANDBYRATE(geom, rate)
rate (a ratio of width and height) for the given
geometry geom. The rate must be between 0 and 1.ST_EXTERIORRING(geom)
ST_EXTERIORRING(geom)
geomST_FORCE2D(geom)
ST_FORCE2D(geom)
geom, the provided geometry or
set of geometries (e.g., via GEOMETRYCOLLECTION or WKT column name).ST_FORCE3D(geom[, z])
ST_FORCE3D(geom[, z])
geom, a provided geometry or
set of geometries (e.g., via GEOMETRYCOLLECTION or WKT column name), using z as the geometry’s
new z-value. The provided z-values can also be derived from a numeric column. If no z is provided,
a 0 will be applied.geom and a numeric column is provided for z, the z
values will be matched to the provided geometries by row in the source table. If a singular
geometry is provided for geom and a column is provided for z, three-dimensional
versions of the provided geometry will be returned for each z value found in the provided
z column. If columns are provided for both geom and z and nulls are present in
either column, the row containing null values will be skipped in the results.ST_GENERATEPOINTS(geom, num)
ST_GENERATEPOINTS(geom, num)
num of randomly generated points within the boundary of
geom.ST_GEOHASH(geom[, precision])
ST_GEOHASH(geom[, precision])
geom with specified precision
(the length of the resulting geohash string). The longer the precision, the more precise the hash is. By
default, precision is set to 20; the max for precision is 32. Returns null if
geom is an empty geometry.See Geohash for an example.ST_GEOMETRYFROMTEXT(wkt)
ST_GEOMETRYFROMTEXT(wkt)
ST_GEOMFROMTEXT(wkt)ST_GEOMETRYN(geom, index)
ST_GEOMETRYN(geom, index)
index geometry back from the given geom geometry. The index starts from 1 and goes to
the number of geometries in geom.ST_GEOMETRYTYPE(geom)
ST_GEOMETRYTYPE(geom)
geom.ST_GEOMETRYTYPEID(geom)
ST_GEOMETRYTYPEID(geom)
geom. Type and ID mappings:- POINT = 0
- LINESTRING = 1
- POLYGON = 3
- MULTIPOINT = 4
- MULTILINESTRING = 5
- MULTIPOLYGON = 6
- GEOMETRYCOLLECTION = 7
ST_GEOMFROMGEOHASH (geohash[, precision])
ST_GEOMFROMGEOHASH (geohash[, precision])
geohash with a precision set by the integer
precision. If precision is specified, the function will use as many characters in the hash
equal to precision to create the geometry. If no precision is specified, the full length of
the geohash is used.See Geohash for an example.ST_GEOMFROMH3(h3_index)
ST_GEOMFROMH3(h3_index)
H3_CELLTOBOUNDARY; see H3 Functions.ST_GEOMFROMTEXT(wkt)
ST_GEOMFROMTEXT(wkt)
wkt. Note that this function is
only compatible with constants.ST_H3(wkt, resolution)
ST_H3(wkt, resolution)
H3_GEOMTOCELL; see H3 Functions.ST_HEXGRID (xmin, ymin, xmax, ymax, cell_side[, limit])
ST_HEXGRID (xmin, ymin, xmax, ymax, cell_side[, limit])
cell_side. The cell_side cannot be
greater than the width or height of the bounding box. The maximum number of cells that can be
produced is determined by limit, a positive integer. Supported values for limit:-1- No limit to the number of cells generated (effectively limited by system memory)0(default) - 100 million cells<n>- Custom limit ofncells
cell_side)
than the system limit, a null is returned.ST_INTERIORRINGN(geom, n)
ST_INTERIORRINGN(geom, n)
n-th interior LINESTRING ring of the POLYGON geom. If geom is not a POLYGON
or the given n is out of range, a null is returned. The index begins at 1ST_INTERSECTION(geom1, geom2)
ST_INTERSECTION(geom1, geom2)
geom1 and geom2ST_INTERSECTS(geom1, geom2)
ST_INTERSECTS(geom1, geom2)
1 (true) if the given geometries, geom1 and geom2, intersect in 2-DST_ISCLOSED(geom)
ST_ISCLOSED(geom)
1 (true) if the given geometry’s (geom) start and end points coincideST_ISCOLLECTION(geom)
ST_ISCOLLECTION(geom)
1 (true) if geom is a collection, e.g., GEOMETRYCOLLECTION, MULTIPOINT,
MULTILINESTRING, etc.ST_ISEMPTY(geom)
ST_ISEMPTY(geom)
1 (true) if geom is emptyST_ISRING(geom)
ST_ISRING(geom)
1 (true) if LINESTRING geom is both closed (per ST_ISCLOSED) and “simple”
(per ST_ISSIMPLE). Returns 0 if geom is not a LINESTRINGST_ISSIMPLE(geom)
ST_ISSIMPLE(geom)
1 (true) if geom has no anomalous geometric points, e.g., self-intersection or
self-tangencyST_ISVALID(geom)
ST_ISVALID(geom)
1 (true) if geom (typically a [MULTI]POLYGON) is well formed. A POLYGON is valid if
its rings do not cross, and its boundary intersects only at POINTs (not along a line). The POLYGON must
also not have dangling LINESTRINGs. A MULTIPOLYGON is valid if all of its elements are also valid, and
the interior rings of those elements do not intersect. Each element’s boundaries may touch but only
at POINTs (not along a line). ST_MAKEVALID(geom) can be used to help correct invalid geometries.ST_ISVALIDREASON(geom)
ST_ISVALIDREASON(geom)
Valid Geometry if geom is well formed, according to ST_ISVALID(geom); otherwise,
returns the reason geom is determined to be malformed. ST_MAKEVALID(geom) can be used to
help correct invalid geometries.Example:| Function Call | ST_ISVALIDREASON(‘POLYGON((-1 0, 1 0, 1 1, -1 -1))‘) |
| Return | Self-intersection[0 0] |
ST_LENGTH(geom[, solution])
ST_LENGTH(geom[, solution])
0 if
another type of geometry, e.g., POINT, MULTIPOINT, etc. GEOMETRYCOLLECTIONs are
also supported but the aforementioned type limitation still applies; the collection will be
recursively searched for LINESTRINGs and MULTILINESTRINGs and the summation of all supported geometry
types is returned (unsupported types are ignored). Solution types available:0(default) - 2D Euclidean length1- length on a sphere in meters2- length on a spheroid in meters
ST_LINEFROMMULTIPOINT(geom)
ST_LINEFROMMULTIPOINT(geom)
geom if it is a MULTIPOINT. Returns null if geom is not a
MULTIPOINTST_LINEINTERPOLATEPOINT(geom, frac)
ST_LINEINTERPOLATEPOINT(geom, frac)
geom that is the frac fraction of the distance along the line. If geom is either
empty or not a LINESTRING, null is returnedST_LINELOCATEPOINT(linestring, point)
ST_LINELOCATEPOINT(linestring, point)
linestring to the given point as a
value between 0 and 1. The return value is a fraction of the total linestring length.ST_LINEMERGE(geom)
ST_LINEMERGE(geom)
geom. If geom is a MULTILINESTRING
comprising LINESTRINGs with shared endpoints, a contiguous LINESTRING is returned. If geom is a
LINESTRING or a MULTILINESTRING comprising LINESTRINGS without shared endpoints, geom is returned
If geom is an empty (MULTI)LINESTRING or a (MULTI)POINT or (MULTI)POLYGON, an empty
GEOMETRYCOLLECTION is returned.ST_LINESUBSTRING (geom, start_frac, end_frac)
ST_LINESUBSTRING (geom, start_frac, end_frac)
geom LINESTRING from the point that is the start_frac fraction of the distance along
the line to the point that is the end_frac fraction of the distance along the line.For example, given LINESTRING(1 1, 2 2, 3 3) a start_fraction of 0 and an end_fraction of 0.25 would yield
the first quarter of the given LINESTRING, or LINESTRING(1 1, 1.5 1.5).Returns null in the following cases:- input geometry is (MULTI)POINT, MULTILINESTRING, or (MULTI)POLYGON
start_fracis greater thanend_fracstart_fracorend_fracare not between0&1, inclusive
ST_LONGESTLINE (geom1, geom2[, solution])
ST_LONGESTLINE (geom1, geom2[, solution])
geom1 or geom2 is
empty, null is returned. Solution types available:0(default) - Euclidean; uses degrees to calculate the longest line1- Sphere; uses meters to calculate the longest line2- Spheroid; uses meters to calculate the longest line, more accurate than sphere but slower performance
ST_MAKEENVELOPE (xmin, ymin, xmax, ymax)
ST_MAKEENVELOPE (xmin, ymin, xmax, ymax)
ST_MAKELINE(geom[, geom2])
ST_MAKELINE(geom[, geom2])
geom if it is a MULTIPOINT. If geom is a POINT, there must be at
least one other POINT to construct a LINESTRING. If geom is a LINESTRING, it must have at least
two points. Returns null if geom is not a POINT, MULTIPOINT, or LINESTRINGST_MAKEPOINT(x, y)
ST_MAKEPOINT(x, y)
ST_MAKEPOLYGON(geom)
ST_MAKEPOLYGON(geom)
geom. Inputs must be closed LINESTRINGsST_MAKETRIANGLE2D (x1, y1, x2, y2, x3, y3)
ST_MAKETRIANGLE2D (x1, y1, x2, y2, x3, y3)
ST_MAKETRIANGLE3D (x1, y1, z1, x2, y2, z2, x3, y3, z3)
ST_MAKETRIANGLE3D (x1, y1, z1, x2, y2, z2, x3, y3, z3)
ST_MAKEVALID(geom[, options])
ST_MAKEVALID(geom[, options])
geom into a valid geometry when it is malformed, as determined by
ST_ISVALID(geom). Returns geom if it is a valid geometry already. The method used to convert
invalid geometries into valid ones can be specified in options as a space-separated string of
x=y key/value pairs. The keys and corresponding values are as follows:-
method- the algorithm used to convert invalid geometries into valid ones; either:linework(default) - build geometry from lines extracted fromgeomstructure- build geometry from interior & exterior rings extracted fromgeom
-
keepcollapsed- if using themethodofstructure, whether to drop portions of the converted geometry that collapse to lower dimensions:true(default) - keep portions of geometry that collapse to lower dimensionsfalse- don’t keep portions of geometry that collapse to lower dimensions
| Function Call | ST_MAKEVALID(‘POLYGON((-1 0, 1 0, 1 1, -1 -1))‘) |
| Return | MULTIPOLYGON (((-1 -1, -1 0, 0 0, -1 -1)), ((1 0, 0 0, 1 1, 1 0))) |
| Function Call | ST_MAKEVALID(‘POLYGON((0 0, 0 0, 0 0, 0 0))’, ‘method=structure keepcollapsed=true’) |
| Return | POINT (0 0) |
| Function Call | ST_MAKEVALID(‘POLYGON((0 0, 0 0, 0 0, 0 0))’, ‘method=structure keepcollapsed=false’) |
| Return | POLYGON EMPTY |
ST_MAXDISTANCE (geom1, geom2[, solution])
ST_MAXDISTANCE (geom1, geom2[, solution])
geom1 and geom2 geometries using the specified
solution type. If geom1 or geom2 is empty, null is returned. Solution types available:0(default) - returns maximum 2-D Euclidean distance1- Sphere; returns maximum distance in meters2- Spheroid; returns maximum distance in meters, more accurate than sphere but slower performance
ST_MAXX(geom)
ST_MAXX(geom)
geom geometry. This function
works for 2-D and 3-D geometries.ST_MAXY(geom)
ST_MAXY(geom)
geom geometry. This function
works for 2-D and 3-D geometries.ST_MAXZ(geom)
ST_MAXZ(geom)
geom geometry. This function
works for 2-D and 3-D geometries.ST_MINX(geom)
ST_MINX(geom)
geom geometry. This function
works for 2-D and 3-D geometries.ST_MINY(geom)
ST_MINY(geom)
geom geometry. This function
works for 2-D and 3-D geometries.ST_MINZ(geom)
ST_MINZ(geom)
geom geometry. This function
works for 2-D and 3-D geometries.ST_MULTI(geom)
ST_MULTI(geom)
geom as a MULTI- geometry, e.g., a POINT would return a MULTIPOINT.ST_MULTIPLERINGBUFFERS (geom, distance[, outside])
ST_MULTIPLERINGBUFFERS (geom, distance[, outside])
distance around the given geom geometry. Multiple
distances are specified as comma-separated values in an array, e.g., [10,20,30]. Valid values for
outside are:FULL- indicates that buffers will overlap or cover the givengeomgeometry. This is the default.OUTSIDE_ONLY- indicates that buffers will be rings around the givengeomgeometry.
ST_NDIMS(geom)
ST_NDIMS(geom)
geom. For X,Y data, this will return 2; if a Z component is
present, it will return 3.ST_NEAR(geom1, geom2)
ST_NEAR(geom1, geom2)
geom2 that is closest to geom1. If geom2 is a singular geometry
object (e.g., POINT, LINESTRING, POLYGON), geom2 will be returned. If geom2 a multi-geometry,
e.g., MULTIPOINT, MULTILINESTRING, etc., the nearest singular geometry in geom2 will be
returned.ST_NORMALIZE(geom)
ST_NORMALIZE(geom)
geom in its normalized (canonical) form, which may rearrange the points in lexicographical
order.ST_NPOINTS(geom)
ST_NPOINTS(geom)
geom.ST_NRINGS(geom)
ST_NRINGS(geom)
geom. For non-polygonal geometries,
it will return 0. For MULTIPOLYGONs, it will return the total number of rings across all components.ST_NUMGEOMETRIES(geom)
ST_NUMGEOMETRIES(geom)
geom is a collection or MULTI- geometry, returns the number of geometries. If geom is a
single geometry, returns 1.ST_NUMINTERIORRINGS(geom)
ST_NUMINTERIORRINGS(geom)
geom is a POLYGON. Returns null if geom is
anything else.ST_NUMPOINTS(geom)
ST_NUMPOINTS(geom)
geom LINESTRING. Returns null if geom is not a
LINESTRING.ST_OVERLAPS(geom1, geom2)
ST_OVERLAPS(geom1, geom2)
1 (true) if given geometries geom1 and geom2 share space. If geom1 and/or
geom2 are a GEOMETRYCOLLECTION, a 0 is returned regardless of if the two geometries overlapST_PARTITION(geom[, threshold])
ST_PARTITION(geom[, threshold])
geom partitioned into a number of POLYGONs with a
maximum number of vertices equal to the given threshold. Minimum value for threshold is
10; default value is 10000. If geom is not a POLYGON or MULTIPOLYGON, geom is
returned. If the number of vertices in geom is less than the threshold, geom is returned.ST_PERIMETER(geom[, solution])
ST_PERIMETER(geom[, solution])
0 if another
type of geometry, e.g., POINT, MULTIPOINT, LINESTRING, or MULTILINESTRING. GEOMETRYCOLLECTIONs are
also supported but the aforementioned type limitation still applies; the collection will be
recursively searched for POLYGONs and MULTIPOLYGONs and the summation of all supported geometry types
is returned (unsupported types are ignored). Solution types available:0(default) - 2D Euclidean length1- length on a sphere in meters2- length on a spheroid in meters
ST_POINT(x, y)
ST_POINT(x, y)
x and y coordinates.ST_POINTFROMGEOHASH (geohash[, precision])
ST_POINTFROMGEOHASH (geohash[, precision])
geohash with a precision set by the integer precision. If
precision is specified, the function will use as many characters in the hash equal to
precision to create the geometry. If no precision is specified, the full length of
the geohash is used.ST_POINTGRID (xmin, ymin, xmax, ymax, cell_side[, limit])
ST_POINTGRID (xmin, ymin, xmax, ymax, cell_side[, limit])
cell_side. The cell_side cannot be
greater than the width or height of the bounding box. The maximum number of cells that can be
produced is determined by limit, a positive integer. Supported values for limit:-1- No limit to the number of cells generated (effectively limited by system memory)0(default) - 100 million cells<n>- Custom limit ofncells
cell_side)
than the system limit, a null is returned.ST_POINTN(geom, n)
ST_POINTN(geom, n)
n-th point in LINESTRING geom. Negative values are valid, but note that they are
counted backwards from the end of geom. A null is returned if geom is not a LINESTRING.ST_POINTS(geom)
ST_POINTS(geom)
geom.ST_PROJECT(geom, distance, azimuth)
ST_PROJECT(geom, distance, azimuth)
geom along a geodesic calculated using distance
and azimuth. If geom is not a POINT, null is returned.ST_REMOVEPOINT(geom, offset)
ST_REMOVEPOINT(geom, offset)
geom using offset to skip over POINTs in the LINESTRING. The
offset is 0-based.ST_REMOVEREPEATEDPOINTS (geom, tolerance)
ST_REMOVEREPEATEDPOINTS (geom, tolerance)
geom if the point’s vertices are greater than or equal to the tolerance
of the previous point in the geometry’s list. If geom is not a MULTIPOINT, MULTILINESTRING, or a
MULTIPOLYGON, no points will be removed.ST_REVERSE(geom)
ST_REVERSE(geom)
ST_ROTATE(geom, radians[, wkt])
ST_ROTATE(geom, radians[, wkt])
geom counter-clockwise by radians radians. Optionally, the rotation origin can be provided as a WKT POINT
WKT POINT (wkt). If not provided, geom will be rotated around (0, 0).ST_ROTATE(geom, radians[, x, y])
ST_ROTATE(geom, radians[, x, y])
geom counter-clockwise by radians radians. Optionally, the rotation origin can be provided as a coordinate
pair (x & y). If not provided, geom will be rotated around (0, 0).ST_SCALE(geom, wkt)
ST_SCALE(geom, wkt)
geom by multiplying its respective vertices by the corresponding x, y values in the given WKT POINT.| Function Call | ST_SCALE(‘POLYGON((1 2, -2 1, -1 -2, 2 -1, 1 2))’, GEOMETRY(‘POINT(3 5)‘)) |
| Return | POLYGON ((3 10, -6 5, -3 -10, 6 -5, 3 10)) |
ST_SCALE(geom, x, y)
ST_SCALE(geom, x, y)
geom by multiplying its respective vertices by the given x & y values.| Function Call | ST_SCALE(‘POLYGON((1 2, -2 1, -1 -2, 2 -1, 1 2))’, 3, 5) |
| Return | POLYGON ((3 10, -6 5, -3 -10, 6 -5, 3 10)) |
ST_SEGMENTIZE (geom, max_segment_size[, solution])
ST_SEGMENTIZE (geom, max_segment_size[, solution])
geom, but segmentized n number of times depending on how the
max_segment_size distance (in units based on the solution type) divides up the original
geometry. The new geom is guaranteed to have segments that are smaller than the given
max_segment_size. Note that POINTs are not able to be segmentized. Collection geometries
(GEOMETRYCOLLECTION, MULTILINESTRING, MULTIPOINT, etc.) can be segmentized, but only the individual
parts will be segmentized, not the collection as a whole. Solution types available:0- Euclidean; uses degrees to calculate distance1(default) - Sphere; uses meters to calculate distance
ST_SETPOINT(geom1, position, geom2)
ST_SETPOINT(geom1, position, geom2)
geom1 with POINT geom2 at position (base 0). Negative
values are valid, but note that they are counted backwards from the end of geom.ST_SHORTESTLINE(geom1, geom2)
ST_SHORTESTLINE(geom1, geom2)
geom1 or geom2
is empty, null is returnedST_SIMPLIFY(geom, tolerance)
ST_SIMPLIFY(geom, tolerance)
geom using an algorithm to reduce the number of points
comprising a given geometry while attempting to best retain the original shape. The given
tolerance determines how much to simplify the geometry. The higher the tolerance, the more
simplified the returned geometry. Some holes might be removed and some invalid polygons (e.g.,
self-intersecting, etc.) might be present in the returned geometry. Only (MULTI)LINESTRINGs and
(MULTI)POLYGONs can be simplified, including those found within GEOMETRYCOLLECTIONs; any other
geometry objects will be returned unsimplified.tolerance should be provided in the same units as the data. As a rule of thumb,
a tolerance of 0.00001 would correspond to about one meter.ST_SIMPLIFYPRESERVETOPOLOGY (geom, tolerance)
ST_SIMPLIFYPRESERVETOPOLOGY (geom, tolerance)
geom using an algorithm to reduce the number of points
comprising a given geometry while attempting to best retain the original shape. The given
tolerance determines how much to simplify the geometry. The higher the tolerance, the more
simplified the returned geometry. No holes will be removed and no invalid polygons (e.g.,
self-intersecting, etc.) will be present in the returned geometry. Only (MULTI)LINESTRINGs and
(MULTI)POLYGONs can be simplified, including those found within GEOMETRYCOLLECTIONs; any other
geometry objects will be returned unsimplified.tolerance should be provided in the same units as the data. As a rule of thumb,
a tolerance of 0.00001 would correspond to about one meter.ST_SNAP(geom1, geom2, tolerance)
ST_SNAP(geom1, geom2, tolerance)
geom1 to geom2 within the given tolerance. If the tolerance causes geom1
to not snap, the geometries will be returned unchanged.ST_SPLIT(geom1, geom2)
ST_SPLIT(geom1, geom2)
geom1 and geom2
geometries.ST_SQUAREGRID (xmin, ymin, xmax, ymax, cell_side[, limit])
ST_SQUAREGRID (xmin, ymin, xmax, ymax, cell_side[, limit])
cell_side. The cell_side cannot be
greater than the width or height of the bounding box. The maximum number of cells that can be
produced is determined by limit, a positive integer. Supported values for limit:-1- No limit to the number of cells generated (effectively limited by system memory)0(default) - 100 million cells<n>- Custom limit ofncells
cell_side)
than the system limit, a null is returned.ST_STARTPOINT(geom)
ST_STARTPOINT(geom)
geom as a POINT. Returns null if geom is not a
LINESTRING.ST_SYMDIFFERENCE(geom1, geom2)
ST_SYMDIFFERENCE(geom1, geom2)
geom1 and geom2 geometries that do not
intersect.ST_TOUCHES(geom1, geom2)
ST_TOUCHES(geom1, geom2)
1 (true) if the given geometries, geom1 and geom2, have at least one point in
common but their interiors do not intersect. If geom1 and/or geom2 are a GEOMETRYCOLLECTION,
a 0 is returned regardless of if the two geometries touchST_TRANSLATE (geom, deltax, deltay[, deltaz])
ST_TRANSLATE (geom, deltax, deltay[, deltaz])
geom by given offsets deltax and deltay. A z-coordinate offset can be applied
using deltaz.
intersect.ST_TRIANGLEGRID (xmin, ymin, xmax, ymax, cell_side[, limit])
ST_TRIANGLEGRID (xmin, ymin, xmax, ymax, cell_side[, limit])
cell_side. The cell_side cannot be
greater than the width or height of the bounding box. The maximum number of cells that can be
produced is determined by limit, a positive integer. Supported values for limit:-1- No limit to the number of cells generated (effectively limited by system memory)0(default) - 100 million cells<n>- Custom limit ofncells
cell_side)
than the system limit, a null is returned.ST_UNION(geom1, geom2)
ST_UNION(geom1, geom2)
geom1 and
geom2.ST_UNIONCOLLECTION(geom)
ST_UNIONCOLLECTION(geom)
geom.ST_UPDATE(geom1, geom2)
ST_UPDATE(geom1, geom2)
geom1 geometry updated by geom2 geometryST_VORONOIPOLYGONS(geom[, tolerance])
ST_VORONOIPOLYGONS(geom[, tolerance])
geom than any other vertices in geom) calculated from the vertices in geom
and the given tolerance. The tolerance determines the distance at which points will be
considered the same. An empty GEOMETRYCOLLECTION is returned if geom is an empty geometry, a
single POINT, or a LINESTRING or POLYGON composed of equivalent vertices (e.g.,
POLYGON((0 0, 0 0, 0 0, 0 0)), LINESTRING(0 0, 0 0)).If no tolerance is specified, no vertices will be considered the same; each will have its own polygon.The bounding box for the result POLYGONs extends past the four edges of the input geom bounding box by
an amount that is the greater of the input bounding box’s height and width. For instance, an input geom
with a 3 x 4 bounding box will result in Voronoi polygons filling a space that is 11 x 12.ST_WITHIN(geom1, geom2)
ST_WITHIN(geom1, geom2)
1 (true) if the geom1 geometry is inside the geom2 geometry. Note that as long as
at least one point is inside of geom2, geom1 is considered within geom2 even if the rest
of the geom1 lies along the boundary of geom2ST_WKBTOWKT(geom)
ST_WKBTOWKT(geom)
ST_WKTTOWKB(geom)
ST_WKTTOWKB(geom)
ST_X(geom)
ST_X(geom)
geom; if the coordinate is not available, null is
returned. geom must be a POINT.ST_XMAX(geom)
ST_XMAX(geom)
ST_MAXX()ST_XMIN(geom)
ST_XMIN(geom)
ST_MINX()ST_Y(geom)
ST_Y(geom)
geom; if the coordinate is not available, null is
returned. geom must be a POINT.ST_YMAX(geom)
ST_YMAX(geom)
ST_MAXY()ST_YMIN(geom)
ST_YMIN(geom)
ST_MINY()ST_ZMAX(geom)
ST_ZMAX(geom)
ST_MAXZ()ST_ZMIN(geom)
ST_ZMIN(geom)
ST_MINZ()