Skip to Main Content
Data Visualization with Python and JavaScript, 2nd Edition
book

Data Visualization with Python and JavaScript, 2nd Edition

by Kyran Dale
December 2022
Beginner to intermediate content levelBeginner to intermediate
566 pages
12h 58m
English
O'Reilly Media, Inc.
Book available
Content preview from Data Visualization with Python and JavaScript, 2nd Edition

Chapter 19. Mapping with D3

Building and customizing map visualizations is one of D3’s core strengths. It has some very sophisticated libraries, allowing for all kinds of projections, from the workhorse Mercator and orthographic to more esoteric ones such as Conic Equidistant. Mapping seems to be something of an obsession for Mike Bostock and Jason Davies, D3’s core devs, and their attention to detail is striking. If you have a mapping problem, chances are D3 can do the heavy lifting required.1 In this chapter, we’ll use our Nobel Prize visualization (Nobel-viz) map (Figure 19-1) to introduce the core D3 mapping concepts.

dpj2 1503
Figure 19-1. This chapter’s target element

Available Maps

The most popular mapping format is the aging shapefile, developed for geographic information system (GIS) software. There are many free and proprietary desktop programs2 to manipulate and produce shapefiles.

Unfortunately, shapefiles were not designed for the web, which would far rather deal in a JSON-based map format, and demands small, efficient representations to limit bandwidth and related lag.

The good news is that there are many convenient ways to convert shapefiles to our preferred TopoJSON format,3 meaning you can manipulate your shapefiles in software and then convert them to a web-friendly format. The standard way of finding maps for web dataviz is to first look for TopoJSON or GeoJSON versions, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Interactive Data Visualization with Python - Second Edition

Interactive Data Visualization with Python - Second Edition

Abha Belorkar, Sharath Chandra Guntuku, Shubhangi Hora, Anshu Kumar

Publisher Resources

ISBN: 9781098111861Errata Page