> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_MakePolygon

Function to convert closed linestring to polygon including holes. If holes are provided, they should be fully contained within the shell. Holes outside the shell will produce an invalid polygon (matching PostGIS behavior). Use `ST_IsValid` to check the result.

<img src="https://mintcdn.com/wherobots/wLm_IRUSNlHZTHJP/images/sql-functions/ST_MakePolygon/ST_MakePolygon.svg?fit=max&auto=format&n=wLm_IRUSNlHZTHJP&q=85&s=611b6441cbdacb9a7b67ecd3036b77ae" alt="ST_MakePolygon" width="500" height="300" data-path="images/sql-functions/ST_MakePolygon/ST_MakePolygon.svg" />

## Signatures

```sql theme={"system"}
ST_MakePolygon(geom: Geometry, holes: ARRAY[Geometry])
```

## Parameters

<ParamField body="geom" type="Geometry" required>
  The input geometry.
</ParamField>

<ParamField body="holes" type="ARRAY[Geometry]" required>
  The holes value.
</ParamField>

## Return type

<ResponseField type="Geometry">
  The resulting geometry.
</ResponseField>

## Example

```sql theme={"system"}
SELECT ST_MakePolygon(
        ST_GeomFromText('LINESTRING(0 0, 10 0, 10 10, 0 10, 0 0)'),
        ARRAY(ST_GeomFromText('LINESTRING(2 2, 4 2, 4 4, 2 4, 2 2)'))
    )
```

```
POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0), (2 2, 4 2, 4 4, 2 4, 2 2))
```
