prettymaps Python Library Review
Prettymaps does exactly one thing well: it turns any OpenStreetMap location into an artistic, matplotlib-rendered illustration with almost no code. The catch is that it pulls live data over the network, so complex areas can be slow and the output depends on OSM completeness. If you want generative cartography artwork in Python and are fine with AGPL-3.0 source disclosure, it's worth adding to your stack — just don't use it in a tight loop or for real-time applications.
What is prettymaps?
Prettymaps is a Python library that fetches map geometry from OpenStreetMap using osmnx and renders it as stylized vector art via matplotlib and shapely. You call a single function with a location string and optional layer/style parameters to produce a customized map illustration ready for export or further editing.
Key features and parameters
- ✓`layers` parameter — dict of OpenStreetMap tag filters per feature type (water, buildings, roads, parks)
- ✓`style` parameter — matplotlib-style dict per layer for fill color (`fc`), edge color (`ec`), and palettes
- ✓`preset` — JSON presets including 'default', 'minimal', 'macao', 'tijuca' for instant stylized output
- ✓Boundary shaping via `circle`, `radius`, and `dilate` to crop output to a precise area
- ✓Returns a dataclass with both `fig`/`ax` and per-layer `geodataframes` for further geospatial work
- ✓Streamlit front-end via `streamlit run app.py` for browser-based exploration without writing code
- ✓Google Colab-compatible with a pip-install-from-git command and documented runtime restart step
- ✓Full tutorial in `docs/tutorial.md` covering presets, multiplot, mosaic, and hillshade effects
Installing prettymaps
pip install prettymaps For Google Colab: !pip install -e "git+https://github.com/marceloprates/prettymaps#egg=prettymaps" then restart the runtime before importing.
Using prettymaps in Python
import prettymaps plot = prettymaps.plot( 'Praça Ferreira do Amaral, Macau', circle=True, radius=1100, layers={ "water": {"tags": {"natural": ["water", "bay"]}}, "building": {"tags": {"building": True}}, }, style={ "water": {"fc": "#a1e3ff", "ec": "#2F3737"}, "building": {"palette": ["#FFC857", "#E9724C", "#C5283D"]}, }, ) # Access results fig = plot.fig # matplotlib Figure geodataframes = plot.geodataframes # per-layer GeoDataFrames
Strengths
- ✓One-line map art from any OpenStreetMap location with no geometry boilerplate
- ✓Curated presets ship out of the box — excellent default visuals without tuning
- ✓Returns GeoDataFrames alongside the figure, enabling downstream GIS work
- ✓Streamlit front-end lets non-programmers explore styles and locations interactively
- ✓Style parameters are standard matplotlib dicts — familiar API surface for Python visualization developers
Known limitations
- △Data fetching depends on live OpenStreetMap API — slow for large areas, breaks offline
- △Output quality tied directly to OSM completeness; undermapped regions produce sparse results
- △AGPL-3.0 requires disclosing source code if you distribute the library or a modified version
- △No built-in caching — repeated plots of the same area refetch every time
- △Advanced customization requires reading the full tutorial; the API surface is simple but not self-documenting
- △Preset coverage is limited to a few cities — extending to new locations requires manual tag exploration
Alternatives to prettymaps
Frequently asked questions
Pass a `style` dict to `prettymaps.plot()` with per-layer entries like `{"water": {"fc": "#a1e3ff", "ec": "#2F3737"}}` where `fc` is fill color and `ec` is edge color. Palette lists cycle colors across features — useful for building layers with multiple tones.
Yes. Run `!pip install -e "git+https://github.com/marceloprates/prettymaps#egg=prettymaps"` in a Colab cell, then restart the runtime via Runtime > Restart Runtime before importing the library.
AGPL-3.0 permits commercial use, distribution, and modification — but you must disclose source code under the same license and credit both the prettymaps repository and OpenStreetMap on any published output.
The return value of `prettymaps.plot()` is a dataclass with a `geodataframes` attribute — a dict mapping layer names to GeoDataFrame objects. Access it with `plot.geodataframes["building"]` or similar.
Any tag pair OSM recognizes. Pass a `layers` dict with `{"layer_name": {"tags": {"key": ["value1", "value2"]}}}` — the tag structure mirrors OSM's data model directly.
Set `circle=True` and pass `radius` in meters — for example `prettymaps.plot('Paris', circle=True, radius=2000)` clips the output to a 2 km circular boundary around the requested location.
The problem it solves
Producing styled, shareable map artwork programmatically usually means stitching together osmnx for data, shapely for geometry, and matplotlib for rendering — a multi-library workflow that requires non-trivial boilerplate before you see a result.
Best use cases
- •Creating shareable map illustrations for blog posts, presentations, or social media
- •Urban data exploration — fetching and visualizing the geometry of a specific neighborhood
- •Generative art projects that require stylized geographic backgrounds
- •Quick map mockups with custom colors and layers before building full GIS pipelines
- •Teaching matplotlib and osmnx concepts through a simple, high-visual-impact API
Who should try it — and who should skip
Reach for prettymaps if you want stylized map artwork in Python with minimal setup and you are comfortable with AGPL-3.0 license obligations. Data scientists producing map illustrations for reports, generative artists working with urban geometry, and developers building quick location visualizations will get the most value. Skip it if you need offline operation, real-time rendering, or are building a commercial product where AGPL-3.0 source disclosure is a blocker.
Related repositories
Want a second opinion on prettymaps?
Ask an AI that can read this page — one click and you get its take on prettymaps.
