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.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.