JupyterGIS 0.16: a grammar of graphics for maps, and collaborative story maps
JupyterGIS 0.16: A Grammar of Graphics for Maps and Collaborative Story Maps
The release of JupyterGIS 0.16 marks a significant evolution in how we approach geospatial visualization within the Jupyter ecosystem. Rather than treating maps as static images or complex API calls, this version introduces a grammar of graphics specifically tailored for cartography, alongside a powerful framework for collaborative story maps.
🗺️ The Grammar of Graphics for Mapping
At its core, JupyterGIS 0.16 moves away from imperative mapping (telling the computer how to draw) toward a declarative approach (telling the computer what to represent).
"A grammar of graphics allows users to describe the mapping of data variables to visual aesthetics—such as color, size, and shape—independently of the underlying map projection."
Core Concepts
The system treats a map as a series of layers. Each layer is defined by:
- Data: The underlying
GeoDataFrameor spatial dataset. - Aesthetics (
aes): The mapping of data columns to visual properties. - Geometry: The spatial representation (points, lines, polygons).
For instance, calculating the distance between two points and in a coordinate system can be expressed as: JupyterGIS handles these spatial calculations under the hood, allowing the user to focus on the visual encoding.
Visualizing the Workflow
The following diagram illustrates the pipeline from raw data to a rendered map:
📖 Collaborative Story Maps
One of the most exciting additions in version 0.16 is the ability to create Story Maps. These are not just maps, but narrative journeys that combine spatial data with rich text, media, and interactive elements.
Key Features of Story Maps:
- Narrative Flow: Sequence maps to tell a chronological or thematic story.
- Collaboration: Multiple users can contribute to the narrative within a shared Jupyter environment.
- Interactivity: Users can click through a story, triggering map zooms and layer changes.
Old Method: Manually creating multiple static maps and linking them via hyperlinks.
New Method: A unified StoryMap object that manages state and transitions automatically.
🛠️ Technical Implementation
JupyterGIS leverages the power of ipyleaflet and geopandas but abstracts the complexity. Below is a conceptual example of how the new grammar is implemented in code:
import jupytergis as jgis
import geopandas as gpd
# Load spatial data
df = gpd.read_file("cities.geojson")
# Create a map using the grammar of graphics approach
m = jgis.Map()
m.add_layer(
data=df,
aes(color="population", size="gdp"),
geom="point"
)
m.show()
Feature Comparison: Then vs. Now
| Feature | Previous Versions | JupyterGIS 0.16 |
|---|---|---|
| Logic | Imperative (Step-by-step) | Declarative (Grammar-based) |
| Styling | Manual dictionary definitions | Aesthetic mapping (aes) |
| Storytelling | Static notebooks | Dynamic Story Maps |
| Collaboration | File sharing | Integrated collaborative widgets |
🚀 Getting Started Checklist
If you are upgrading to 0.16, follow these steps to get your environment ready:
- Update
geopandasto the latest version. - Install
jupytergisvia pip:pip install jupytergis==0.16. - Verify
ipyleafletcompatibility. - Test a basic
StoryMaptemplate.
Figure 1: An example of the integrated Story Map interface combining text and interactive layers.
Final Thoughts
By implementing a grammar of graphics, JupyterGIS 0.16 lowers the barrier to entry for high-quality cartography. It transforms the map from a final output into an exploratory tool, enabling data scientists to iterate rapidly and share their findings through compelling, collaborative narratives.