gitmyhub

prettymaps

Jupyter Notebook ★ 12k updated 9mo ago

Draw pretty maps from OpenStreetMap data! Built with osmnx +matplotlib + shapely

Prettymaps is a Python library that generates stylized artistic map illustrations of any real-world location using OpenStreetMap data in a single line of code.

PythonOpenStreetMapStreamlitsetup: easycomplexity 2/5

Prettymaps is a Python library that turns real map data into stylized, visually appealing images. You give it a location, such as a city name, a street address, or a pair of latitude and longitude coordinates, and it fetches the actual geographic data from OpenStreetMap (a free, community-maintained world map) and then draws a custom illustration of that area. The results show streets, buildings, water, parks, and other features rendered in a graphic style rather than a standard navigation map look.

Using it requires only a single line of code: prettymaps.plot('your location here'). The library handles downloading the data and producing the image automatically. It also comes with named "presets," which are saved style configurations, so you can switch between different color schemes and visual styles without adjusting individual settings. A preset called "minimal" produces a simpler look, while other presets named after specific cities (barcelona, macao, tijuca) reproduce the styling seen in example images from those places.

Beyond a one-line Python call, the library also ships with a web front-end built on a tool called Streamlit. Running that gives you a browser-based interface for generating maps without writing code. There is also a demo available on Google Colaboratory, which lets you try it in a browser without installing anything locally.

The project uses OpenStreetMap data, so the author asks that the credit text printed on each output image be kept intact, as this is required by OpenStreetMap's own license. The library is released under the AGPL v3 license, which allows commercial use and modifications but requires that any modifications also be shared as open source. The README includes an explicit note that the author does not authorize use of this project to generate NFTs, though they acknowledge they cannot legally enforce that restriction.

Where it fits