measurements

This module contains functions that compute measurements of distance, area and angles. There are also functions to compute geometry values determined by measurements.

ST_ANGLE

Description

Finds the angle formed by two adjacent segments defined by 3 points. The result will be the (positive clockwise) angle with origin on the startPoint-midPoint segment, or its explementary angle if required. https://github.com/Turfjs/turf/tree/master/packages/turf-angle

  • startPoint: GEOGRAPHY start Point Coordinates.
  • midPoint: GEOGRAPHY mid Point Coordinates.
  • endPoint: GEOGRAPHY end Point Coordinates.
  • mercator: BOOLEAN|NULL if calculations should be performed over Mercator or WGS84 projection. If NULL the default value false is used.

Return type

FLOAT64

Example

1
2
SELECT bqcarto.measurements.ST_ANGLE(ST_GEOGPOINT(-3.70325 ,40.4167), ST_GEOGPOINT(-4.70325 ,10.4167), ST_GEOGPOINT(-5.70325 ,40.4167), false);
-- 3.933094586038578

ST_AZIMUTH

Description

Takes two points and finds the geographic bearing between them, i.e. the angle measured in degrees from the north line (0 degrees). https://turfjs.org/docs/#bearing

  • startPoint: GEOGRAPHY starting Point.
  • endPoint: GEOGRAPHY ending Point.

Return type

FLOAT64

Example

1
2
SELECT bqcarto.measurements.ST_AZIMUTH(ST_GEOGPOINT(-3.70325 ,40.4167), ST_GEOGPOINT(-4.70325 ,41.4167));
-- -36.75052908494255

ST_MINKOWSKIDISTANCE

Description

Calculate the Minkowski p-norm distance between two features. https://github.com/Turfjs/turf/tree/master/packages/turf-distance-weight

  • geog: ARRAY<GEOGRAPHY> featureCollection.
  • p: FLOAT64 minkowski p-norm distance parameter. 1: Manhattan distance. 2: Euclidean distance. 1 =< p <= infinity. If NULL the default value 2 is used.

Return type

ARRAY<STRING>

Example

1
2
SELECT bqcarto.measurements.ST_MINKOWSKIDISTANCE([ST_GEOGPOINT(10,10),ST_GEOGPOINT(13,10)],2);
-- ["0,0.3333333333333333","0.3333333333333333,0"]

VERSION

Description

Returns the current version of the measurements module.

Return type

STRING

Example

1
2
SELECT bqcarto.measurements.VERSION();
-- 1.0.0