Skip to content

KBE3D / KBCore / turf / voronoi

函数: voronoi()

voronoi(points: FeatureCollection<Point>, options?: { bbox?: BBox; }): FeatureCollection<Polygon>

Function

Takes a collection of points and a bounding box, and returns a collection of Voronoi polygons.

The Voronoi algorithim used comes from the d3-voronoi package.

参数

points

FeatureCollection<Point>

points around which to calculate the Voronoi polygons

options?

Optional parameters

bbox?

BBox

clipping rectangle, in [minX, minY, maxX, MaxY] order

返回

FeatureCollection<Polygon>

a set of polygons, one per input point

示例

ts
const options = {
  bbox: [-70, 40, -60, 60]
};
const points = turf.randomPoint(100, options);
const voronoiPolygons = turf.voronoi(points, options);

//addToMap
const addToMap = [voronoiPolygons, points];

KBE3D @3.0.0 Copyright © 2024-present KBE3D