Extending the hexagonal world notebook


I just saw the great work from Nadieh Bremer and Mike Bostock using pointinpath for maps. As an example:

I was wondering if that can be extended to add hexagons whose class depends on the country they are touching ? If this could be done and in combination with cartograms, it would allow to create tilegrams: https://pitchinteractiveinc.github.io/tilegrams/ automatically.

Please could you help me or point me to ressources to do that? I believe that would be a great contribution.

Thanks !!

Perhaps it would be possible to iterate through all the features of the topojson and then execute the ispointinpath ?

Fun idea! Here’s a really sloppy take on it:


edit: All I did in this edit was to change the cells so that they iterated over the 177 country features sitting inside world.objects.countries instead of just the one feature in world.objects.land. The current notebook uses canvas to draw the map, so to carry your original idea in full (i.e. to assign classes to hexagons), you’d need to write a function which generates hexagonal svg paths at the end.

To do this automatically with cartograms would be trickier. One issue is that the discretization performed by using isPointInPath is not going to be very accurate, which could lead to something misleading. See also the comments under “Ensuring statistical accuracy” in the manual of the tilegram page that you linked.


Really cool !!! Thanks a lot. I will try to combine this with cartogram: https://beta.observablehq.com/@bumbeishvili/population-change-over-years-in-georgias-regions.
Let’s see. I’ll let you know in this thread !


1 Like