A minimal Python library to draw customized maps from OpenStreetMap created using the osmnx, matplotlib, shapely and vsketch libraries.
 
 
Go to file
Marcelo de Oliveira Rosa Prates fd97a9bbc2
Update README.md
2021-10-08 15:48:12 -03:00
.devcontainer
.github ci: Add publishing workflow with GitHub Actions 2021-10-05 08:43:07 -05:00
assets/Permanent_Marker
docs Added docs 2021-09-13 16:22:00 -03:00
notebooks Added missing imports for examples notebook 2021-09-13 17:52:22 -03:00
prettymaps Removed IPython dependency 2021-10-01 18:09:32 -03:00
prints
script
.gitignore
LICENSE Create LICENSE 2021-10-08 15:31:42 -03:00
MANIFEST.in build: Add MANIFEST.in with prune strategy 2021-10-03 16:13:27 -05:00
README.md Update README.md 2021-10-08 15:48:12 -03:00
readthedocs.yml Added readthedocs.yml 2021-09-13 16:29:19 -03:00
requirements.txt Removed IPython dependency 2021-10-01 18:09:32 -03:00
setup.py Updated release version 2021-10-06 11:18:44 -03:00

README.md

prettymaps

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

CC BY NC 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International.

CC BY 4.0

  • Because of the recent episodes of plagiarism and refusal to credit this project in the NFT Community (Twitter profiles AeternaCivitas and geoartnft) I have decided to change my license to Creative Commons (CC-BY-NC-4.0) which requires you to credit it everytime you use it and forbids you to use if for commercial purposes.
  • The printed message on the figures crediting OpenStreetMap and my repository, included by default, is mandatory.
  • I do not authorize people to sell NFTs using prettymaps and ask that you contact me if you know of someone who is doing it.
  • CREDIT OPEN SOURCE DEVELOPERS!

Buy Me a Coffee at ko-fi.com

As seen on Hacker News:

Read the docs

prettymaps subreddit

Google Colaboratory Demo

Installation

Install with

$ pip install prettymaps

Usage example (For more examples, see this Jupyter Notebook):

# Init matplotlib figure
fig, ax = plt.subplots(figsize = (12, 12), constrained_layout = True)

backup = plot(
    # Address:
    'Praça Ferreira do Amaral, Macau',
    # Plot geometries in a circle of radius:
    radius = 1100,
    # Matplotlib axis
    ax = ax,
    # Which OpenStreetMap layers to plot and their parameters:
    layers = {
            # Perimeter (in this case, a circle)
            'perimeter': {},
            # Streets and their widths
            'streets': {
                'width': {
                    'motorway': 5,
                    'trunk': 5,
                    'primary': 4.5,
                    'secondary': 4,
                    'tertiary': 3.5,
                    'residential': 3,
                    'service': 2,
                    'unclassified': 2,
                    'pedestrian': 2,
                    'footway': 1,
                }
            },
            # Other layers:
            #   Specify a name (for example, 'building') and which OpenStreetMap tags to fetch
            'building': {'tags': {'building': True, 'landuse': 'construction'}, 'union': False},
            'water': {'tags': {'natural': ['water', 'bay']}},
            'green': {'tags': {'landuse': 'grass', 'natural': ['island', 'wood'], 'leisure': 'park'}},
            'forest': {'tags': {'landuse': 'forest'}},
            'parking': {'tags': {'amenity': 'parking', 'highway': 'pedestrian', 'man_made': 'pier'}}
        },
        # drawing_kwargs:
        #   Reference a name previously defined in the 'layers' argument and specify matplotlib parameters to draw it
        drawing_kwargs = {
            'background': {'fc': '#F2F4CB', 'ec': '#dadbc1', 'hatch': 'ooo...', 'zorder': -1},
            'perimeter': {'fc': '#F2F4CB', 'ec': '#dadbc1', 'lw': 0, 'hatch': 'ooo...',  'zorder': 0},
            'green': {'fc': '#D0F1BF', 'ec': '#2F3737', 'lw': 1, 'zorder': 1},
            'forest': {'fc': '#64B96A', 'ec': '#2F3737', 'lw': 1, 'zorder': 1},
            'water': {'fc': '#a1e3ff', 'ec': '#2F3737', 'hatch': 'ooo...', 'hatch_c': '#85c9e6', 'lw': 1, 'zorder': 2},
            'parking': {'fc': '#F2F4CB', 'ec': '#2F3737', 'lw': 1, 'zorder': 3},
            'streets': {'fc': '#2F3737', 'ec': '#475657', 'alpha': 1, 'lw': 0, 'zorder': 3},
            'building': {'palette': ['#FFC857', '#E9724C', '#C5283D'], 'ec': '#2F3737', 'lw': .5, 'zorder': 4},
        }
)

Barcelona:

Heerhugowaard:

Barra da Tijuca:

Porto Alegre: