marceloprates/prettymaps

Pythonprettymaps.streamlit.app

Draw pretty maps from OpenStreetMap data! Built with osmnx +matplotlib + shapely

matplotlibjupyter-notebookpythongenerative-artcartographymapsopenstreetmap
Star Growth
Stars
14.2k
Forks
727
Weekly Growth
+42
Issues
16
5k10k
Mar 2021Jan 2023Nov 2024Sep 2026
ArtifactsPyPI
README

prettymaps

A minimal Python library to draw customized maps from OpenStreetMap created using the osmnx, matplotlib, shapely and vsketch packages.

Docs PyPI Python License

This work is licensed under a GNU Affero General Public License v3.0 (you can make commercial use, distribute and modify this project, but must disclose the source code with the license and copyright notice)

Note about crediting and NFTs:

  • Please keep the printed message on the figures crediting my repository and OpenStreetMap (mandatory by their license).
  • I am personally against NFTs for their environmental impact, the fact that they're a giant money-laundering pyramid scheme and the structural incentives they create for theft in the open source and generative art communities.
  • I do not authorize in any way this project to be used for selling NFTs, although I cannot legally enforce it. Respect the creator.
  • The AeternaCivitas and geoartnft projects have used this work to sell NFTs and refused to credit it. See how they reacted after being exposed: AeternaCivitas, geoartnft.
  • I have closed my other generative art projects on Github and won't be sharing new ones as open source to protect me from the NFT community.

Buy Me a Coffee at ko-fi.com

As seen on Hacker News:

prettymaps subreddit

Tutorial (marimo) · Google Colaboratory Demo

Installation

Install locally:

Install prettymaps with:

pip install prettymaps

Install on Google Colaboratory:

Install prettymaps with:

!pip install -e "git+https://github.com/marceloprates/prettymaps#egg=prettymaps"

Then restart the runtime (Runtime -> Restart Runtime) before importing prettymaps

Run front-end

After prettymaps is installed, you can run the front-end (streamlit) application from the prettymaps repository using:

streamlit run app.py

Tutorial

The full tutorial is at docs/tutorial.md — a markdown walkthrough with rendered images, the [Plot] dataclass fields, the layers/style parameters, presets, multiplot, hillshade, and keypoints.

Heerhugowaard sample

Quick start:

import prettymaps

plot = prettymaps.plot('Stad van de Zon, Heerhugowaard, Netherlands')
Resource Where to find it
Full tutorial (markdown + images) docs/tutorial.md
Interactive marimo notebook (runnable) notebooks/tutorial.py
Open in Google Colab Open in Colab
Streamlit front-end streamlit run app.py

Run the tutorial locally (marimo)

# Install marimo (already in requirements.txt)
pip install marimo

# Open the notebook in your browser
marimo edit notebooks/tutorial.py

Customizing parameters

The most important prettymaps.plot() parameters are:

  • layers — dict of OpenStreetMap layers to fetch.
  • style — dict of matplotlib style parameters per layer.
  • preset — load a JSON preset (e.g. 'default', 'minimal', 'macao', 'tijuca').
  • circle / radius / dilate — boundary shape.

plot is a dataclass with geodataframes (per-layer GeoDataFrames), fig, and ax.

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"]},
    },
)

Macau, custom parameters

See docs/tutorial.md for the full set of examples (Macau, Bom Fim, mosaic, Barcelona plotter, Tijuca, multiplot, hillshade, Garopaba keypoints).

Related repositories
Asabeneh/30-Days-Of-Python

The 30 Days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than 100 days. Follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw

PythonPyPI30-days-of-pythonpython
73.2k13.4k
jakevdp/PythonDataScienceHandbook

Python Data Science Handbook: full text in Jupyter Notebooks

Jupyter NotebookMIT Licensescikit-learnnumpy
jakevdp.github.io/PythonDataScienceHandbook
49.8k19.1k
donnemartin/data-science-ipython-notebooks

Data science Python notebooks: Deep learning (TensorFlow, Theano, Caffe, Keras), scikit-learn, Kaggle, big data (Spark, Hadoop MapReduce, HDFS), matplotlib, pandas, NumPy, SciPy, Python essentials, AWS, and various command lines.

PythonPyPIOtherpythonmachine-learning
29.3k8k
matplotlib/matplotlib

matplotlib: plotting with Python

PythonPyPImatplotlibdata-visualization
matplotlib.org/stable/
23.2k8.5k
bbfamily/abu

阿布量化交易系统(股票,期权,期货,比特币,机器学习) 基于python的开源量化交易,量化投资架构

PythonPyPIGNU General Public License v3.0quanttrade
abuquant.com
18.6k4.7k
Kanaries/pygwalker

PyGWalker: Turn your dataframe into an interactive UI for visual analysis

PythonPyPIApache License 2.0data-analysispandas
kanaries.net/pygwalker
16k887
kailashahirwar/cheatsheets-ai

Essential Cheat Sheets for deep learning and machine learning researchers https://medium.com/@kailashahirwar/essential-cheat-sheets-for-machine-learning-and-deep-learning-researchers-efb6a8ebd2e5

MIT Licensedeep-learningartificial-intelligence
aicheatsheets.com
15.4k3.4k
mwaskom/seaborn

Statistical data visualization in Python

PythonPyPIBSD 3-Clause "New" or "Revised" Licensepythondata-visualization
seaborn.pydata.org
14k2.1k
tangyudi/Ai-Learn

人工智能学习路线图,整理近200个实战案例与项目,免费提供配套教材,零基础入门,就业实战!包括:Python,数学,机器学习,数据分析,深度学习,计算机视觉,自然语言处理,PyTorch tensorflow machine-learning,deep-learning data-analysis data-mining mathematics data-science artificial-intelligence python tensorflow tensorflow2 caffe keras pytorch algorithm numpy pandas matplotlib seaborn nlp cv等热门领域

machine-learningdeep-learning
13.3k2.7k
rougier/scientific-visualization-book

An open access book on scientific visualization using python and matplotlib

PythonPyPItutorialOtherpythonmatplotlib
labri.fr/perso/nrougier/
11.5k1k
Yorko/mlcourse.ai

Open Machine Learning Course

PythonPyPIOthermachine-learningdata-analysis
mlcourse.ai
10.7k5.7k
iamseancheney/python_for_data_analysis_2nd_chinese_version

《利用Python进行数据分析·第2版》

numpypandas
9k2.7k