0.0.3 • Published 4 years ago
turf-voronoi-delaunay v0.0.3
turf-voronoi-delaunay
voronoi
Takes a FeatureCollection of points, and a bounding box, and returns a FeatureCollection of Voronoi polygons.
The Voronoi algorithim used comes from the d3-delaunay package.
Parameters
pointsFeatureCollection<Point> to find the Voronoi polygons around.optionsOptions Optional parameters (optional, default{keepProperties:false,bbox:[-180,-85,180,85]})
Examples
const options = {
bbox: [-70, 40, -60, 60]
};
const points = turf.randomPoint(100, options);
const voronoiPolygons = voronoiDelaunay(points, options);
//addToMap
const addToMap = [voronoiPolygons, points];Returns FeatureCollection<Polygon> a set of polygons, one per input point.
This module can be used together with the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository.
Installation
Install this module:
$ npm install turf-voronoi-delaunayTo install the Turf module:
$ npm install @turf/turf