d3 / d3-geo-projection

Extended geographic projections for d3-geo.
https://observablehq.com/collection/@d3/d3-geo-projection
Other
1.11k stars 201 forks source link

Myriahedral projections? #67

Open espinielli opened 8 years ago

espinielli commented 8 years ago

Given I have seen issues with requests for "fancy" map projections, why not proposing the fanciest?

Myriahedral map projections by Prof. Jarke van Wijk

image

Fil commented 7 years ago
myriahedral projection
Fil commented 7 years ago
icosahedral projection

icosahedral (#87) dodecahedral is sort-of a consequence of this

Fil commented 7 years ago

I had not read prof. Jarke van Wijk (JvW)'s article in details, and mainly used the images as a source of inspiration. Now I'm trying to figure out how far my implementation is from his.

Being lazy, I didn't want to create an algorithm for the meshes coordinates, and used geoVoronoi instead. So, I create the mesh of cells from their centers (JvW constructs the "dual mesh" from the initial mesh). Then, from the geo Delaunay list of links I extract a spanning tree with a minimal total length (this could be any other weight function, to reflect geographic features). For this, I used Kruskal's algorithm not Prim's (not that it matters).

The map above is defined by the centroids of each feature (countries) from a geojson file — and as there are more countries on the continents than in the oceans, it tends to use the continents as "valleys" of the minimal spanning tree.

Having geoVoronoi cells, I center the gnomonic projection for each face at its corresponding voronoi center. This has the nice property that the centers of two linked faces are equidistant from their common edge, so the scale must be the same on the two faces. As a consequence, it is constant throughout the mesh. (This also help explain why the paper model folds back perfectly, at least in one case.)

voronoi earth paper toy

It does not mean that the projection is equivalent. However, the scale is the same locally around each of the initial centers. And the distortion is capped by the maximum distance between a cell's perimeter and its center (which MUST be < 90° for the gnomonic) — which converges to zero as the density of cells grows.

Here's another map where I added one step of "Lloyd's relaxation" to grow the smaller cells and avoid having too much distorsion. I also removed the smaller countries from the mesh, so there were less cuts.

voronoi projection

An advantage of using geoVoronoi is that I don't have to create smaller triangles to accomodate polygonal cells as JvW does ("by inserting interior edges with very high weights", p. 34). As long as the maximum distance between a cell's perimeter and center is < 90°, the projection will map each polygon without further splicing, and this is why it's feasible to draw each polygon with a specific color.

There are things that I have yet to do (and may be possible or not):

To sum up, I don't think that my system is implementing myriahedral projections in the way they are defined in JvW's article, and while some results look very similar, the approach is quite different.

Maybe using a different name would be more appropriate? (polyhedralVoronoi?)

PS: For fun I generated a mesh from a Fibonacci quasi-random distribution of points on the sphere, and called the result "fibonacci projection". It makes no sense but it's a great test case for https://github.com/d3/d3-geo/pull/108

fibonacci sphere projection
jrus commented 7 years ago

Doesn’t seem to be quite as fancy as the versions in the paper, but very nice work!

Fil commented 7 years ago

Fancier is on the way :)

Using a spanning tree focused on the oceans:

voronoi coastline
Fil commented 7 years ago

& with a focus on land masses

voronoi continents