Skip to main content
100%

Polylabel with D3

✓ Published0🌍 Public
PPhilippe Rivière
Last edited Oct 31, 2018
Created on Aug 22, 2016

This visualization compares two methods for labeling countries on a world map: centroids and polylabels. Small orange dots mark each country’s spherical centroid, while white dots show the polylabel (the point farthest from any polygon edge) of its largest projected polygon, with green lines connecting the two. The map uses a Robinson projection and renders country shapes from TopoJSON data via d3.geoPath, while the polylabel algorithm from Mapbox computes the label positions on the projected coordinates.

AI-generated description

Testing @mourner's polylabel with D3.

Orange dot = country centroid; white dot = polylabel of the projected polygon (or largest projected polygon in case of MultiPolygons).

See the variant: elliptic / scaled polylabel.

TODO :

  • retrieve the radius

  • solve clipping issues (antimeridian clipping + antarctica)

Built with blockbuilder.org, base map by @mbostock.

gpl-3.0 Licensed

Similar vizzes