transformations
This module contains functions that compute geometric constructions, or alter geometry size or shape.
ST_BUFFER
ST_BUFFER(geog, radius, units, steps)Description
Calculates a Geography buffer for input features for a given radius, i.e. the area within the given distance of the input. Units supported are miles, kilometers, and degrees.
geog:GEOGRAPHYinput to be buffered.radius:FLOAT64distance to draw the buffer (negative values are allowed).units:STRING|NULLunits of length, the supported options are: miles, kilometers, and degrees. IfNULLthe default valuekilometersis used.steps:INT64|NULLnumber of segments used to approximate a quarter circle. IfNULLthe default value8is used.
Return type
GEOGRAPHY
Example
SELECT `carto-un`.carto.ST_BUFFER(
ST_GEOGPOINT(-74.00, 40.7128),
1,
"kilometers",
10
);
-- POLYGON((-73.9881354374691 40.7127993926494 ...SELECT `carto-un-eu`.carto.ST_BUFFER(
ST_GEOGPOINT(-74.00, 40.7128),
1,
"kilometers",
10
);
-- POLYGON((-73.9881354374691 40.7127993926494 ...SELECT carto.ST_BUFFER(
ST_GEOGPOINT(-74.00, 40.7128),
1,
"kilometers",
10
);
-- POLYGON((-73.9881354374691 40.7127993926494 ...ST_CENTERMEAN
Description
Takes a Feature or FeatureCollection and returns the mean center (average of its vertices).
geog:GEOGRAPHYfeature for which to compute the 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:GEOGRAPHYfeature 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:GEOGRAPHYfeature to be centered.
Return type
GEOGRAPHY
Example
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.
geog:ARRAY<GEOGRAPHY>input points.maxEdge:FLOAT64|NULLthe maximum length allowed for an edge of the concave hull. HighermaxEdgevalues will produce more convex-like hulls. IfNULL, the default valueinfinityis used and it would be equivalent to a Convex Hull.units:STRING|NULLunits of length, the supported options are: miles, kilometers, degrees or radians. IfNULLthe default valuekilometersis used.
Return type
GEOGRAPHY
Example
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:GEOGRAPHYstarting point.distance:FLOAT64distance from the origin point in the units specified.bearing:FLOAT64ranging from -180 to 180 (e.g. 0 is North, 90 is East, 180 is South, -90 is West).units:STRING|NULLunits of length, the supported options are:miles,kilometers,degreesorradians. IfNULLthe default valuekilometersis used.
Return type
GEOGRAPHY
Example
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:GEOGRAPHYsource point feature.endPoint:GEOGRAPHYdestination point feature.npoints:INT64|NULLnumber of points. IfNULLthe default value100is used.
Return type
GEOGRAPHY
Example
ST_LINE_INTERPOLATE_POINT
Description
Takes a LineString and returns a Point at a specified distance along the line.
geog:GEOGRAPHYinput line.distance:FLOAT64distance along the line.units:STRING|NULLunits of length, the supported options are:miles,kilometers,degreesandradians. IfNULLthe default valuekilometersis used.
Return type
GEOGRAPHY
Example
ST_POINTONSURFACE
Description
Takes any Feature or a FeatureCollection and returns a point that is granted to be inside one of the polygons.
geog:GEOGRAPHYfeature to be centered.
Return type
GEOGRAPHY
Example
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 960401.
Last updated
Was this helpful?
