d3 map with country names code example
Example: create country map with d3.js
<script>
var svg = d3.select("svg"),
width = +svg.attr("width"),
height = +svg.attr("height");
var projection = d3.geoMercator()
.center([2, 47])
.scale(980)
.translate([ width/2, height/2 ])
d3.json("https://raw.githubusercontent.com/holtzy/D3-graph-gallery/master/DATA/world.geojson", function(data){
data.features = data.features.filter(function(d){console.log(d.properties.name) ; return d.properties.name=="Niger"})
svg.append("g")
.selectAll("path")
.data(data.features)
.enter()
.append("path")
.attr("fill", "grey")
.attr("d", d3.geoPath()
.projection(projection)
)
.style("stroke", "none")
})
</script>