{
const path = d3.geoPath()
const svg = d3.create("svg")
.attr("width", "100%")
.attr("height", 600)
const states = svg.append("g")
.attr("fill", "#ddd")
.selectAll("g")
.data(topojson.feature(map_data, map_data.objects.states).features)
.enter().append("g")
states.each( function(d){
let state = d3.select(this)
let state_path = path(d)
let state_centroid = path.centroid(d)
console.log(state)
state.append("path").attr("d", state_path)
state.append("circle")
.attr("cx", state_centroid[0]).attr("cy", state_centroid[1])
.attr("r", 20)
.attr("fill", "black")
state.append("circle")
.attr("cx", state_centroid[0]+20).attr("cy", state_centroid[1])
.attr("r", 20)
.attr("fill", "red")
})
svg.append("path")
.datum(topojson.mesh(map_data, map_data.objects.states, (a, b) => a !== b))
.attr("fill", "none")
.attr("stroke", "white")
.attr("stroke-linejoin", "round")
.attr("pointer-events", "none")
.attr("d", path)
return svg.node()
}