> ## 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_SubDivideExplode

It works the same as ST\_SubDivide but returns new rows with geometries instead of list.

A minimum of 5 vertices is required for maxVertices parameter to form a closed box.

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

## Signatures

```sql theme={"system"}
ST_SubDivideExplode(geom: Geometry, maxVertices: Integer)
```

## Parameters

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

<ParamField body="maxVertices" type="Integer" required>
  The maximum number of vertices.
</ParamField>

## Return type

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

## Examples

Query:

```sql theme={"system"}
SELECT ST_SubDivideExplode(ST_GeomFromText("LINESTRING(0 0, 85 85, 100 100, 120 120, 21 21, 10 10, 5 5)"), 5)
```

```
+-----------------------------+
|geom                         |
+-----------------------------+
|LINESTRING(0 0, 5 5)         |
|LINESTRING(5 5, 10 10)       |
|LINESTRING(10 10, 21 21)     |
|LINESTRING(21 21, 60 60)     |
|LINESTRING(60 60, 85 85)     |
|LINESTRING(85 85, 100 100)   |
|LINESTRING(100 100, 120 120) |
+-----------------------------+
```

Using Lateral View

Table:

```
+-------------------------------------------------------------+
|geometry                                                     |
+-------------------------------------------------------------+
|LINESTRING(0 0, 85 85, 100 100, 120 120, 21 21, 10 10, 5 5)  |
+-------------------------------------------------------------+
```

Query

```sql theme={"system"}
select geom from geometries LATERAL VIEW ST_SubdivideExplode(geometry, 5) AS geom
```

```
+-----------------------------+
|geom                         |
+-----------------------------+
|LINESTRING(0 0, 5 5)         |
|LINESTRING(5 5, 10 10)       |
|LINESTRING(10 10, 21 21)     |
|LINESTRING(21 21, 60 60)     |
|LINESTRING(60 60, 85 85)     |
|LINESTRING(85 85, 100 100)   |
|LINESTRING(100 100, 120 120) |
+-----------------------------+
```
