@turf/voronoi
v7.3.4
Published
Takes a collection of points and a bounding box, and returns a collection of Voronoi polygons.
Readme
@turf/voronoi
voronoi
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.
Parameters
pointsFeatureCollection<Point> points around which to calculate the Voronoi polygonsoptionsObject Optional parameters (optional, default{})options.bboxBBox clipping rectangle, in [minX, minY, maxX, MaxY] order (optional, default[-180,-85,180,-85])
Examples
const options = {
bbox: [-70, 40, -60, 60]
};
const points = turf.randomPoint(100, options);
const voronoiPolygons = turf.voronoi(points, options);
//addToMap
const addToMap = [voronoiPolygons, points];Returns FeatureCollection<Polygon> a set of polygons, one per input point
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Installation
Install this single module individually:
$ npm install @turf/voronoiOr install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf