MapToPoster: Create Minimalist City Posters in Python
MapToPoster: Create Minimalist City Posters in Python
If you’ve ever wanted to produce a clean, artistic map of your favourite city, MapToPoster is the tool for you. It’s a pure‑Python open‑source project that stitches OpenStreetMap (OSM) data into a polished poster using Matplotlib. Whether you’re a hobby cartographer, a designer looking for a unique background, or a data scientist needing a visual aid, this repository gives you everything right out of the box.
1. What MapToPoster Gives You
| Feature | Description |
|---|---|
| Zero‑config generation | A single CLI call produces a PNG of the city centred on your chosen radius. |
| 18 ready‑made themes | From the classic noir to the futuristic neon‑cyberpunk, each theme adjusts background, road colours, and gradients automatically. |
| Customisable theme JSON | Create your own theme by editing the themes/{name}.json file—control every color channel. |
| Flexible distance | Choose a radius from 4 km (city centre) to 20 km (full city) depending on the scale you need. |
| Portable | The code depends only on well‑maintained libraries: osmnx, networkx, and matplotlib. All you need is Python 3.9+. |
| MIT licence | Free to use, modify, and redistribute. |
2. Quick Start
-
Clone the repository
git clone https://github.com/originalankur/maptoposter.git cd maptoposter -
Create a virtual environment (recommended)
python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate -
Install dependencies
pip install -r requirements.txt -
Generate a poster
python create_map_poster.py -c "Barcelona" -C "Spain" -t warm_beige -d 8000Result:
posters/barcelona_warm_beige_20260108_172924.pngis created.
You can replace the arguments with any city/country pair and theme name. Run python create_map_poster.py --list-themes to see all available options.
3. Themes at a Glance
| Theme | Style | Ideal Use Case |
|---|---|---|
feature_based |
Classic black & white with road hierarchy | Text‑heavy map legends |
gradient_roads |
Smooth gradient roads | Scientific visualisation |
noir |
Pure black background, white roads | Poster art for film/website |
midnight_blue |
Navy background, gold roads | Night‑time city mood |
blueprint |
Architectural blueprint | Architectural projects |
neon_cyberpunk |
Dark with electric pink/cyan | Futuristic game backgrounds |
warm_beige |
Sepia tones | Vintage city mood |
pastel_dream |
Soft pastels | Light‑hearted wedding invites |
japanese_ink |
Minimalist ink wash | Cultural pieces |
forest |
Deep greens | Nature‑focused themes |
ocean |
Blues & teals | Coastal city layouts |
terracotta |
Mediterranean warmth | Warm travel posters |
sunset |
Warm oranges | Sunset city art |
autumn |
Burnt reds | Fall season themes |
copper_patina |
Oxidised copper | Industrial or vintage aesthetics |
monochrome_blue |
Single blue family | Corporate branding |
4. Extending MapToPoster
4.1 Adding a New Theme
- Create a JSON file in
themes/. Examplemy_fantasy.json:{ "name": "Fantasy", "description": "A whimsical map theme", "bg": "#111111", "text": "#AAFFAA", "gradient_color": "#22AA22", "water": "#004400", "parks": "#006600", "road_motorway": "#FF0044", "road_primary": "#FF8844", "road_secondary": "#FFCC44", "road_tertiary": "#FFF444", "road_residential": "#999999", "road_default": "#666666" } - Run the poster generator with
-t fantasy.
4.2 Adding a New Map Layer
To insert railways before roads:
# In create_map_poster.py after parks fetch
try:
railways = ox.features_from_point(point, tags={"railway": "rail"}, dist=dist)
except Exception:
railways = None
if railways is not None and not railways.empty:
railways.plot(ax=ax, color=THEME["railway"], linewidth=0.5, zorder=2.5)
railway colour in your theme JSON.
5. Performance Considerations
- Distance limits: Large radii slow down data download from OSM. Keep
-d≤ 20 km for quick runs. - Caching: OSMnx automatically caches OSM data locally. Running the same city again will be noticeably faster.
- Network type:
driveis default; switch towalkorbikefor lighter data. - DPI: Default 300 dpi; lower to 150 dpi for rapid previews.
6. Why Use MapToPoster?
- Zero‑overhead: No sign‑ups or API keys required; all data is pulled directly from OSM.
- Creative control: Themes are modular; designers can tweak colours, gradients, and typography.
- Reproducible: The script is deterministic—given the same inputs it will render the same image every time.
- Community‑driven: With almost 5 k stars and 394 forks, the project has active community support.
7. Getting Started Today
- Fork the repository or clone it locally.
- Explore the existing themes and run a few examples.
- Build your own poster and share it on social media or embed it in a blog post.
- Contribute: Open an issue if you find a bug or suggest a new theme, or submit a pull request with enhancements.
MapToPoster turns a city’s street network into a visual narrative. Whether you’re creating travel guides, background art, or academic illustrations, this project gives you a rapid, scalable, and beautiful way to produce map posters—all powered by open‑source technology.
Happy mapping!