Creating your own custom maps
Map Art
Prettymaps combines multiple Python libraries to make it easy to draw maps straight from the OpenStreetMap database.
Maps are terribly important. Without maps we would not know where to go or, in many cases, what to do, either. Accurate maps are essential to planning anything – from a romantic weekend to large-scale urban projects. But maps are also beautiful in and of themselves. If they are customized by their owner, they can become little pieces of art. In this tutorial, I introduce a relatively simple way to generate such art using OpenStreetMap [1] and free and open source software. The results include maps in several styles and shapes that can be used as wall posters; illustrations in brochures and other documents; decorations for mugs, pillows, and other household items; or … just be used on the road, as good old paper maps!
OpenStreetMap
If you have used the Internet at all in the past 15 years, very likely you already know what OpenStreetMap is. But just in case you don't, here is a super-quick definition, focused on the aspect that is directly relevant for this tutorial: OpenStreetMap (OSM) is the Wikipedia concept applied to digital cartography, an online map of the whole world, built and continuously updated by thousands of volunteers from all around the world. It is hard to explain how important OSM is for our society, but anyone interested may find food for thought on this matter in my blog [2].
Here, what really matters is the fact that all the OSM raw data is available for reuse under an open source license and can be downloaded automatically through equally open programming interfaces. It's this availability that makes drawing custom digital maps possible, even for non-programmers and for commercial purposes.
prettymaps
The maps that you see in this tutorial have been generated with prettymaps [3], a Python package that can fetch selected raw data straight from the OSM database and then pass it to other libraries that will do the actual drawing according to your instructions. In my experience, prettymaps is a little gem that can make map enthusiasts happy, in spite of a couple of drawbacks.
The minor drawback is that prettymaps is slow. Drawing a relatively small map may take several minutes, even on an Ubuntu desktop with 16GB of RAM. Then again, this is software that many users will only run occasionally (and always in the background, maybe while taking a nap), so it's not really a big deal.
A bigger obstacle, at least as of this writing, is the fact that the only documentation is the raw code examples present on the Jupyter Notebook [4] and GitHub pages [5] of the author and other users of prettymaps. Don't despair, though! This tutorial explains how to install prettymaps and then how to modify any of those examples to draw any place you want, even if you have never used Python before. In order to get there, however, it is necessary to start with a quick overview of the prettymaps workflow and main components, as well as some basic concepts of digital mapping.
What Are Digital Maps?
Under the hood, OSM and any other digital map are standard relational databases, with some extra data types and functions made-to-order to support mapping. Such databases are usually called geographic information systems (GIS). How the data is actually presented to users (i.e., how any map built with GIS actually looks like on a screen) is delegated to separate programs. Maybe the first essential feature of any GIS is that all data is organized in layers, one (or more) for every terrain-related feature: streets, buildings, forests, water (rivers and lakes), railroads, shops, sewers, administrative boundaries, and hiking paths. All these features, and many more, have their own separate layer that users can show, hide, mix, or visually format as they wish.
Second, GIS databases support storage and analysis of lines and polygons. This is what makes it possible to, for example, draw state or city borders, calculate the length of an itinerary or the area of a building, represent the exact shape of a lagoon, or figure out which parts of a mountain range belong to one country or another.
Third, each point of each element in the database may also have an elevation, its height above or below sea level. Among other things, this permits the user to calculate steepness of roads and draw 3D maps.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Wine 10 Includes Plenty to Excite Users
With its latest release, Wine has the usual crop of bug fixes and improvements, along with some exciting new features.
-
Linux Kernel 6.13 Offers Improvements for AMD/Apple Users
The latest Linux kernel is now available, and it includes plenty of improvements, especially for those who use AMD or Apple-based systems.
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.