Analytics Toolbox for Snowflake

Analytics Toolbox for Snowflake

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_MINKOWSKIDISTANCE

Description

Calculate the Minkowski p-norm distance between two features.

  • geojsons: ARRAY array of features in GeoJSON format casted to STRING.
  • p (optional): FLOAT64 minkowski p-norm distance parameter. 1: Manhattan distance. 2: Euclidean distance. 1 =< p <= infinity. By default p is 2.

Return type

ARRAY

Examples

1
2
3
4
5
6
7
SELECT carto.ST_MINKOWSKIDISTANCE(
  ARRAY_CONSTRUCT(
    ST_ASGEOJSON(ST_POINT(10,10))::STRING,
    ST_ASGEOJSON(ST_POINT(13,10))::STRING
  )
);
-- [ [ 0, 3.333333333333333e-01 ], [ 3.333333333333333e-01, 0 ] ]
1
2
3
4
5
6
7
8
SELECT carto.ST_MINKOWSKIDISTANCE(
  ARRAY_CONSTRUCT(
    ST_ASGEOJSON(ST_POINT(10,10))::STRING,
    ST_ASGEOJSON(ST_POINT(13,10))::STRING
  ),
  2
);
-- [ [ 0, 3.333333333333333e-01 ], [ 3.333333333333333e-01, 0 ] ]