🌍 Public
Viewing a saved revision (read-only)
f5325d26ce19454e95b90c7e558f7910
Map of Spain
This example displays a map of Spain, projected using a Mercator projection and rendered as a single SVG path element. It loads world country boundaries from a TopoJSON file hosted on jsDelivr, then extracts Spain’s geometry using `topojson.feature`. The code uses `d3.geoMercator()` with `fitSize` to scale and center the map, and `d3.geoPath()` to generate the SVG path data. It demonstrates loading external GeoJSON/TopoJSON data asynchronously with `d3.json` and appending the result to an SVG canvas.
AI-generated descriptionA demonstration of how to start using D3 version 6.