Key Takeaways: Geospatial Visualization
-
Every projection distorts something. Flattening a sphere onto a page is mathematically impossible without distortion. The choice is which distortion to accept (area, shape, angle, distance). For global comparisons, use equal-area projections (Mollweide, Eckert IV, Robinson, Natural Earth). For navigation, use conformal (Mercator). Never use Mercator for global area comparisons.
-
CRS (Coordinate Reference Systems) have formal identifiers. EPSG codes (4326 for lat/lon, 3857 for Web Mercator, 5070 for Albers US, 54030 for Robinson) let you specify projections unambiguously. geopandas's
.to_crs(code)reprojects between them in one call. -
GeoJSON and shapefiles are the main data formats. GeoJSON is JSON-based and web-friendly; shapefiles are the traditional GIS format (a set of files that travel together). geopandas reads both with
gpd.read_file(). Plotly and Altair accept GeoJSON directly. -
Plotly Express covers the common interactive cases.
px.choroplethfor built-in country/state boundaries,px.choropleth_mapboxfor custom GeoJSON with Mapbox tiles,px.scatter_geofor static-projection dot maps, andpx.scatter_mapboxfor tile-based dot maps. Each handles hover, zoom, and pan out of the box. -
geopandas + matplotlib is the standard for publication-quality static maps. GeoDataFrames extend pandas with geometry columns. The
.plot()method hooks into matplotlib for full styling control. Use this stack when the output is print, PDF, or LaTeX-embedded figures. -
Altair supports geospatial via
mark_geoshape. Grammar-of-graphics maps integrate with Altair's composition operators and linked-view selections. The 5000-row default applies (enable VegaFusion for larger datasets). Altair is best for linked-view geographic exploration combined with other charts. -
Folium wraps Leaflet for browser-based interactive maps.
folium.Map,folium.Marker,folium.Choropleth, and marker cluster plugins produce Leaflet maps that render in Jupyter or save as HTML files. Best for quick interactive prototypes and HTML report embedding. -
The population proxy pitfall is the most common mistake. Raw-count choropleths (cases, crimes, revenue) just reflect where people live. Always normalize to rates (per capita, per area) for analytical maps. If the question is "where are the most total X?", count maps are okay; for any question about rates or intensity, always normalize.
-
Map type selection depends on the question. Choropleths for regional rates. Dot maps for individual locations. Hex bins for dense point data. Cartograms when area should represent a value rather than geographic extent. Flow maps for movement between locations. Match the type to the question, not to the library's default.
-
Maps are arguments about space. The chapter's threshold concept: every design choice — projection, color scale, administrative level, normalization — is a rhetorical decision. No map is neutral. John Snow's cholera map (Case Study 1) and the Gall-Peters controversy (Case Study 2) both illustrate that map choices have consequences, from saving lives in 1854 London to shaping political debate in the 1970s-2000s. The practitioner's job is not to pretend these choices do not exist, but to make them deliberately and disclose them transparently.
With Chapter 23 complete, one chapter of Part V remains. Chapter 24 covers network and graph visualization — the abstract space of nodes and edges, relationships rather than places. After Chapter 24, Part V (Interactive Visualization) will be complete and Part VI (Specialized Domains) will begin with time series, text, and specialized statistical visualization.