ST_VoronoiPolygons — 返回几何图形顶点的 Voronoi 图的单元格。
geometry ST_VoronoiPolygons(
geometry geom , float8 tolerance = 0.0 , geometry extend_to = NULL )
;
从提供的几何图形的顶点计算二维 Voronoi 图。结果是一个 GEOMETRYCOLLECTION,它包含覆盖比输入顶点范围更大的范围的 POLYGON。如果输入几何图形为空,则返回 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)))