Skip to content
A library for generating a voronoi diagram from any type of geometry
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.npmrc
LICENSE
README.md
index.js
package-lock.json
package.json
voronoi.png

README.md

VoronoiGeom

A library for generating a voronoi diagram from any type of simple geometry

Voronoi diagram

Usage:

npm install voronoigeom

const voronoiGeom = require('voronoigeom');

const features = []; // an array of GeoJson Features

const voronoiPolys = voronoiGeom(features);
// an array of GeoJson Polygon Features
  function voronoiGeom(originalFeatures: GeometryFeature[], numEmpty = 0: number, boundingFeature = undefined: PolygonFeature?): PolygonFeature[]
  • When passing in multi-geometries, a voronoi polygon is generated for each part of the multi-geom
  • In order to create additional Voronoi polygons (ie empty polygons), pass a number as the second argument to voronoiGeom.
  • In order to limit the created geometries by a polygon, add a geojson feature polygon as the third agrument

Limitations

This does not scale well, seems to work ok for < 500 features

You can’t perform that action at this time.