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 (and still isn't really solved in any way if the huge number of projections that ship with d3-geo-projection is any indication).

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 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 instead encodes basic features with arcs and re-uses them to build more and more complex features. As a result, files can be as much as 80 percent smaller than when we use GeoJSON.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset