mapOfUSAStatesProjected = {
const isProjected = false
const map = topojson.feature(usaStatesTopoProjected, 'states')
const width = 800
const height = 700
const svg = d3.create("svg")
.attr('width', width)
.attr('height', height)
const d3projection = d3.geoAlbersUsa()
const projection = d3projection
.translate([width/2, height/2])
const path = d3.geoPath()
if (isProjected) {
path.projection(projection)
}
const mapData = map.features.map((d, i) => ({
d: path(d),
centroid: path.centroid(d),
fill: 'purple'
}))
const drawMap = (el) => {
el.selectAll('path')
.data(mapData)
.join('path')
.attr('d', d => d.d)
.style('fill', d => d.fill)
.style('stroke', '#fff')
.style('stroke-width', 0.5)
}
const g = svg.append('g')
.attr('transform', !isProjected ? `translate(${width/2}, ${height/2})scale(0.00015, -0.00015)` : `translate(${width/2}, ${height/2})scale(0.5, -0.5)`)
drawMap(g)
return svg.node()
}