PMTiles: vector tiles supporting firefighters
Rose Mathelier
Since 2019, Camptocamp supports the Agence du Numérique de la Sécurité Civile (ANSC) in the development of NexSIS, the information system for firefighters and civil security, now in production in 20 Fire and Rescue Services (SIS).
With NexSIS, mapping is central. Alerts, operations, vehicles — everything is geolocated. An up-to-date, readable, and high-performance basemap is therefore essential to provide contextual information, sometimes critical in handling emergency situations.
In this article, I’ll share our experience building a vector basemap served via PMTiles, from initial experiments to functional integration into the NexSIS platform.
Experiment
Why a new basemap?
It’s a fair question. NexSIS already offers several basemaps — so why add another?
NexSIS offers its users several complementary base maps, served via GeoServer Cloud and based on data stored in a PostGIS database. One of these layers relies on global OpenStreetMap data. Importing this large volume of data is fairly complex and time-consuming. As a result, this task is sometimes deprioritized in favor of more urgent work. Consequently, the data becomes outdated, increasing the risk of missing important information.
Basemaps based on external services are also available, but their availability cannot be guaranteed since the service is not under our control. This makes them unsuitable for a mission-critical system.
Why the PMTiles format?
PMTiles is a format from the Protomaps ecosystem that stores a pyramid of tiled data — raster or vector — in a single file (myfile.pmtiles) with an optimized internal index. This file can even contain data for the entire planet.
A PMTiles file is typically paired with a style in Mapbox Style format.
The key advantage of this approach is simplified updates: only one file needs to be regenerated, with no database writes required and minimal storage costs.
Additionally, the vector format provides smoother rendering and greater customization possibilities.
Validating feasibility
To kick off this work, we built a small OpenLayers project (the mapping library used in NexSIS) with two objectives: display the content of a PMTiles file on a map, and apply a style to it.
While several tools exist in OpenLayers to read and display tiles, integrating styling is more complex, as the Mapbox Style format (the standard for vector tiles) is not natively supported.
The solution came from existing Camptocamp projects, using the ol-maplibre-layer library. This tool allows a MapLibre layer to be created within an OpenLayers map, enabling better integration of PMTiles (and vector tiles in general).
Structure
Integration into the project
By default, NexSIS provides an OpenStreetMap base map in its operational maps. It is therefore the most widely used, but also the most complex to keep up to date. Fortunately, Protomaps offers PMTiles files based on OSM data, generated regularly and available with several associated styles. This allows us to use them as the foundation for a new OSM base map, without having to generate our own PMTiles.
We store the PMTiles file in an object storage system. To prevent direct access, we use a tile server that serves the file’s content through a more conventional TMS (XYZ) API.
For this use case, we used Martin, a solution from the MapLibre ecosystem. Martin supports several different source types (including raster PMTiles) and provides caching capabilities.
The final architecture is as follows:
Deployment
To test rendering and performance under real conditions, we made the basemap available in NexSIS as an optional feature — offered, but not enabled by default.
This allows us to validate the architecture in deployed environments without disrupting production activities.
Users are invited to test the new tool at their own pace and provide feedback, while development teams monitor network usage. These tests and metrics have so far shown acceptable performance and support further work to enrich this basemap and deliver real business value.
Enrich
Customizing the style
Users are accustomed to working with the OSM basemap (both its data and styling). We therefore aim to preserve its visual characteristics as much as possible — such as displayed data, colors, and symbols — since overly drastic changes could disorient users and reduce efficiency.
It is therefore desirable to customize the style to closely match the OpenStreetMap rendering.
On the left, the original OSM style. On the right, the work in progress to reproduce it in a Mapbox style adapted for PM Tiles.
Adding new information: hillshading
Hillshading visually represents terrain relief by simulating shadows. It enhances map readability and realism, especially in mountainous areas — a significant advantage in regions like South Corsica, the first department to use NexSIS.
As mentioned earlier, PMTiles can also serve raster data. This allows us to provide a second file (hillshade.pmtiles), also served as tiles via Martin. The source file is provided by the open source project Mapterhorn.
Shading allows users to more accurately visualize the terrain’s morphology.
Conclusion
This work on PMTiles opens up many technical possibilities for broader use of vector tiles in NexSIS and more advanced basemap customization.
Above all, it brings two major improvements: a modern, smooth, and customizable rendering, and simplified updates that ensure users have access to up-to-date data — while freeing data administrators from a complex and time-consuming task.
Career
Interested in working in an inspiring environment and joining our motivated and multicultural teams?