ST_VoronoiPolygons — 返回几何图形的顶点的 Voronoi 图的单元格。
geometry ST_VoronoiPolygons(
geometry geom , float8 tolerance = 0.0 , geometry extend_to = NULL )
;
从提供的几何图形的顶点计算二维Voronoi图。结果是一个包含多个多边形的 GEOMETRYCOLLECTION,它覆盖一个比输入顶点范围更大的包络。如果输入几何图形为空,则返回 null。如果输入几何图形只包含一个顶点,则返回一个空几何图形集合。如果extend_to
包络的面积为零,则返回一个空几何图形集合。
可选参数
tolerance
:顶点将被视为等效的距离。通过提供非零的容差距离可以提高算法的鲁棒性。(默认值 = 0.0)
extend_to
:如果存在,则将图扩展为覆盖提供的几何图形的包络,除非它小于默认包络(默认值 = NULL,默认包络是输入几何图形的边界框扩大约 50%)。
由 GEOS 模块执行。
可用性:2.3.0
SELECT ST_VoronoiPolygons( 'MULTIPOINT (50 30, 60 30, 100 100,10 150, 110 120)'::geometry ) AS geom;
ST_AsText output
GEOMETRYCOLLECTION(POLYGON((-110 43.3333333333333,-110 270,100.5 270,59.3478260869565 132.826086956522,36.8181818181818 92.2727272727273,-110 43.3333333333333)),
POLYGON((55 -90,-110 -90,-110 43.3333333333333,36.8181818181818 92.2727272727273,55 79.2857142857143,55 -90)),
POLYGON((230 47.5,230 -20.7142857142857,55 79.2857142857143,36.8181818181818 92.2727272727273,59.3478260869565 132.826086956522,230 47.5)),POLYGON((230 -20.7142857142857,230 -90,55 -90,55 79.2857142857143,230 -20.7142857142857)),
POLYGON((100.5 270,230 270,230 47.5,59.3478260869565 132.826086956522,100.5 270)))
SELECT ST_VoronoiPolygons( 'MULTIPOINT (50 30, 60 30, 100 100,10 150, 110 120)'::geometry, 30) AS geom;
ST_AsText output
GEOMETRYCOLLECTION(POLYGON((-110 43.3333333333333,-110 270,100.5 270,59.3478260869565 132.826086956522,36.8181818181818 92.2727272727273,-110 43.3333333333333)),
POLYGON((230 47.5,230 -45.7142857142858,36.8181818181818 92.2727272727273,59.3478260869565 132.826086956522,230 47.5)),POLYGON((230 -45.7142857142858,230 -90,-110 -90,-110 43.3333333333333,36.8181818181818 92.2727272727273,230 -45.7142857142858)),
POLYGON((100.5 270,230 270,230 47.5,59.3478260869565 132.826086956522,100.5 270)))