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

SELECT carto.ST_ASTEXT(
  carto.ST_MAKEBBOX(-91.85548, 29.50603, -91.83820, 29.53073)
) AS bbox;
-- 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

SELECT carto.ST_ASTEXT(
  carto.ST_MAKEBOX2D(
    carto.ST_MAKEPOINT(-91.85548, 29.50603),
    carto.ST_MAKEPOINT(-91.83820, 29.53073)
  )
) AS bbox;
-- 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

SELECT carto.ST_ASTEXT(carto.ST_MAKEPOINT(-91.85548, 29.50603));
-- 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

SELECT carto.ST_MAKEPOINTM(-91.8554869, 29.5060349, 5);
-- 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

SELECT carto.ST_ASTEXT(
  carto.ST_MAKEPOLYGON(
    carto.ST_GEOMFROMWKT('LINESTRING(75 29,77 29,77 27, 75 29)')
  )
);
-- 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

SELECT carto.ST_ASTEXT(carto.ST_POINT(-91.85548, 29.50603));
-- POINT (-91.85548 29.50603)

Last updated

Was this helpful?