score:3
Albers projections can be a bit tricky if you don't know the underlying transformations. Unless showing the US (for which the parameters of d3.geoAlbers are defaulted to), you'll likely need to modify the parallels, rotation, and center.
Standard Parallels
This is an albers projection with its parallels set to 10 and 15 .parallels([10,15])
, as in your question, and a scale of 100 (and with rotation and center set to [0,0]):
This shape is due to the conical nature of the projection. If southern parallels are chosen, the concavity is reversed. More extreme latitudes/parallels will result in a greater bend.
The parallels selected should run through your area of interest as the area near the parallels is where distortion is minimized.
Rotation
If we wanted to say, focus on Australia (I'll keep the parallels the same as the image above for the sake of demonstration):
We could simply use the geographic center of Australia as the center of the projection .projection.center([x,y])
and scale to an appropriate level .projection.scale(1000)
:
The only change is that Australia is bigger, it is still as distorted as when it was in the corner of the map and smaller. It was shifted up/down and left/right and then magnified with no other transformations.
As your question surmises, rotation is the solution to the problem of showing areas not near the prime meridian.
If we rotate the first map (which is the same as the second map) by 100 degrees of longitude .projection.rotate([100,0])
, we get:
The world has spun 100 degrees, and an imaginary line drawn vertically through the center of the map aligns with the meridian at -100 degrees of longitude or 100 degrees west.
Centering
If our area of interest is Central America (for which the parallels you used - and I have continued to use - will work for) then the next step is to shift the center of the map up and down along the projection's central meridian. For Central America, this shift might be 20 degrees : .projection.center([0,20])
. With an appropriate scale, let's say 1000 the result will look like:
Philippines
So, for the Philippines, using your center coordinate [122.427150, 12.499176] and parallels, an ideal Albers projection might look like:
projection.rotate([-122.427150,0])
.center([0,12.499176])
.scale(1200)
.parallels([10,15]);
Summary
For an Albers:
projection.parellels([a,b])
.rotate([-x,0])
.center([0,y])
.translate([w/2,h/2])
Where a
and b
are parallels that intersect the area of interest, y
is the central parallel, and x
is the central meridian.
If using a method (projeciton.fitSize
/projection.fitExtent
) to automatically center and scale a feature, you don't need to use the center and rotate methods, but you must still set parallels and rotation first.
Source: stackoverflow.com
Related Query
- D3.js Map with Albers Projection: How to rotate it?
- Map with d3.js and TopoJSON, Albers Siberia projection
- issue with d3 projection albers producing checkered map
- d3js - how to set albers projection properly?
- How to draw circles with radii given in kilometers accurately on world map
- Looking for a world map with a specific projection in d3js
- Draw a map with D3.js: How to get the right scale() and translate()?
- d3js - how to rotate a map using d3js
- How to drag and rotate orthographic map (globe) using d3.js
- How to draw D3 Map with United States, Canada, Mexico and Puerto Rico
- In D3.js How to draw a map with full screen width?
- Can d3 voronoi map work well with any other projection besides geoAlbers?
- how to map numbers to a three color scale with D3.js?
- How to get d3 map to refresh with new saved data with javascript
- D3.js: How to Deal with Null Values in Choropleth Map (Tooltip)
- How to update projection after copying a d3, svg map
- How to display country name labels on an SVG map drawn with d3?
- How to implement mouse wheel zoom in D3 like Google Map with overlay and Ctrl + Scroll event?
- How to Add or Create a Map Scale Bar to a Map created with D3.js
- How to get map to show longitude and latitude accurately with d3
- How can I scale my map to fit my svg size with d3 and geojson path data
- D3.js - How to map continuous domains to discrete ranges with scales?
- How to rotate shape with transform
- Update map rotation with angles with orthographic projection
- How to use "g" with svg in coffee script to rotate object in d3 ?
- Why do these 9 U.S. cities not correspond to their actual locations on a D3 map when I plot them using long/lat with an Albers USA projection?
- How to rotate d3 geo svg map
- How to compute projection rotate and graticule extend for d3.js satellite projection
- How to show d3.js usa map with some state name outside the state pointing to it
- repeating world map projection with d3.js?
More Query from same tag
- How to add an if condition in my d3js example
- How do I enter an array in D3.js?
- what means a type like SomeType<T, U, V> in typescript?
- Confusing paths when using D3 and topojson?
- Why does removing, then re-adding bars to my stack bar chart change the position of the bars?
- selecting a column of a matrix created from a list in d3
- How to refresh D3 tree, even though data has not changed?
- Stroke width on d3 v3 line chart
- Put text in the middle of a circle using. d3.js
- transformation issues when implementing fisheye distortion in a radial tree
- Horizontal Stacked Bar Chart with Two Y Axis Issues
- D3 v4 Scaling Data to Range
- How does `d3.forceSimulation` adds `{x:number,y:number...}` on the data items?
- D3 js links below nodes
- what is this extra 'parse' call doing? (D3 time formatting)
- Adding elements to a D3 circle pack nodes
- How to start D3 JS Tree to render in Collapsible Mode when loaded for the first time
- Type 'Area<X>' is not assignable to type 'String' using @types/d3
- D3js how to append 2 children at the same level in .enter context
- d3 v4 adding new nodes to force directed graph
- Separate data from datahash
- Is it possible to create a treemap when any column is called "value"
- How to convert of D3.js code to react code
- Programmatically triggering a D3 brush event
- How can I make 2 different elements in a SVG group have different drag behaviours?
- How can I produce plots like this?
- grouping a csv file in d3
- Mousemove within mousedown stops mouse up firing
- Is there a way to tell crossfilter to treat elements of array as separate records instead of treating whole array as single key?
- when creating another instance of an infinite animation, it disappears