Description
This would probably make a good plugin rather than for core, since I don’t know how frequently it would be used, but @jasondavies and I discussed this in the past so I wanted to write it down somewhere.
Lots of people take the 2D Voronoi algorithm and apply it to projected coordinates, but this is misleading (probably especially in Mercator with Alaska) because of the distortion of the projection, and because the topology of a plane is different from a sphere.
Edit: what I thought was an example of this bad practice was actually done correctly using a spherical Voronoi diagram generator. Here’s what it made:
However, you can see some artifacts resulting from the Petrich’s generator sampling the great arc edges as polygons. D3 could do a better job here using adaptive resampling, with the edges between polygons being great arcs rather than pre-sampled.
An algorithm for computing Voronoi Diagrams on the Sphere doesn’t look too complicated — you transform the points and then compute a planar Voronoi, and then some additional magic I don’t yet understand. It’d be nice if we could release an easy-to-use d3.geo.voronoi that did the right thing, returning GeoJSON Polygons for cells in spherical coordinates.