Skip to main content
100%

United States Map

✓ Published0🌍 Public
SSaurabh Gupta
Last edited Mar 12, 2022
Created on Mar 12, 2022
Forked from Hello VizHub

This example displays a world map with countries rendered in light green against a dark blue ocean sphere, using a natural Earth projection. It loads geographic data from the World Atlas TopoJSON dataset via unpkg and converts it to GeoJSON using the `feature` function from Topojson. The visualization leverages D3 v5 APIs including `d3.geoPath`, `d3.geoNaturalEarth1`, and `d3.json` to project and draw the country boundaries as SVG paths.

AI-generated description

An example showing the capabilities of VizHub:

<!-- * Loads D3 via UNPKG. * Demonstrates use of `import` from `"d3"`. * Demonstrates use of `import` from local ES6 modules. -->

Notes:

  1. We have used World Atlas TopoJSON (npm package) and imported as a script in html file (using unpkg)
  2. The data we get from fetching from the API endpoint returns in Topology format but in D3 we have methods to deal with geojson data.
  3. We will convert topojson data into geojson using a library 'Topojson'.
  4. topology.feature can help us do that.
MIT Licensed

Similar vizzes