Analytics Toolbox for Databricks

Analytics Toolbox for Databricks

constructors

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

ST_MAKEBBOX

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
2
3
4
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

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
2
3
4
5
6
7
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

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

ST_MAKEPOINTM

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
2
SELECT carto.ST_MAKEPOINTM(-91.8554869, 29.5060349, 5);
-- BINARY OUTPUT - 4QgB6aOA7Ab6jbKZAgo=

ST_MAKEPOLYGON

Description

Creates a Polygon formed by the given LineString shell, which must be closed.

  • shell: LineString input linestring closed.

Return type

Polygon

Example

1
2
3
4
5
6
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

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