Gist 6414125
✓ Published0🌍 Public
11wheel
Last edited Sep 2, 2013
Created on Sep 2, 2013
This example demonstrates interactive panning and zooming over a map of U.S. states and counties using SVG. It uses `d3.behavior.zoom` to control the map’s transform, while `d3.geo.path` renders the TopoJSON data from the `us.json` file. The zoom event updates the map’s translate and scale attributes, and stroke widths adjust inversely to the zoom level. Buttons also allow resetting the view or disabling the zoom event entirely.
AI-generated descriptionAn example of d3.behavior.zoom and d3.geo.path. By modifying the transform, the browser can rapidly redraw geographic features while panning and zooming, without the overhead of reprojection. This technique can be extended by combining with d3.geo.tile.