# prettymaps
A Python package to draw maps with customizable styles from [OpenStreetMap](https://www.openstreetmap.org/#map=12/11.0733/106.3078) data. Created using the [osmnx](https://github.com/gboeing/osmnx), [matplotlib](https://matplotlib.org/), [shapely](https://shapely.readthedocs.io/en/stable/index.html) and [vsketch](https://github.com/abey79/vsketch) packages.
> **This work is [licensed](LICENSE) 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)**
# Installation
### Install using with [pip](https://pypi.org):
```
pip install prettymaps
```
# [Google Colab Demo](https://colab.research.google.com/github/marceloprates/prettymaps/blob/master/notebooks/examples.ipynb)

# Note about crediting and NFTs:
- Please keep the printed message on the figures crediting my repository and OpenStreetMap ([mandatory by their license](https://www.openstreetmap.org/copyright)).
- I am personally **against** NFTs for their [environmental impact](https://earth.org/nfts-environmental-impact/), the fact that they're a [giant money-laundering pyramid scheme](https://twitter.com/smdiehl/status/1445795667826208770) and the structural incentives they create for [theft](https://twitter.com/NFTtheft) 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](https://magiceden.io/marketplace/aeterna_civitas) and [geoartnft](https://www.geo-nft.com/) projects have used this work to sell NFTs and refused to credit it. See how they reacted after being exposed: [AeternaCivitas](etc/NFT_theft_AeternaCivitas.jpg), [geoartnft](etc/NFT_theft_geoart.jpg).
- **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**.
# As seen on [Hacker News](https://web.archive.org/web/20210825160918/https://news.ycombinator.com/news):

# [prettymaps subreddit](https://www.reddit.com/r/prettymaps_/)
# Tutorial
Plotting with prettymaps is very simple. Run:
```python
prettymaps.plot(your_query)
```
**your_query** can be:
1. An address (Example: "Porto Alegre"),
2. Latitude / Longitude coordinates (Example: (-30.0324999, -51.2303767))
3. A custom boundary in GeoDataFrame format
```python
import prettymaps
plot = prettymaps.plot('Stad van de Zon, Heerhugowaard, Netherlands')
```

You can also choose from different "presets" (parameter combinations saved in JSON files)
See below an example using the "minimal" preset
```python
plot = prettymaps.plot(
'Stad van de Zon, Heerhugowaard, Netherlands',
preset = 'minimal'
)
```

Run
```python
prettymaps.presets()
```
to list all available presets:
| preset | params | |
|---|---|---|
| 0 | barcelona | {'layers': {'perimeter': {'circle': False}, 's... |
| 1 | barcelona-plotter | {'layers': {'streets': {'width': {'primary': 5... |
| 2 | cb-bf-f | {'layers': {'streets': {'width': {'trunk': 6, ... |
| 3 | default | {'layers': {'perimeter': {}, 'streets': {'widt... |
| 4 | heerhugowaard | {'layers': {'perimeter': {}, 'streets': {'widt... |
| 5 | macao | {'layers': {'perimeter': {}, 'streets': {'cust... |
| 6 | minimal | {'layers': {'perimeter': {}, 'streets': {'widt... |
| 7 | tijuca | {'layers': {'perimeter': {}, 'streets': {'widt... |
| addr:housenumber | addr:street | amenity | operator | website | geometry | addr:postcode | name | office | opening_hours | ... | contact:phone | bus | public_transport | source:name | government | ways | name:fr | type | building:part | architect | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| element_type | osmid | |||||||||||||||||||||
| node | 2407915698 | 820 | Rua Washington Luiz | NaN | NaN | NaN | POINT (-51.23212 -30.03670) | 90010-460 | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| way | 126665330 | 387 | Rua dos Andradas | place_of_worship | NaN | NaN | POLYGON ((-51.23518 -30.03275, -51.23512 -30.0... | 90020-002 | Igreja Nossa Senhora das Dores | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 126665331 | 1001 | Rua dos Andradas | NaN | NaN | http://www.ruadapraiashopping.com.br | POLYGON ((-51.23167 -30.03066, -51.23160 -30.0... | 90020-015 | Rua da Praia Shopping | NaN | Mo-Fr 09:00-21:00; Sa 08:00-20:00 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | |
| 129176990 | 1020 | Rua 7 de Setembro | NaN | NaN | http://www.memorial.rs.gov.br | POLYGON ((-51.23117 -30.02891, -51.23120 -30.0... | 90010-191 | Memorial do Rio Grande do Sul | NaN | Tu-Sa 10:00-18:00 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | |
| 129176991 | NaN | Praça da Alfândega | NaN | NaN | http://www.margs.rs.gov.br | POLYGON ((-51.23153 -30.02914, -51.23156 -30.0... | 90010-150 | Museu de Arte do Rio Grande do Sul | NaN | Tu-Su 10:00-19:00 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| relation | 6760281 | NaN | NaN | NaN | NaN | NaN | POLYGON ((-51.23238 -30.03337, -51.23223 -30.0... | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | [457506887, 457506886] | NaN | multipolygon | NaN | NaN |
| 6760282 | NaN | NaN | NaN | NaN | NaN | POLYGON ((-51.23203 -30.03340, -51.23203 -30.0... | NaN | Atheneu Espírita Cruzeiro do Sul | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | [457506875, 457506889, 457506888] | NaN | multipolygon | NaN | NaN | |
| 6760283 | NaN | NaN | NaN | NaN | NaN | POLYGON ((-51.23284 -30.03367, -51.23288 -30.0... | NaN | Palacete Chaves | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | [457506897, 457506896] | NaN | multipolygon | NaN | Theodor Wiederspahn | |
| 6760284 | NaN | NaN | NaN | NaN | NaN | POLYGON ((-51.23499 -30.03412, -51.23498 -30.0... | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | [457506910, 457506913] | NaN | multipolygon | NaN | NaN | |
| 14393526 | 1044 | Rua Siqueira Campos | NaN | NaN | https://www.sefaz.rs.gov.br | POLYGON ((-51.23125 -30.02813, -51.23128 -30.0... | NaN | Secretaria Estadual da Fazenda | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | [236213286, 1081974882] | NaN | multipolygon | NaN | NaN |
2423 rows × 105 columns
| preset | params | |
|---|---|---|
| 0 | barcelona | {'layers': {'perimeter': {'circle': False}, 's... |
| 1 | barcelona-plotter | {'layers': {'streets': {'width': {'primary': 5... |
| 2 | cb-bf-f | {'layers': {'streets': {'width': {'trunk': 6, ... |
| 3 | default | {'layers': {'perimeter': {}, 'streets': {'widt... |
| 4 | heerhugowaard | {'layers': {'perimeter': {}, 'streets': {'widt... |
| 5 | macao | {'layers': {'perimeter': {}, 'streets': {'cust... |
| 6 | minimal | {'layers': {'perimeter': {}, 'streets': {'widt... |
| 7 | my-preset | {'layers': {'building': {'tags': {'building': ... |
| 8 | tijuca | {'layers': {'perimeter': {}, 'streets': {'widt... |
| preset | params | |
|---|---|---|
| 0 | barcelona | {'layers': {'perimeter': {'circle': False}, 's... |
| 1 | barcelona-plotter | {'layers': {'streets': {'width': {'primary': 5... |
| 2 | cb-bf-f | {'layers': {'streets': {'width': {'trunk': 6, ... |
| 3 | default | {'layers': {'perimeter': {}, 'streets': {'widt... |
| 4 | heerhugowaard | {'layers': {'perimeter': {}, 'streets': {'widt... |
| 5 | macao | {'layers': {'perimeter': {}, 'streets': {'cust... |
| 6 | minimal | {'layers': {'perimeter': {}, 'streets': {'widt... |
| 7 | tijuca | {'layers': {'perimeter': {}, 'streets': {'widt... |