This topic describes the ST_Subdivide function. This function divides the input geometry object into parts until the number of vertexes in each part is less than the value of the maxVertices parameter.

Syntax

setof  geometry ST_Subdivide(geometry  geom , integer  maxVertices);

Parameters

Parameter Description
geom The geometry object that you want to specify.
maxVertices The maximum number of vertexes. Default value: 256. Minimum value: 5.

Description

After the division, operations of obtaining points within a polygon object and spatial operations run fast for the indexed divided parts for the following reasons:
  • In most cases, the bounding boxes of all parts are smaller than the box of the input geometry object, so missed points are obtained faster.
  • The recheck operations are performed on fewer points, so hit points are obtained faster.

Examples

Execute the following statement to divide a circle object:
SELECT ST_Subdivide(st_buffer('POINT(0 0)'::geometry,1),6);
1