Get started with d3-geo CDN
BSD-3-Clause licensed
D3-geo: GeoJSON library for geospatial data manipulation in D3.js.
Tags:- d3
- d3-module
- geo
- maps
- cartography
Stable version
Copied!
How to start using d3-geo CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with d3-geo CDN - cdnhub.io</title>
<style>
svg {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<script src="https://d3js.org/d3.v6.min.js"></script>
<script src="https://cdn.cdnhub.io/d3-geo/3.1.1/d3-geo.min.js"></script>
<script>
const svg = d3.select("body")
.append("svg")
.attr("width", 500)
.attr("height", 500);
const projection = d3.geoMercator()
.translate([250, 250])
.scale(150);
const path = d3.geoPath()
.projection(projection);
d3.json("https://raw.githubusercontent.com/d3js/d3-geo-json/v3.1.1/geojson/world.json")
.then(data => {
svg.selectAll("path")
.data(data.features)
.enter()
.append("path")
.attr("d", path)
.attr("fill", "#007bff")
.attr("stroke", "#004a60")
.attr("stroke-width", 0.5);
});
</script>
</body>
</html>
All versions
0.0.1
0.0.2
0.0.3
0.0.4
0.1.0
1.0.0
1.1.0
1.1.1
1.10.0
1.11.0
1.11.1
1.11.2
1.11.3
1.11.4
1.11.5
1.11.6
1.11.7
1.11.8
1.11.9
1.12.0
1.12.1
1.2.0
1.2.1
1.2.2
1.2.3
1.2.4
1.2.5
1.2.6
1.3.0
1.3.1
1.4.0
1.4.1
1.4.2
1.5.0
1.6.0
1.6.1
1.6.2
1.6.3
1.6.4
1.7.0
1.7.1
1.8.1
1.9.0
1.9.1
2.0.0
2.0.0-rc.1
2.0.0-rc.2
2.0.1
2.0.2
3.0.0
3.0.1
3.1.0
*** 3.1.1