Skip to main content
100%

Raster & Vector III

✓ Published0🌍 Public
CCurran Kelleher
Last edited Mar 9, 2019
Created on Mar 9, 2019

This example demonstrates pan and zoom interactions on a map of US counties, combining raster OpenStreetMap tile images with vector boundaries rendered as red outlines. The code uses d3-tile to load and position raster tiles, and d3.zoom to manage the user-driven transformations. A d3.geoPath with a Mercator projection draws a TopoJSON mesh of counties, while the zoom handler updates both the tile positions and the vector’s transform and stroke-width for efficient performance. The vector data is fetched from a GitHub-hosted TopoJSON file.

AI-generated description

Using d3-tile to display raster image tiles underneath some TopoJSON vectors, and d3-zoom for pan & zoom. This version adjusts the transform and stroke-width to update the displayed vector data efficiently. You can instead reproject interactively, but changing the transform is typically much faster. Also see the static version.

Tiles copyright OpenStreetMap contributors.

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/5914438'>Raster & Vector III</a>

gpl-3.0 Licensed

Similar vizzes