9

I have some geojson data for Japan, which I managed to position properly on a mercator projection, but I'm a bit lost as to how to position it properly using an albers projection, other than trial and error.

Is there a good tool to use?

blocks example: http://bl.ocks.org/4043986

long, lat for japan (wikipedia):

  • latitudes 24° - 46°N,
  • longitudes 122° - 146°E.

geojson link: https://gist.github.com/raw/4043986/f53b85ab0af1585cd0461b4865ca4acd1fb79e9f/japan.json

2 Answers 2

18

As of now, it's the version 3 of D3.js. It might be worth looking at the original source albers.js at github, which contains :

d3.geo.albers = function() {
    return d3.geo.conicEqualArea()
      .parallels([29.5, 45.5])
      .rotate([98, 0])
      .center([0, 38])
      .scale(1000);
};

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).

From Geo Projections API,d3.geo.conicEqualArea() .parallels([29.5, 45.5]) sets the Albers projection’s two standard parallels latitudes 29.5°N and 45.5°N, respectively. But what is two standard parallels?

To understand what parallels setting is, one need to know that Albers projection is a kind of conic projection.

A conic projection projects information from the spherical Earth to a cone that is either tangent to the Earth at a single parallel, or that is secant at two standard parallels.

enter image description here

Choosing the best standard parallels setting seems to be a subtle task, of which the goal is to minimize the projection distortion when mapping between surfaces. Anyway, choosing the two values to be closed to a country top/bottom edges is intuitively good, as it helps minimize the distance between the [conic/sphere] surfaces enclosing a country. enter image description here

0
6

I found the answer looking through the repository - the tool is right there!

  1. clone d3.js from the github repository.
  2. edit /d3/examples/albers.html line 53 to point at your GEOJSON file:
  3. Put the origin long / lat sliders to the center of your country / region (for me, it was 134° / 25°)
  4. Change the paralells to be as close to the edges of your country / region.
  5. adjust scale & offset to a nice size & position.

There are similar tools for the other projections.

edit: The repository has changed (and is constantly changing), so I've created a gist to preserve the example: https://gist.github.com/4552802

The examples are no longer part of the github repository.

3
  • Hi none of the above links are working. Can you please update them.
    – srinivas
    Jul 28, 2016 at 2:54
  • I updated the link to point at an older revision of the file. Also, check the gist I have linked.
    – minikomi
    Jul 28, 2016 at 4:55
  • please update the correct jquery etc links since ones I tried shows only a circle on rendering the albers.html you have. I did just steps 1,2 you mentioned thinking rest I need to do after page is rendered. I am trying for India region and geojson I created using bost.ocks.org/mike/map places.json step.
    – Miten
    Aug 18, 2016 at 12:51

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.