Introduction

We talked in a previous article about Cloud Native Geospatial (CNG) Technology which recently made a revolution in GIS world by its incomparable features and capabilities. https://tabaqat-wagtail.tabaqat.net/en/resources/blogs/serverless-gis-effortlessly-sharing-gis-data-without-the-need-for-a-server/

In this article we will dive into Cloud Native Geospatial Technology by discussing one of its important formats which is PMTiles.

What is PMTiles ?

PMTiles is a single-file archive format for tiled data, usually used for visualization.

As an “archive format”, PMTiles is similar to a ZIP file: it contains the contents of many individual files inside of one PMTiles file.

While MBTiles and PMTiles Serve the same purpose, But PMTiles recently offered more benefits made it a good choice for anyone dealing with satellite imagery like that it's cloud native "Serverless"; used directly from a client over a network via HTTP range requests, without having a server in the middle.

It’s also possible to upload PMTiles directly to cloud storage as individual files.

Technical Guide

Through this article, you will know how to Generate PMTiles from GeoTIFF Sentinel Satellite Images produced by Tabaqat Satellite Downloader Tool as discussed in a previous article https://tabaqat-wagtail.tabaqat.net/en/resources/blogs/enhanced-satellite-data-access-and-processing-through-tabaqat-geoapps-satellite-data-downloader through the following workflow.

We will start with creating RGB Multiband Satellite Image from three single band layers generated by Tabaqat Satellite Downloader at this path : %\AppData\Local\tabaqat\apps\data\satellite\output\2 into QGIS Desktop.

Screenshot 2024-11-27 234244

From Toolbox, Choose Merge Tool which is one GDAL Raster Miscellaneous Tools.

Screenshot 2024-11-27 234310

Choose the three single band layers previewed on the map as Input Layers.

Screenshot 2024-11-27 235128

As identified in config.yaml file of Tabaqat Satellite Downloader Tool which is located at that path: %\AppData\Local\tabaqat\apps\config\tools\satellite, data Type is UInt16.

Screenshot 2024-11-27 234517

Choose UInt16 for output data type, to be the same as input data type, and also check on Place each file into a seperate band, then Run the tool.

Screenshot 2024-11-28 005835

After the tool finished merging process, RGB Sentinel Satellite Image will be previewed on the map representing the three individual single band layers into one multiband layer.

Screenshot 2024-11-27 235352

Save the temporary Merged image to a folder, by Choosing Rendered Image instead of Raw Image to keep the current styling and ordering of bands which is Red (band 3), Green (band 2) and Blue (band 1) and also ensure your data is in a web-friendly projection such as Web Mercator (EPSG:3857). This will ensure compatibility with web mapping tools.

Screenshot 2024-11-27 235650

The next step is to generate MBTiles from the generated RGB Multiband Sentinel Satellite Image using Generate XYZ tiles (MBTiles) tool from the Toolbox

Screenshot 2024-11-28 000047

Specify the extent of MBTiles from the Multiband RGB Sentinel Image previewed on the map.

Screenshot 2024-11-28 000112

Increase the Maximum Zoom Level of MBTiles to (for example: 16) to produce high resolution MBTiles upon zooming in for the MBTile.

Then, Run the tool.

Screenshot 2024-11-28 000244

Generating MBTiles from RGB Sentinel Image will take few minutes, producing a MBTiles File of about 1,119,828 Megabytes as it has a very high resolution.

Screenshot 2024-11-28 004036

Compare between the generated MBTiles File of Riyadh Governorate and the RGB Sentinel Image, They will be of the same resolution upon zooming.

Screenshot 2024-11-28 014218

Now, We reach the last step of Converting MBTiles to PMTiles.

You need to install the command line program which is called go-pmtiles as you already generated a MBTiles file existing on your device from here https://github.com/protomaps/go-pmtiles/releases.

Screenshot 2024-11-28 000544

Click on Releases to choose the release which is compatible with your device (Windows, Linux or Darwin).

Screenshot 2024-11-28 000615

If you have Windows system, install go-pmtiles_1.22.1_Windows_x86_64.zip on your device and finish installation steps as default.

Screenshot 2024-11-28 000639

Open the directory containing go-pmtiles it will contain pmtiles.exe, README and LICENSE files as shown here.

Screenshot 2024-11-28 024012

Locate the generated MBTiles in the same directory containing go-pmtiles binary, and ensure add this directory to your system's PATH environment variable to run go-pmtiles from any location.

Screenshot 2024-11-28 024615

Open Terminal in the same directory and run this command and press Enter :

<pmtiles convert riyadh_governorate.mbtiles riyadh_governorate.pmtiles> Screenshot 2024-11-28 004737

Conversion Process will take some minutes and Finally a PMTiles File will be generated for Riyadh Governorate Successfully.

Screenshot 2024-11-28 004629

You can preview this PMTiles File using https://pmtiles.io/ to inspect the tiles hosted within the file.

Screenshot 2024-12-07 000011

Conclusion

By following all the previous steps you have successfully generated PMTiles From GeoTIFF Sentinel Satellite Images produced by Tabaqat Satellite Downloader Tool which you can use it directly from a client over a network via HTTP range requests, without having a server in the middle by uploading it directly to cloud storages.