|
|
4 mesiacov pred | |
|---|---|---|
| .. | ||
| dist | 4 mesiacov pred | |
| LICENSE | 4 mesiacov pred | |
| README.md | 4 mesiacov pred | |
| package.json | 4 mesiacov pred | |
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 polygonsoptions Object Optional parameters (optional, default {})
options.bbox BBox clipping rectangle, in [minX, minY, maxX, MaxY] order (optional, default [-180,-85,180,-85])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.
Install this single module individually:
$ npm install @turf/voronoi
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf