Skip to main content
100%

Dynamic Simplification IV zoom to bounding box

✓ Published0🌍 Public
CCyberZafa
Last edited Mar 17, 2017
Created on Mar 17, 2017

This map of U.S. states dynamically simplifies geometry during zooming so that visible detail stays near one square pixel, using D3 v4 and topojson-simplify. Clicking any state highlights it and triggers a smooth zoom to its bounding box via `d3.zoom` and `d3.geoPath`. A hidden canvas with `getImageData` identifies the selected feature by color, while borders and fills render on a visible Canvas with animation.

AI-generated description

This map dynamically simplifies the geometry in response to zooming, so that the smallest displayed detail is approximately one square pixel. Use the mousewheel, or pinch on touch devices, to zoom.

There is a click handler that highlight a specific feature. Once you get the feature, you can zoom to the bounding box!

Started from <a href='https://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='https://bl.ocks.org/mbostock/7755778'>Dynamic Simplification IV</a>

Thanks to <a href='https://bl.ocks.org/fil/'>Fil</a>'s work:

  • <a href="https://bl.ocks.org/Fil/652458d1831e41de6efe1d453152131b">Zoom to Bounding Box II d3v4</a>
  • <a href="http://blockbuilder.org/Fil/a8cfbbfd0100d38241beb48d23c9d4d1">Dynamic Simplification IV zoom to centroid</a>

forked from <a href='http://bl.ocks.org/Lacroute/579bc326fb547110a959c0a9ac2b30ce'>Dynamic Simplification IV with canvas selection</a>

forked from <a href='http://bl.ocks.org/Lacroute/'>Lacroute</a>'s block: <a href='http://bl.ocks.org/Lacroute/af1b46da4cb4579f93986b0119635ec2'>Dynamic Simplification IV zoom to bounding box</a>

forked from <a href='http://bl.ocks.org/anonymous/'>anonymous</a>'s block: <a href='http://bl.ocks.org/anonymous/d02ee2393bc6544267fbcafa6733b789'>Dynamic Simplification IV zoom to bounding box</a>

gpl-3.0 Licensed

Similar vizzes