Book Image

Mastering D3.js

Book Image

Mastering D3.js

Overview of this book

Table of Contents (19 chapters)
Mastering D3.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using cartographic projections


As we mentioned in the previous chapter, cartographic projections are functions that map positions on the Earth to points on a flat surface. The d3.geo module of D3 implements about a dozen of the most used cartographic projections, and there are even more cartographic projections available in the extended geographic projections plugin at https://github.com/d3/d3-geo-projection/.

There are a great number of projections because none of them are appropriate for every application. The Mercator projection, for instance, was created as a navigation tool. Straight lines on the Mercator projection are rhumb lines, which are lines of constant compass bearing. This projection is very useful for navigation, but the areas near the poles are extremely distorted. The poles, which are points on the surface of the Earth, are represented as lines that are as long as the equator. The Orthographic projection, on the other hand, is closer to what we would see from space, creating...