Skip to main content
100%

Map Pan & Zoom III

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Jul 7, 2014

A world map rendered on a Canvas element supports pan and zoom interactions via the d3.behavior.zoom API. The map uses pre-projected geographic geometry from a TopoJSON file, with d3.geo.path using a null projection so that only the canvas transform changes during zoom, avoiding re-projection. Country boundaries and land masses are drawn as filled and stroked paths, with strokes scaled inversely to maintain constant width.

AI-generated description

This example uses d3.behavior.zoom with a canvas transform and pre-projected geometry for map panning and zooming. This approach is faster than reprojecting, but still slower than an SVG transform. A faster variation of this approach is to use dynamic simplification and viewport clipping.

gpl-3.0 Licensed

Similar vizzes