A hosted API returning country, region, and physical map data in a single call. Filter by continent or country, choose resolution, and select only the properties you need.
Pass a URL to d3.json() and get back a topojson topology ready to render. No API key, no account, no rate limits.
<!-- include d3 + topojson -->
<script src="cdn.jsdelivr.net/npm/d3@7/dist/d3.min.js"></script>
<script src="cdn.jsdelivr.net/npm/topojson-client@3/..."></script>
<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");
});
</script>
Use filter=europe for a continent or filter=US with layer=regions to get a country's administrative divisions.
detail=low for fast world overviews, medium for continent maps, high for country and regional detail.
Omit properties for geometry-only output. Add properties=name,iso2,capital to get exactly the fields you need and nothing more.