unable to rotate albersUsa projections
See original GitHub issueThis is not a critical issue, however, I noticed that I am only able to apply rotation to specific d3.geo projections. I cannot apply rotation to an albersUsa projection https://github.com/d3/d3-3.x-api-reference/blob/master/Geo-Projections.md
function makeUsaProjection(scale) {
return function(element) {
var projection = d3.geo.albersUsa()
.scale(scale? scale : (element.width + 1) / 2 / Math.PI)
.translate([element.offsetWidth / 2, element.offsetHeight / (2)]);
var path = d3.geo.path()
.projection(projection);
return {path: path, projection: projection};
}
}
The code above will generate albersUsa map for me, however, when I specify a rotation on my projection:
.rotate([10,10,10])
I receive the following error:
explore-maps.js:497 Uncaught TypeError: d3.geo.albersUsa(…).rotate is not a function
I’m not sure why I can apply rotations to specific projections, and not the albersUsa map.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
albersUsa Projection #48 - zcreativelabs/react-simple-maps
albersUsa doesn't have a rotate function and ZoomableGroup expects rotate to exist. One possible workaround would be to add a rotate function ...
Read more >d3js - how to set albers projection properly? - Stack Overflow
Now, d3.js use combination of projection.rotate and projection.center to place center of the projection to long 98°W, lat 38°N (around Hutchinson, Kansas).
Read more >Is it poor form to rotate Albers US state projections if you're ...
We are using the Albers US map in a project with Alaska and Hawaii shown as well. The project allows users to zoom...
Read more >topojson projections and extensions in geojsonio - RDRR.io
If rotation is specified, sets the projection's three-axis rotation to the specified angles yaw, pitch and roll (or equivalently longitude, ...
Read more >Plot: Projections - Observable
The rotate option is an array of two (or three) angles—called Euler ... (Note that, in cases where Plot is unable to fit...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also see d3-composite-projections for more projections that use the same technique as d3.geoAlbersUsa.
Incase anyone comes wondering how they can rotate their albsersUsa projection, I dug through object that is generated and applied a style via javascript:
var usaSvg = map.svg[0][0].childNodes[0];
var dotsSvg = map.svg[0][0].childNodes[1];
usaSvg.setAttribute('transform', 'rotate(-2)');
dotsSvg.setAttribute('transform', 'rotate(-2)');