Polylabel with D3
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 descriptionTesting @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.