Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chrieke/prettymapp
๐ผ๏ธ Create beautiful maps from OpenStreetMap data in a streamlit webapp
https://github.com/chrieke/prettymapp
app art cartography geography map osm prettymaps streamlit
Last synced: 2 days ago
JSON representation
๐ผ๏ธ Create beautiful maps from OpenStreetMap data in a streamlit webapp
- Host: GitHub
- URL: https://github.com/chrieke/prettymapp
- Owner: chrieke
- License: mit
- Created: 2021-09-27T15:15:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-29T21:29:48.000Z (27 days ago)
- Last Synced: 2025-01-16T15:02:11.609Z (9 days ago)
- Topics: app, art, cartography, geography, map, osm, prettymaps, streamlit
- Language: Python
- Homepage:
- Size: 37.4 MB
- Stars: 2,418
- Watchers: 10
- Forks: 363
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome - chrieke/prettymapp - ๐ผ๏ธ Create beautiful maps from OpenStreetMap data in a streamlit webapp (Python)
- awesome-github-repos - chrieke/prettymapp - ๐ผ๏ธ Create beautiful maps from OpenStreetMap data in a streamlit webapp (Jupyter Notebook)
- stars - chrieke/prettymapp - ๐ผ๏ธ Create beautiful maps from OpenStreetMap data in a streamlit webapp (Python)
README
# 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](https://github.com/marceloprates/prettymaps) project by
[@marceloprates](https://github.com/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](https://streamlit.io/) webapp component.## Running the app locally
You can use the webapp directly under [prettymapp.streamlit.app](https://prettymapp.streamlit.app/) or run it locally via:
```bash
git clone https://github.com/chrieke/prettymapp.git
cd prettymapp
pip install -r streamlit-prettymapp/requirements.txt
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:**
```bash
pip install prettymapp
```**Define the area, download and plot the OSM data:**
You can select from 4 [predefined styles](prettymapp/settings.py#L35): `Peach`, `Auburn`, `Citrus` and `Flannel`.
```python
from prettymapp.geo import get_aoi
from prettymapp.osm import get_osm_geometries
from prettymapp.plotting import Plot
from prettymapp.settings import STYLESaoi = 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:
```python
from prettymapp.osm import get_osm_geometries_from_xmldf = 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`](prettymapp/plotting.py#L24) class (e.g. `shape`, `contour_width` etc.). Check the webapp [examples](streamlit-prettymapp/examples.json) for inspiration.
```python
from prettymapp.settings import STYLEScustom_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](prettymapp/settings.py#L3) for the defaults.```python
from prettymapp.settings import LANDCOVER_CLASSEScustom_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
custom_lc_classes["grassland"]["natural"] = ["island"] # Selects only specific natural subclassesdf = get_osm_geometries(aoi=aoi, landcover_classes=custom_lc_classes)
```