Tilesets with PMTiles in Microsoft Fabric

If you've been following the Icon Map blog for a while, you'll have seen a number of posts about PMTiles. They're an essential part of a serverless, modern geospatial solution.

So let's recap quickly why, with an example...

Let's consider the census area boundaries for England and Wales. These can be downloaded from the Office for National Statistics' GeoPortal. It's a 1.3gb geojson file containing the most detailed level of precision. This precision matters because boundaries between areas can go down the middle of a street, so it's important that they are meter accurate.

The challenge with this, is a 1.3gb file is much too large to show in a web map. We therefore have 2 options:

  1. To make the file smaller. We can use a number of techniques to achieve this including reducing the number of points making up each shape, reducing the decimal precision of the coordinates, and removing unnecessary attributes. Whilst these techniques reduce the file size, at the same time, they reduce that all important precision.
  2. Tile the dataset. This involves splitting the geometry up into squares / tiles. Only the tiles required for the current portion of the map are downloaded and shown. Multiple versions can be created for multiple zoom levels with an appropriate level of detail. This is a solid solution, but creating these tiles requires command line tools, some of which don't run on Windows. They then require hosting somewhere.

How does this change in Fabric?

A couple of months ago, Microsoft put Maps in Fabric into general availability. Part of this release included a tileset generator that outputs the results as a PMTiles file in OneLake.

Initially we were excited - we now had a means of our Icon Map users creating PMTiles with a UI and no need to install anything locally. Unfortunately, in practice the results didn't produce a usable output in many cases.

We therefore created a Tileset generator as part of the Icon Map for Fabric product.

Icon Map Tileset Generator

What are the differences between Microsoft's tileset generator and Icon Maps?

Let's run through how our tileset generator differs to the one bundled with Maps in Fabric.

Generation tailored to the type of geometry

This is the output from Microsoft's tileset generator shown in Microsoft's Maps for Fabric. You can see that you have to zoom a long way into the map for all the shapes to display - even then for some reason there is one that never renders. Zoom out and only a small subset of the census areas show.

This is the output from Icon Map's tileset generator. You can see that all the shapes show at country level and once zoomed in.

Supported source file types and sizes

I was able to upload the original Geojson file I downloaded at 1.3gb into a Lakehouse in Fabric without any issues. I then used the Icon Map tileset generator to generate the PMTiles file. This starts a Fabric job and runs in the background. It took around 9 minutes. I could also have used an Esri shapefile, KML, GeoJSONL, GeoPackage and a number of other formats as the source file.

The Microsoft tileset generator only supports GeoJSON files and they must be under 1gb. I was therefore unable to use the source data unmodified. I used QGIS to re-export the geojson file with a much reduced decimal precision (from 15 down to 8 in order to get below 1gb). The Microsoft tileset generator also uses a background job. In this case it took 18 minutes on the smaller file.

Size and performance of the output file

The Icon Map generated PMTiles file was exactly 100mb, the Microsoft generated file was 373mb (despite the smaller source file).

Cost in terms of Fabric consumption

I ran both examples on an F8 Fabric SKU and using the Microsoft Fabric Capacity Metrics app I was able to view the item history to check the compute %.

The Microsoft tile generator process reports as using 88.05% compute. The Icon Map tile generator process reports as using 10.47% compute.

The Summary

So in summary, the Icon Map tileset generator:

  • Produces better output at more zoom levels
  • Is faster to generate tiles
  • Uses less Fabric consumption
  • Generates smaller and better performing tiles

Given that Microsoft's generator required the precision of the original file to be reduced, and even then only showed the shapes when zoomed in close, the Icon Map tileset generator is, in our view, the only option for detailed geometry such as this.