How to Create Beautiful Maps in Python Using Prettymaps Library

If you want to generate stunning maps from OpenStreetMap data in Python, use Prettymaps. In this post, we’ll explore how to use Prettymaps to create beautiful maps with ease.

Getting Started

To get started with Prettymaps, you’ll need to install the library using pip:

pip install -U prettymaps "osmnx>=1.9.3,<2.0" "git+https://github.com/abey79/vsketch@1.0.0"

Basic Usage

Once you have Prettymaps installed, you can start creating maps with just a few lines of code. Plotting with prettymaps is very simple. Run:

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

Here’s an example:

import prettymaps

plot = prettymaps.plot('Stad van de Zon, Heerhugowaard, Netherlands')

This will generate a beautiful map of the specified location.

Customizing Your Map

Prettymaps offers a range of options for customizing your map. For example, you can add a circle around the location:

plot = prettymaps.plot('Stad van de Zon, Heerhugowaard, Netherlands', circle=True)

Using Presets

Prettymaps also comes with a range of presets that you can use to customize your map. For example:

plot = prettymaps.plot('Stad van de Zon, Heerhugowaard, Netherlands', preset='minimal')
plot = prettymaps.plot('Stad van de Zon, Heerhugowaard, Netherlands', preset='barcelona')

You can view a list of available presets using the presets() function:

prettymaps.presets()

This will output a table showing the available presets and their parameters.

presetparams
0abraca-redencao{‘layers’: {‘perimeter’: {}, ‘streets’: {‘widt…
1barcelona{‘layers’: {‘perimeter’: {‘circle’: False}, ‘s…
2barcelona-plotter{‘layers’: {‘streets’: {‘width’: {‘primary’: 5…
3cb-bf-f{‘layers’: {‘streets’: {‘width’: {‘trunk’: 6, …
4default{‘layers’: {‘perimeter’: {}, ‘streets’: {‘widt…
5heerhugowaard{‘layers’: {‘perimeter’: {}, ‘streets’: {‘widt…
6macao{‘layers’: {‘perimeter’: {}, ‘streets’: {‘cust…
7minimal{‘layers’: {‘perimeter’: {}, ‘streets’: {‘widt…
8plotter{‘layers’: {‘perimeter’: {}, ‘streets’: {‘widt…
9tijuca{‘layers’: {‘perimeter’: {}, ‘streets’: {‘widt…

Conclusion

Prettymaps is a powerful library for creating beautiful maps from OpenStreetMap data in Python. With its easy-to-use interface and range of customization options, it’s the perfect tool for anyone looking to create stunning maps.

Link to prettymaps.

2 thoughts on “How to Create Beautiful Maps in Python Using Prettymaps Library”

  1. Hi there, thank you for this website that I discovered recently !!!
    I tried to install the library, and I faced this issue :
    ERROR: Could not find a version that satisfies the requirement osmnx==1.2.2 (from prettymaps) (from versions: 0.1a1, 0.1b1, 0.1b2, 0.1, 0.2, 0.2.1, 0.2.2, 0.3, 0.3.1, 0.4, 0.4.1, 0.5, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.6, 0.7, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.8, 0.8.1, 0.8.2, 0.9, 0.10, 0.11, 0.11.1, 0.11.2, 0.11.3, 0.11.4, 0.12, 0.12.1, 0.13.0, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.16.0, 0.16.1, 0.16.2, 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.1.2)
    ERROR: No matching distribution found for osmnx==1.2.2 (from prettymaps)

    1. Khuyen Tran

      Hi MO, thanks for subscribing to the website! I’m not sure why you faced that issue. I suggest that you open an issue on prettymaps to get support from the maintainers of the library

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran