Implementing Vector Tile Support in Libshumate

08 November 2021

It’s incredible how things that seem simple can be so complicated. Take a “simple” maps app. There’s geometry, design, typography, a 60-gigabyte database, and a lot of complicated algorithms. Every button you press has an astonishing maze of technology supporting it.

That’s probably why GNOME Maps fascinates me so much, and why I’ve been contributing to it for three years now. And it’s why I’m thrilled to announce something I’ve been dreaming of for those three years, and working on for the past 8 months: A vector tile renderer for libshumate, the library that will eventually be powering Maps.

A demo showing a world map with continents and borders

What are vectors, tiles, and vector tiles?

Maps currently uses raster tiles. The map is stitched together from static, unmodifiable photos downloaded from the map provider. Vector tiles contain the actual map data: what area the park covers, what the name of the café is. They contain geometry, not pixels, hence vector tiles.

Because raster tiles contain pixels, they’re ready-made to display on screen. Vector tiles don’t contain pixels, so they need to be converted. This process is called rendering. The advantage of doing our own rendering is that we can control what the map looks like: change the colors, choose which language we want, and decide what places to show or hide. The disadvantage is that rendering is complicated–it’s taken me 8 months and 3 different prototypes to get it just right!

A map of Yosemite Village, Yosemite, California
Vector data of the same area, with details about Valley Loop Trail highlighted
Slide to compare
A rendered map (left) and a visualization of the underlying vector data (right). Screenshots of Maputnik.

Not everything is implemented yet. I still need to support labels, icons, and higher zoom levels, then spend some time polishing and testing.

What does this mean for Maps?

Not much in the short term–libshumate won’t be ready for another release or two. Not only are we adding a bunch of features, we’re also redesigning some of the API and porting to GTK 4.

But when it’s finally finished, we’ll be able to support a number of oft-requested features:

Some of these features will work out of the box, and some will need additional work, but I hope to eventually implement all of them.

Stay tuned!

There’s lots more work to do to get libshumate and the vector renderer ready. I’m a student and I have a part-time job, so no promises on the timeline, but I hope to have another update in the coming months with lots of exciting progress!


Next

Introducing Blueprint: A New Way to Craft User Interfaces

In a recent blog post, I presented my latest project, a markup language for creating GTK user interfaces. I’m excited to announce it’s now ready to use!

Previous

Platforms, Compatibility, and the Future of the Free Desktop

If you’ve followed Linux (and particularly GNOME) development, you’ve probably heard the recent kind, well-meaning, respectful discussions about theming, extensions, customization, and the general direction of the Linux platform. Here’s my two cents as a GNOME developer.

Also check out