Returns a Delaunay triangulation around the vertices of the input geometry object.
Syntax
geometry ST_DelaunayTriangles(geometry g1, float tolerance = 0.0, int4 flags = 0)Parameters
| Parameter | Description |
|---|---|
g1 | The input geometry object. |
tolerance | The tolerance of the vertices of the input geometry object. Default: 0.0. |
flags | Controls the return type. Default: 0. Valid values: |
| Value | Return type |
|---|---|
0 | A collection of polygon objects (default) |
1 | A MultiLineString object |
2 | A triangulated irregular network (TIN) surface |
Description
ST_DelaunayTriangles supports triangles and triangulated irregular network (TIN) surfaces.
Examples
Return a polygon collection (default)
The following example generates 30 random points inside a unit square polygon and computes the Delaunay triangulation using default settings.
select g, ST_DelaunayTriangles(g)
from (
select ST_GeneratePoints('POLYGON((0 0,1 0,1 1,0 1,0 0))'::geometry, 30) as g
) as t;
Return a MultiLineString (flags=1)
Setting flags to 1 returns the triangulation edges as a MultiLineString instead of filled polygons.
select ST_DelaunayTriangles(
ST_GeomFromText('MULTIPOINT(175 150, 20 40, 50 60, 125 100)'),
0.0,
1
) as dtriag;Return a TIN surface (flags=2)
Setting flags to 2 returns a triangulated irregular network (TIN) surface.
select ST_DelaunayTriangles(
ST_GeomFromText('MULTIPOINT(175 150, 20 40, 50 60, 125 100)'),
0.0,
2
) as dtriag;