block by emeeks 0fa283f6844b6d768f99

Center on a Point - d3.carto.map

Full Screen

How to center on a point with d3.carto.map.

The centerOn function can take “latlong” coordinates, which are latitude and longitude in XY order, or “scaled” coordinates, which are XY coordinates in the scaled space on the map. You can get latlong from d3.geo.centroid() and scaled from d3.geo.path.centroid().

index.html

d3map.css

example.css