transformations
This module contains functions that compute geometric constructions, or alter geometry size or shape.
ST_BUFFER
Description
Calculates a buffer for the input features for a given distance.
geog
:GEOGRAPHY
input to be buffered.distance
:DOUBLE
distance of the buffer around the input geography. The value is in meters. Negative values are allowed.segments
(optional):INTEGER
number of segments used to approximate a quarter circle. The default value is8
.
Return type
GEOGRAPHY
Example
ST_CENTERMEAN
Description
Takes a Feature or FeatureCollection and returns the mean center (average of its vertices).
geom
:GEOGRAPHY
for which to compute the mean center.
Return type
GEOGRAPHY
Example
ST_CENTERMEDIAN
Description
Takes a FeatureCollection of points and computes the median center. The median center is understood as the point that requires the least total travel from all other points.
geog
:GEOGRAPHY
for which to compute the center.
Return type
GEOGRAPHY
Example
ST_CENTEROFMASS
Description
Takes any Feature or a FeatureCollection and returns its center of mass (also known as centroid).
geog
:GEOGRAPHY
feature to be centered.
Return type
GEOGRAPHY
Example
Additional examples
ST_CONCAVEHULL
Description
Takes a set of points and returns a concave hull Polygon or MultiPolygon. In case that a single or a couple of points are passed as input, the function will return that point or a segment respectively.
geojsons
:ARRAY
array of features in GeoJSON format casted to STRING.maxEdge
(optional):DOUBLE
the maximum length allowed for an edge of the concave hull. HighermaxEdge
values will produce more convex-like hulls. If not provided, the default valueinfinity
is used and it would be equivalent to a Convex Hull.units
(optional):STRING
units of length, the supported options are: miles, kilometers, degrees or radians. By defaultunits
iskilometers
.
Return type
GEOGRAPHY
Examples
If points are stored in a table, a query like the one below can be used (multiple polygons are generated in this case, one for each cluster_id
value):
ST_CONVEXHULL
Description
Computes the convex hull of the input geography. The convex hull is the smallest convex geography that covers the input. It returns NULL if there is no convex hull.
This is not an aggregate function. To compute the convex hull of a set of geography, use ST_COLLECT to aggregate them into a collection.
geog
:GEOGRAPHY
input to compute the convex hull.
Return type
GEOGRAPHY
Examples
warning
The aggregate function ST_COLLECT has an output limit of 16 MB. This is equivalent, approximately, to 300K points.
ST_DESTINATION
Description
Takes a Point and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and a bearing in degrees. This uses the Haversine formula to account for global curvature.
origin
:GEOGRAPHY
starting point.distance
:DOUBLE
distance from the origin point in the units specified.bearing
:DOUBLE
ranging from -180 to 180 (e.g. 0 is North, 90 is East, 180 is South, -90 is West).units
(optional):STRING
units of length, the supported options are:miles
,kilometers
,degrees
orradians
. IfNULL
the default valuekilometers
is used.
Return type
GEOGRAPHY
Examples
ST_GREATCIRCLE
Description
Calculate great circle routes as LineString or MultiLineString. If the start and end points span the antimeridian, the resulting feature will be split into a MultiLineString.
startPoint
:GEOGRAPHY
source point feature.endPoint
:GEOGRAPHY
destination point feature.npoints
(optional):INT
number of points. By defaultnpoints
is100
.
Return type
GEOGRAPHY
Examples
Additional examples
ST_LINE_INTERPOLATE_POINT
Description
Takes a LineString and returns a Point at a specified distance along the line.
geog
:GEOGRAPHY
input line.distance
:DOUBLE
distance along the line.units
(optional):STRING
units of length, the supported options are:miles
,kilometers
,degrees
andradians
. By defaultunits
iskilometers
.
Return type
GEOGRAPHY
Examples
Additional examples
ST_POINTONSURFACE
Description
Takes any Feature or a FeatureCollection and returns a point that is granted to be inside one of the polygons.
geog
:GEOGRAPHY
feature to be centered.
Return type
GEOGRAPHY
Example
Last updated