Quiz: Geospatial Visualization
Answer all 20 questions. Answers and explanations are hidden below each question.
Part I: Multiple Choice (10 questions)
Q1. Which projection preserves angles at the cost of area distortion?
A) Robinson B) Mercator C) Mollweide D) Eckert IV
Answer
**B.** Mercator (1569) preserves angles — useful for navigation — but distorts area dramatically at high latitudes. Robinson, Mollweide, and Eckert IV are equal-area or near-equal-area alternatives better for global comparisons.Q2. What does EPSG:4326 refer to?
A) Web Mercator B) Robinson C) WGS84 (raw latitude/longitude) D) Albers equal-area
Answer
**C.** EPSG:4326 is WGS84, the raw latitude/longitude coordinate system used by GPS and GeoJSON. EPSG:3857 is Web Mercator; ESRI:54030 is Robinson.Q3. The population proxy pitfall occurs when:
A) A map uses the wrong projection B) A choropleth of raw counts just reflects where people live C) A dot map has too many markers D) A color scale has too few bins
Answer
**B.** Raw-count choropleths (cases, crimes, revenue) correlate strongly with population, so the resulting map looks like a population map regardless of the variable. The fix is per-capita normalization.Q4. Which Plotly Express function creates a choropleth with built-in country/US state boundaries?
A) px.choropleth_mapbox
B) px.choropleth
C) px.scatter_geo
D) px.scatter_mapbox
Answer
**B.** `px.choropleth` uses built-in country and US-state boundaries. `px.choropleth_mapbox` is for custom GeoJSON with Mapbox base tiles.Q5. What is Folium?
A) A C library for geospatial computation B) A Python wrapper around the Leaflet JavaScript library C) A built-in part of matplotlib D) A shapefile editor
Answer
**B.** Folium wraps Leaflet, the dominant JavaScript library for interactive web maps. It lets you build Leaflet maps in Python and render them in Jupyter or HTML.Q6. Which library provides the GeoDataFrame type?
A) plotly B) geopandas C) folium D) altair
Answer
**B.** geopandas extends pandas with a `GeoDataFrame` that adds a geometry column. It handles shapefile/GeoJSON I/O, reprojection, geometric operations, and integration with matplotlib for plotting.Q7. Which map type is most appropriate for showing "the locations of every earthquake above magnitude 6 in 2023"?
A) Choropleth B) Dot map (scatter map) C) Cartogram D) Hex bin map
Answer
**B.** Dot maps show individual locations. Earthquakes are point events at specific locations, so each should be a dot. Choropleths aggregate by region, which is not what the question asks. Cartograms distort regions; hex bins aggregate points into bins (useful if there are thousands of points and they overplot).Q8. Which file format is JSON-based and natively supported by Plotly and Altair?
A) Shapefile B) GeoPackage C) GeoJSON D) KML
Answer
**C.** GeoJSON is the JSON-based format for geographic data. Plotly, Altair, Folium, and Leaflet all accept GeoJSON directly. Shapefiles are binary; GeoPackage and KML are alternative formats with less web-native support.Q9. What is the chapter's threshold concept?
A) Maps are data visualizations like any other B) Maps are arguments about space C) Maps should always use Mercator for familiarity D) Maps are easier than abstract charts
Answer
**B.** The chapter argues that every design choice in a map — projection, color, normalization, administrative level — is a rhetorical decision. There is no neutral map.Q10. Which projection is commonly used for US state maps that include Alaska and Hawaii as insets?
A) Mercator B) Robinson C) Albers USA D) Orthographic
Answer
**C.** Albers USA is a composite projection that repositions Alaska and Hawaii as insets. Altair's `project("albersUsa")` and Plotly's built-in US state choropleth use this projection.Part II: Short Answer (10 questions)
Q11. Why does every map projection distort something?
Answer
The earth is a sphere (topologically speaking — an oblate spheroid physically). A sphere cannot be flattened onto a plane without distortion — this is a mathematical theorem. Some projections preserve angles (conformal), some preserve areas (equal-area), some preserve distances along specific lines (equidistant), but no projection preserves all of these simultaneously. Every projection trades one form of faithfulness for another.Q12. Describe the fix for the population proxy pitfall.
Answer
Normalize by population. Instead of showing raw counts (deaths, cases, restaurants, crimes), show rates per capita (deaths per 100,000, cases per million, restaurants per 10,000 residents). The normalized map removes the population effect and shows what is actually varying. The unnormalized map is almost always misleading for analytical questions.Q13. Write the code to reproject a GeoDataFrame from lat/lon to Robinson projection.
Answer
world_robinson = world.to_crs("ESRI:54030")
After reprojection, the coordinates are in meters, not degrees. Any axis limits, annotations, or overlays must use the new coordinate system.
Q14. Explain the difference between px.scatter_geo and px.scatter_mapbox.
Answer
`scatter_geo` uses Plotly's built-in static geographic projections (natural earth, robinson, mercator, etc.). Best for world-scale maps where you want a specific projection. `scatter_mapbox` uses Mapbox-style tile-based base maps that support smooth zoom and pan. Best for regional or local maps where the user will interactively zoom. Both accept lat/lon coordinates; the difference is the rendering style.Q15. Write Altair code to create a choropleth of US states from TopoJSON data joined with a CSV of rates.
Answer
import altair as alt
from vega_datasets import data
import pandas as pd
states = alt.topo_feature(data.us_10m.url, "states")
unemp = pd.read_csv(".../unemployment.tsv", sep="\t")
alt.Chart(states).mark_geoshape().encode(
color="rate:Q",
).transform_lookup(
lookup="id",
from_=alt.LookupData(unemp, "id", ["rate"]),
).project("albersUsa")
The `transform_lookup` joins the geographic data with the rate data by the `id` column.
Q16. When should you use geopandas + matplotlib instead of Plotly for a map?
Answer
Use geopandas + matplotlib when: (1) the output is for print or publication and needs typographic polish; (2) you need a specific projection that Plotly does not support; (3) you need fine control over every visual element; (4) the map will be combined with other matplotlib figures in a larger layout; (5) interactivity is not required. Use Plotly when: interactivity matters, you want the chart quickly, or you are sharing via web/HTML.Q17. What is TopoJSON, and why might you prefer it over GeoJSON?
Answer
TopoJSON is a variant of GeoJSON that deduplicates shared boundaries between features. Two countries that share a border store the border line once rather than twice. For large multi-feature datasets (world countries, US counties), TopoJSON files are 30–50% smaller. Vega-Lite (and Altair) prefer TopoJSON for this reason. Convert with `geojson2topo` or similar tools.Q18. Describe when a cartogram is the right map type.
Answer
A cartogram distorts the shape of administrative regions so that area represents a variable rather than actual geographic extent. Use it when the geographic area of a region is irrelevant to the question and would otherwise mislead. Classic example: US electoral-vote cartograms that scale each state by its electoral votes, so sparse Western states shrink and populous Eastern states grow. The visual weight now reflects importance to the election, not land area. Cartograms are less polished in Python (libraries are limited) but common in election reporting.Q19. Why is installing geopandas historically difficult on Windows?
Answer
geopandas depends on several C libraries (GDAL, GEOS, PROJ) that must be installed on the system before the Python wrapper can import. On Windows, these libraries have historically been difficult to install, especially in non-Anaconda environments. The fix: use `conda install -c conda-forge geopandas`, which provides pre-built binaries that handle the C dependencies correctly. Recent versions of geopandas (0.14+) also ship pre-built wheels on PyPI for most platforms, easing the problem.Q20. Give three examples of ethical cartography — deliberate choices that make a map more honest.
Answer
(1) **Use an equal-area projection** for world maps that invite area comparisons, instead of Mercator. (2) **Normalize by population** when the variable scales with population, to avoid the population proxy pitfall. (3) **Disclose the data source, projection, and any limitations** in the caption, so readers can judge the map's scope. Bonus: (4) Choose a diverging color scale when the data has a meaningful midpoint; (5) include all relevant territories (Alaska, Hawaii, Puerto Rico) unless there is a strong reason to omit them.Scoring Rubric
| Score | Level | Meaning |
|---|---|---|
| 18–20 | Mastery | You understand projections, normalization, and the ethical considerations of geospatial visualization. |
| 14–17 | Proficient | You know the main libraries; review the projection and CRS sections. |
| 10–13 | Developing | You grasp the basics; re-read Sections 23.4-23.7 and work all Part B exercises. |
| < 10 | Review | Re-read the full chapter and complete all Part A and Part B exercises before moving on to Chapter 24. |
After this quiz, move on to Chapter 24 (Network and Graph Visualization), which introduces the abstract space of relationships and connections.