@turf/voronoi
TypeScript icon, indicating that this package has built-in type declarations

7.2.0 • Public • Published

@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

  • points FeatureCollection<Point> points around which to calculate the Voronoi polygons

  • options Object Optional parameters (optional, default {})

    • options.bbox BBox 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/voronoi

Or install the all-encompassing @turf/turf module that includes all modules as functions:

$ npm install @turf/turf

Package Sidebar

Install

npm i @turf/voronoi

Weekly Downloads

560,094

Version

7.2.0

License

MIT

Unpacked Size

17.7 kB

Total Files

9

Last publish

Collaborators

  • rowanwins
  • tmcw
  • morganherlocker
  • tcql
  • mdfedderly
  • twelch
  • jamesmilneruk
  • morgan.herlocker
  • smallsaucepan