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

Creating maps with D3


In this section, we will create map-charts based on SVG. We will use the GeoJSON file with the countries to create a choropleth map that shows the distortions introduced by the Mercator projection.

We will also create maps using the more compact format, TopoJSON, and use topologic information contained in the file to find the neighbors and specific frontiers between countries.

Creating a choropleth map

In this section, we will create a choropleth map to compare the areas of different countries. We will paint each country according to its area; countries with greater areas will be colored with darker colors. In general, the Mercator projection is not suitable to create choropleth maps showing large areas, as this projection shows the regions near the poles bigger than they really are. For instance, Antarctica is smaller than Russia, but using the Mercator projection, it seems bigger. Brazil has a greater area than Greenland, but with this projection, it looks smaller.

In...