# processing

This module contains functions that computes new geographies by processing existing geographies.

## ST\_DELAUNAYLINES <a href="#st_delaunaylines" id="st_delaunaylines"></a>

```sql
ST_DELAUNAYLINES(points)
```

**Description**

Calculates the Delaunay triangulation of the points provided. A MultiLineString object is returned.

**Input parameters**

* `points`: `GEOMETRY` MultiPoint input to the Delaunay triangulation.

{% hint style="warning" %}
**warning**

The maximum number of points typically used to compute Delaunay diagrams is 300,000. This limit ensures efficient computation while maintaining accuracy in delineating regions based on proximity to specified points.
{% endhint %}

**Return type**

`VARCHAR(MAX)`

**Example**

{% code overflow="wrap" lineNumbers="true" %}

```sql
SELECT carto.ST_DELAUNAYLINES(
  ST_GEOMFROMTEXT(
    'MULTIPOINT((-70.3894720672732 42.9988854818585),(-71.1048188482079 42.6986831053718),(-72.6818783178395 44.1191152795997),(-73.8221894711314 35.1057463244819))'
  )
);
-- {"type": "MultiLineString", "coordinates": [[[-71.1048188482, 42.6986831054], [-70.3894720673, 42.9988854819], [-73.8221894711, 35.1057463245], [-71.1048188482, 42.6986831054]], ...
```

{% endcode %}

## ST\_DELAUNAYPOLYGONS <a href="#st_delaunaypolygons" id="st_delaunaypolygons"></a>

```sql
ST_DELAUNAYPOLYGONS(points)
```

**Description**

Calculates the Delaunay triangulation of the points provided. A MultiPolygon object is returned.

**Input parameters**

* `points`: `GEOMETRY` MultiPoint input to the Delaunay triangulation.

{% hint style="warning" %}
**warning**

The maximum number of points typically used to compute Delaunay diagrams is 300,000. This limit ensures efficient computation while maintaining accuracy in delineating regions based on proximity to specified points.
{% endhint %}

**Return type**

`VARCHAR(MAX)`

**Example**

{% code overflow="wrap" lineNumbers="true" %}

```sql
SELECT carto.ST_DELAUNAYPOLYGONS(
  ST_GEOMFROMTEXT(
    'MULTIPOINT((-70.3894720672732 42.9988854818585),(-71.1048188482079 42.6986831053718),(-72.6818783178395 44.1191152795997),(-73.8221894711314 35.1057463244819))'
  )
);
-- {"type": "MultiPolygon", "coordinates": [[[[-71.1048188482, 42.6986831054], [-70.3894720673, 42.9988854819], [-73.8221894711, 35.1057463245], [-71.1048188482, 42.6986831054]]], ...
```

{% endcode %}

## ST\_POLYGONIZE <a href="#st_polygonize" id="st_polygonize"></a>

```sql
ST_POLYGONIZE(lines)
```

**Description**

Creates a polygon from a geography which contains lines that represent its edges.

**Input parameters**

* `line`: `GEOMETRY` lines which represent the polygon edges.

**Return type**

`GEOMETRY`

**Example**

{% code overflow="wrap" lineNumbers="true" %}

```sql
SELECT carto.ST_POLYGONIZE(
  ST_GEOMFROMTEXT(
    'LINESTRING(-74.5366825512491 43.6889777784079, -70.7632814028801 42.9679602005825, -70.2005131676838 43.8455720129728, -74.5366825512491 43.6889777784079)'
  )
);
-- POLYGON ((-74.5366825512491 43.6889777784079, -70.7632814028801 42.9679602005825, -70.2005131676838 43.8455720129728, -74.5366825512491 43.6889777784079))
```

{% endcode %}

## ST\_VORONOILINES <a href="#st_voronoilines" id="st_voronoilines"></a>

```sql
ST_VORONOILINES(points)
```

**Description**

Calculates the Voronoi diagram of the points provided. A MultiLineString object is returned.

**Input parameters**

* `points`: `GEOMETRY` MultiPoint input to the Voronoi diagram.

{% hint style="warning" %}
**warning**

The maximum number of points typically used to compute Voronoi diagrams is 300,000. This limit ensures efficient computation while maintaining accuracy in delineating regions based on proximity to specified points.
{% endhint %}

**Return type**

`VARCHAR(MAX)`

**Example**

{% code overflow="wrap" lineNumbers="true" %}

```sql
SELECT carto.ST_VORONOILINES(
  ST_GEOMFROMTEXT(
    'MULTIPOINT((-74.5366825512491 43.6889777784079),(-74.4821382017478 43.3096147774153),(-70.7632814028801 42.9679602005825))'
  )
);
-- {"type": "MultiLineString", "coordinates": [[[-72.563891028, 43.7790206765], [-72.6715241053, 42.6074514117]], [[-72.563891028, 43.7790206765], ...
```

{% endcode %}

## ST\_VORONOIPOLYGONS <a href="#st_voronoipolygons" id="st_voronoipolygons"></a>

```sql
ST_VORONOIPOLYGONS(points)
```

**Description**

Calculates the Voronoi diagram of the points provided. A MultiPolygon object is returned.

**Input parameters**

* `points`: `GEOMETRY` MultiPoint input to the Voronoi diagram.

{% hint style="warning" %}
**warning**

The maximum number of points typically used to compute Voronoi diagrams is 300,000. This limit ensures efficient computation while maintaining accuracy in delineating regions based on proximity to specified points.
{% endhint %}

**Return type**

`VARCHAR(MAX)`

**Example**

{% code overflow="wrap" lineNumbers="true" %}

```sql
SELECT carto.ST_VORONOIPOLYGONS(
  ST_GEOMFROMTEXT(
    'MULTIPOINT((-74.5366825512491 43.6889777784079),(-74.4821382017478 43.3096147774153),(-70.7632814028801 42.9679602005825))'
  )
);
-- {"type": "MultiPolygon", "coordinates": [[[[-74.8971913401, 43.443541604], [-72.563891028, 43.7790206765], [-72.5122106861, 44.0494865673], [-74.8971913401, 44.0494865673], ...
```

{% endcode %}


---

# 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-redshift/sql-reference/processing.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.
