© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
Dmitry
Data Visualisation
Posted question on stackoverflow.com
Problem was in scoping variable projection:
const projection = d3 .geoAlbersUsa() .scale(1300) .translate(width / 2, height / 2);
I checked with console.log(projection(-86.300568, 32.377716)) and in output was null. So I changed
`translate(${projection([longitude, latitude]).join(",")})`
to
`translate(${d3 .geoAlbersUsa() .scale(1300) .translate([width / 2, height / 2])([longitude, latitude]) .join(",")})`
And it works now! 😃
But there is still question of how to make variable projection be visible in the scope? 🤔
Problem was in scoping variable projection:
const projection = d3 .geoAlbersUsa() .scale(1300) .translate(width / 2, height / 2);I checked with console.log(projection(-86.300568, 32.377716)) and in output was null. So I changed
`translate(${projection([longitude, latitude]).join(",")})`to
`translate(${d3 .geoAlbersUsa() .scale(1300) .translate([width / 2, height / 2])([longitude, latitude]) .join(",")})`And it works now! 😃
But there is still question of how to make variable projection be visible in the scope? 🤔