Skip to main content

prettymapp 🖼️

Prettymapp is a webapp and Python package to create beautiful maps from OpenStreetMap data


🎈 Try it out here: prettymapp on streamlit 🎈



Based on the prettymaps project

Prettymapp is based on a rewrite of the fantastic prettymaps project by @marceloprates. All credit for the original idea, designs and implementation go to him. The prettymapp rewrite focuses on speed and adapted configuration to interface with the webapp. It drops more complex configuration options in favour of improved speed, reduced code complexity and simplified configuration interfaces. It is partially tested and adds a streamlit webapp component.

Running the app locally

You can use the webapp directly under prettymapp.streamlit.app or run it locally via:

git clone https://github.com/chrieke/prettymapp.git
cd prettymapp
uv sync --extra streamlit
uv run streamlit run streamlit-prettymapp/app.py

Python package

You can also use prettymapp without the webapp, directly in Python. This lets you customize the functionality or build your own application.

Installation:

pip install prettymapp

Define the area, download and plot the OSM data:

You can select from 4 predefined styles: Peach, Auburn, Citrus and Flannel.

from prettymapp.geo import get_aoi
from prettymapp.osm import get_osm_geometries
from prettymapp.plotting import Plot
from prettymapp.settings import STYLES

aoi = get_aoi(address="Praça Ferreira do Amaral, Macau", radius=1100, rectangular=False)
df = get_osm_geometries(aoi=aoi)

fig = Plot(
    df=df,
    aoi_bounds=aoi.bounds,
    draw_settings=STYLES["Peach"],
).plot_all()

fig.savefig("map.jpg")

You can also plot exported OSM XML files e.g. from openstreetmap.org:

from prettymapp.osm import get_osm_geometries_from_xml

df = get_osm_geometries_from_xml(filepath="Berlin.osm")
aoi_bounds = df.total_bounds
...

Customize styles & layers

Edit the draw_settings input to create your own custom styles! The map layout can be further customized with the additional arguments of the Plot class (e.g. shape, contour_width etc.). Check the webapp examples for inspiration.

from prettymapp.settings import STYLES

custom_style = STYLES["Peach"].copy()
custom_style["urban"] = {
    "cmap": ["#3452eb"],
    "ec": "#E9724C",
    "lw": 0.2,
    "zorder": 4,
}

fig = Plot(
    df=df,
    aoi_bounds=aoi.bounds,
    draw_settings=custom_style,
    shape="circle",
    contour_width=0,
).plot_all()

You can also customize the selection of OSM landcover classes that should be displayed! Customize the default settings or create your own dictionary! See settings.py for the defaults.

from prettymapp.settings import LANDCOVER_CLASSES

custom_lc_classes = LANDCOVER_CLASSES.copy()
custom_lc_classes["urban"] = {"building": False} # drops all building subclasses
custom_lc_classes["grassland"] = {
    "leisure": True,  # Include all leisure subclasses
    "natural": ["island"],  # Selects only specific natural subclasses
}

df = get_osm_geometries(aoi=aoi, landcover_classes=custom_lc_classes)

Metadata

Release files for prettymapp 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prettymapp 0.7.0
File Size Uploaded
prettymapp-0.7.0.tar.gz 54.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prettymapp 0.7.0
File Interpreter ABI Platform
prettymapp-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 107.3 kB

Release files / prettymapp-0.7.0.tar.gz

Download URL prettymapp-0.7.0.tar.gz
Size 54.5 kB
Tags Source
SHA-256 checksum
How to use checksums
922cc0bc27f1ae425b19c14776cb7f174b06c66378393128278c64c7218334e5
BLAKE2b-256 checksum
How to use checksums
de3a0795c38355456cbeab259e2022a30f62b2e3969129dbb5d479ae9c1b5ba3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / prettymapp-0.7.0-py3-none-any.whl

Download URL prettymapp-0.7.0-py3-none-any.whl
Size 52.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2038c4d21c511421390bc62dc9ba0cb0c7d633c7b46b9b3d638f74def5e81bbc
BLAKE2b-256 checksum
How to use checksums
7e0f5e7adb37f161b1953114cfe0c56ad22fc4190939175c2c915d435bd8e9fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page