Appearance
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
points around which to calculate the Voronoi polygons
options?
Optional parameters
bbox?
clipping rectangle, in [minX, minY, maxX, MaxY] order
返回
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];