Geography

Geospatial data types are used for weather or population data—anything where you want to draw a map. Converting real-world coordinates into something representable on a 2D plane is a complex mathematical problem that has spanned centuries of human history.

D3 gives us three tools for geographic data:

  • Paths produce the final pixels
  • Projections turn sphere coordinates into Cartesian coordinates
  • Streams speed things up

The main data format that we'll use is TopoJSON, a more compact extension of GeoJSON, created by Mike Bostock. In a way, TopoJSON is to GeoJSON what DivX is to video. While GeoJSON uses the JSON format to encode geographical data with points, lines, and polygons, TopoJSON encodes basic features with arcs and reuses them to build ...

Get D3.js: Cutting-edge Data Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.