Skip to content

ST_DelaunayTriangles

Returns a geometry collection of Delaunay triangles covering the vertices of the input geometry.

Usage

geometry ST_DelaunayTriangles(geom: geometry)
geometry ST_DelaunayTriangles(geom: geometry, tolerance: float64)
geometry ST_DelaunayTriangles(geom: geometry, tolerance: float64, flags: integer)

Arguments

  • geom (geometry): Input geometry
  • tolerance (float64): Snap-rounding tolerance for vertices. Use 0.0 for exact computation.
  • flags (integer): Use 0 for polygon triangles or 1 for edge-only MULTILINESTRING output.

Description

Computes a Delaunay triangulation of the vertices of the input geometry. The result is a GEOMETRYCOLLECTION of POLYGON triangles unless the flags parameter is set to request MULTILINESTRING output. An optional tolerance value can be specified to snap nearby vertices together before triangulation.

Examples

SELECT ST_DelaunayTriangles(ST_GeomFromWKT('MULTIPOINT ((0 0), (1 0), (0 1))'));
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_delaunaytriangles(st_geomfromwkt(Utf8("MULTIPOINT ((0 0), (1 0), (0 1))") │
│                                      ))…                                     │
╞══════════════════════════════════════════════════════════════════════════════╡
│ GEOMETRYCOLLECTION(POLYGON((0 1,0 0,1 0,0 1)))                               │
└──────────────────────────────────────────────────────────────────────────────┘
SELECT ST_DelaunayTriangles(ST_GeomFromWKT('MULTIPOINT ((0 0), (1 0), (0 1))'), 0.0);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_delaunaytriangles(st_geomfromwkt(Utf8("MULTIPOINT ((0 0), (1 0), (0 1))") │
│                                ),Float64(0))…                                │
╞══════════════════════════════════════════════════════════════════════════════╡
│ GEOMETRYCOLLECTION(POLYGON((0 1,0 0,1 0,0 1)))                               │
└──────────────────────────────────────────────────────────────────────────────┘
SELECT ST_DelaunayTriangles(ST_GeomFromWKT('MULTIPOINT ((0 0), (1 0), (0 1))'), 0.0, 1);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_delaunaytriangles(st_geomfromwkt(Utf8("MULTIPOINT ((0 0), (1 0), (0 1))") │
│                            ),Float64(0),Int64(1))…                           │
╞══════════════════════════════════════════════════════════════════════════════╡
│ MULTILINESTRING((0 1,1 0),(0 0,0 1),(0 0,1 0))                               │
└──────────────────────────────────────────────────────────────────────────────┘