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: GEOGRAPHY input to be buffered.

  • radius: FLOAT64 distance to draw the buffer (negative values are allowed).

  • units: STRING|NULL units of length, the supported options are: miles, kilometers, and degrees. If NULLthe default value kilometers is used.

  • steps: INT64|NULL number of segments used to approximate a quarter circle. If NULL the default value 8 is 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 ...

ST_CENTERMEAN

Description

Takes a Feature or FeatureCollection and returns the mean center (average of its vertices).

  • geog: GEOGRAPHY feature 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: GEOGRAPHY feature 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

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|NULL the maximum length allowed for an edge of the concave hull. Higher maxEdge values will produce more convex-like hulls. If NULL, the default value infinity is used and it would be equivalent to a Convex Hull.

  • units: STRING|NULL units of length, the supported options are: miles, kilometers, degrees or radians. If NULLthe default value kilometers is 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: GEOGRAPHY starting point.

  • distance: FLOAT64 distance from the origin point in the units specified.

  • bearing: FLOAT64 ranging from -180 to 180 (e.g. 0 is North, 90 is East, 180 is South, -90 is West).

  • units: STRING|NULL units of length, the supported options are: miles, kilometers, degrees or radians. If NULLthe default value kilometers is 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: GEOGRAPHY source point feature.

  • endPoint: GEOGRAPHY destination point feature.

  • npoints: INT64|NULL number of points. If NULL the default value 100 is 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: GEOGRAPHY input line.

  • distance: FLOAT64 distance along the line.

  • units: STRING|NULL units of length, the supported options are: miles, kilometers, degrees and radians. If NULLthe default value kilometers is 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: GEOGRAPHY feature to be centered.

Return type

GEOGRAPHY

Example

EU flagThis 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?