The minimal mapjson call. GET /v1/geo with no parameters returns 110m world countries as geometry-only topojson โ no properties attached. Copy the code below into any HTML file to get a working world map.
https://api.mapjson.com/v1/geo
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/d3@7/dist/d3.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/topojson-client@3/dist/topojson-client.min.js"></script>
<style>svg { width: 100%; display: block; }</style>
</head>
<body>
<div id="map"></div>
<script>
const svg = d3.select("#map").append("svg").attr("viewBox", "0 0 960 500");
const path = d3.geoPath().projection(d3.geoNaturalEarth1());
d3.json("https://api.mapjson.com/v1/geo").then(topo => {
svg.selectAll("path")
.data(topojson.feature(topo, topo.objects.geo).features)
.join("path")
.attr("d", path)
.attr("fill", "#d9d0be")
.attr("stroke", "#fff")
.attr("stroke-width", 0.5);
});
</script>
</body>
</html>