Skip to main content
100%

Tile by Bounding Box

✓ Published0🌍 Public
Mmbostock
Last edited Jul 20, 2019
Created on Jun 24, 2016

This example demonstrates map tiles clipped to a geographic bounding box, showing California with a vector overlay of state boundaries. It uses the d3-tile library to load OpenStreetMap raster tiles, positioning them with an adjusted Mercator projection from d3.geoMercator. The projection scale and translation are computed from the bounding box, then snapped to the nearest power of two for crisp tile rendering. The SVG overlay draws a topojson mesh of U.S. states using d3.geoPath, while the tile images are appended as absolutely-positioned img elements.

AI-generated description

A demo of d3-tile when projecting to fit a bounding box.

Tiles copyright OpenStreetMap contributors.

gpl-3.0 Licensed

Similar vizzes