Ask or search…
K
Links
Comment on page

constructors

CORE
This module contains functions that create new geographies from coordinates or already existing geographies.

ST_MAKEBBOX

ST_MAKEBBOX(lowerX, lowerY, upperX, upperY)
Description
Creates a Geometry representing a bounding box with the given boundaries.
  • lowerX: Double input lower x value.
  • lowerY: Double input lower y value.
  • upperX: Double input upper x value.
  • upperY: Double input upper y value.
Return type
Geometry
Example
1
SELECT carto.ST_ASTEXT(
2
carto.ST_MAKEBBOX(-91.85548, 29.50603, -91.83820, 29.53073)
3
) AS bbox;
4
-- POLYGON ((-91.85548 29.50603, -91.85548 29.53073, -91.83820 29.53073, -91.8382 29.50603, -91.85548 29.50603))

ST_MAKEBOX2D

ST_MAKEBOX2D(lowerleft, upperRight)
Description
Creates a Geometry representing a bounding box defined by the given Points.
  • lowerleft: Point input lower left Point.
  • upperRight: Point input upper right Point.
Return type
Geometry
Example
1
SELECT carto.ST_ASTEXT(
2
carto.ST_MAKEBOX2D(
3
carto.ST_MAKEPOINT(-91.85548, 29.50603),
4
carto.ST_MAKEPOINT(-91.83820, 29.53073)
5
)
6
) AS bbox;
7
-- POLYGON ((-91.85548 29.50603, -91.85548 29.53073, -91.8382 29.53073, -91.8382 29.50603, -91.85548 29.50603))

ST_MAKEPOINT

ST_MAKEPOINT(x, y)
Description
Creates a Point with an x and y coordinate.
  • x: Double input x value of the point.
  • y: Double input y value of the point.
Return type
Point
Example
1
SELECT carto.ST_ASTEXT(carto.ST_MAKEPOINT(-91.85548, 29.50603));
2
-- POINT (-91.85548 29.50603)

ST_MAKEPOINTM

ST_MAKEPOINTM(x, y, z)
Description
Creates a Point with an x, y, and m coordinate.
  • x: Double input x value of the point.
  • y: Double input y value of the point.
  • z: Double input z value of the point.
Return type
Point
Example
1
SELECT carto.ST_MAKEPOINTM(-91.8554869, 29.5060349, 5);
2
-- BINARY OUTPUT - 4QgB6aOA7Ab6jbKZAgo=

ST_MAKEPOLYGON

ST_MAKEPOLYGON(shell)
Description
Creates a Polygon formed by the given LineString shell, which must be closed.
  • shell: LineString input linestring closed.
Return type
Polygon
Example
1
SELECT carto.ST_ASTEXT(
2
carto.ST_MAKEPOLYGON(
3
carto.ST_GEOMFROMWKT('LINESTRING(75 29,77 29,77 27, 75 29)')
4
)
5
);
6
-- POLYGON ((75 29, 77 29, 77 27, 75 29))

ST_POINT

ST_POINT(x, y)
Description
Returns a Point with the given coordinate values. This is an OGC alias for st_makePoint.
  • x: Double input x value of the point.
  • y: Double input y value of the point.
Return type
Point
Example
1
SELECT carto.ST_ASTEXT(carto.ST_POINT(-91.85548, 29.50603));
2
-- POINT (-91.85548 29.50603)
Last modified 8mo ago