Raster & Vector III
This example shows how vector geographic features (U.S. counties) can be overlaid on raster map tiles from OpenStreetMap, with both layers staying aligned during pan and zoom interactions. The vector layer is rendered as a single SVG path using `d3.geoPath` and a `d3.geoMercator` projection, while raster tiles are fetched and positioned via `d3.tile` and `d3-zoom`. Instead of reprojecting, the code updates the SVG transform and stroke-width for efficiency, using `d3.zoomIdentity` and the `on("zoom")` event.
AI-generated descriptionUsing 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.