Skip to main content
100%

D3 + Leaflet (fork from bost.ocks.org/mike/leaflet/)

✓ Published0🌍 Public
AAlan McConchie
Last edited Nov 12, 2016
Created on Nov 12, 2016

This example combines D3 with the Leaflet mapping library to render U.S. state boundaries as an interactive choropleth-style overlay on top of a Stamen Toner tile map. The D3 geographic projection is configured to use Leaflet’s latLngToLayerPoint method, which projects each GeoJSON feature onto the map’s current view. State outlines are drawn as SVG paths with a semi-transparent black fill that turns brown on hover. The map responds to zoom and pan events, redrawing the state boundaries to match the new view, creating a seamless integration between D3’s data-driven rendering and Leaflet’s interactive tile-based mapping. The visualization demonstrates how to combine D3’s flexible data joins and projection system with Leaflet’s robust map interactions, rendered on an HTML5 canvas with smooth zoom animations.

AI-generated description

forked from <a href='http://bl.ocks.org/ZJONSSON/'>ZJONSSON</a>'s block: <a href='http://bl.ocks.org/ZJONSSON/2957559'>D3 + Leaflet (fork mbostock)</a>

mit Licensed

Similar vizzes