# 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 <a href="#st_angle" id="st_angle"></a>

```sql
ST_ANGLE(startPoint, midPoint, endPoint, mercator)
```

**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.

**Input parameters**

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

**Return type**

`FLOAT64`

**Example**

{% tabs %}
{% tab title="carto-un" %}

```sql
SELECT `carto-un`.carto.ST_ANGLE(ST_GEOGPOINT(-3.70325 ,40.4167), ST_GEOGPOINT(-4.70325 ,10.4167), ST_GEOGPOINT(-5.70325 ,40.4167), FALSE);
-- 3.933094586038578
```

{% endtab %}

{% tab title="carto-un-eu" %}

```sql
SELECT `carto-un-eu`.carto.ST_ANGLE(ST_GEOGPOINT(-3.70325 ,40.4167), ST_GEOGPOINT(-4.70325 ,10.4167), ST_GEOGPOINT(-5.70325 ,40.4167), FALSE);
-- 3.933094586038578
```

{% endtab %}

{% tab title="manual" %}

```sql
SELECT carto.ST_ANGLE(ST_GEOGPOINT(-3.70325 ,40.4167), ST_GEOGPOINT(-4.70325 ,10.4167), ST_GEOGPOINT(-5.70325 ,40.4167), FALSE);
-- 3.933094586038578
```

{% endtab %}
{% endtabs %}

## ST\_MINKOWSKIDISTANCE <a href="#st_minkowskidistance" id="st_minkowskidistance"></a>

```sql
ST_MINKOWSKIDISTANCE(geog, p)
```

**Description**

Calculate the Minkowski p-norm distance between two features.

**Input parameters**

* `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**

{% tabs %}
{% tab title="carto-un" %}

```sql
SELECT `carto-un`.carto.ST_MINKOWSKIDISTANCE([ST_GEOGPOINT(10,10),ST_GEOGPOINT(13,10)],2);
-- ["0,0.3333333333333333","0.3333333333333333,0"]
```

{% endtab %}

{% tab title="carto-un-eu" %}

```sql
SELECT `carto-un-eu`.carto.ST_MINKOWSKIDISTANCE([ST_GEOGPOINT(10,10),ST_GEOGPOINT(13,10)],2);
-- ["0,0.3333333333333333","0.3333333333333333,0"]
```

{% endtab %}

{% tab title="manual" %}

```sql
SELECT carto.ST_MINKOWSKIDISTANCE([ST_GEOGPOINT(10,10),ST_GEOGPOINT(13,10)],2);
-- ["0,0.3333333333333333","0.3333333333333333,0"]
```

{% endtab %}
{% endtabs %}

<img src="/files/4m1BK9j4Wq34gat4HHd2" alt="EU flag" data-size="line">This project has received funding from the [European Union’s Horizon 2020](https://ec.europa.eu/programmes/horizon2020/en) research and innovation programme under grant agreement No 960401.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/sql-reference/measurements.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
