Zoomable Geography
✓ Published0🌍 Public
Mmbostock
Last edited Feb 4, 2020
Created on Apr 13, 2012
This example shows U.S. states and counties rendered as SVG paths, which can be panned and zoomed with the mouse. It uses d3.behavior.zoom to modify the transform of a group element, letting the browser redraw geographic features quickly without reprojection. The code loads TopoJSON data and renders it with d3.geo.path, using a null projection to preserve the pre-computed geometry. Border stroke widths are adjusted inversely to the zoom scale to maintain a constant visual weight.
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.
gpl-3.0 Licensed