voronoi
Description
Takes a FeatureCollection of points, and a bounding box, and returns a FeatureCollection of Voronoi polygons.
The Voronoi algorithim used comes from the d3-voronoi package.
Parameters
Name | Type | Description |
---|---|---|
points | FeatureCollection<Point> | to find the Voronoi polygons around. |
options? | Object | Optional parameters (default {}) |
options.bbox? | Array<number> | clipping rectangle, in [minX, minY, maxX, MaxY] order. (default [-180,-85,180,-85]) |
Returns
FeatureCollection<Polygon> a set of polygons, one per input point.
Examples
var options = {
bbox: [-70, 40, -60, 60],
};
var points = turf.randomPoint(100, options);
var voronoiPolygons = turf.voronoi(points, options);
Installation
$ npm install @turf/voronoi
import { voronoi } from "@turf/voronoi";
const result = voronoi(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.voronoi(...);