block by emeeks f2fea17ba3ec3cd66f60

addXYLayer - d3.carto.map

Full Screen

Labeling features using addXYLayer d3.carto.map.

You can add any array of objects with XY data by using d3.carto.layer.xyArray(). Here an array of centroid objects is made for the paths and then added to the map to display labels. Notice that the paths are added using addFeatureLayer because using addTopoJSON would load asynchronously and not have the data available to make the array for addXYLayer.

index.html

d3map.css