RASTER TILES – What You Need To Know
Map rendering is likely the most relevant feature of every web mapping platform. It defines how the user receives and interacts with the available data. Most platforms adopt the tile coordinate system over the pixel and world coordinate systems.
This article discusses the concept of raster tiles, how they contrast with vector tiles, how to create them in QGIS, and their caching methods.
Map tiles are used by mapping platforms to render imagery at varying zoom levels to allow the user request for relevant portions of the dataset.
Raster tiles are image-based map tiles. Each tile has a unique storage scheme consisting of their coordinate system origin, zoom levels, pixel size and shape.
Vector tiles are object-based map tiles. They are an addition of grids to map elements. This makes vector tiles more interactive and flexible.
To create a raster tile in QGIS:
Import the raster file: Data source manager >> Raster >> File >> Browse > OK.
Install the QTiles plugin: Manage and Install plugins >> search: “QTiles” >> Install plugin > Close
Set QTiles parameters: Tileset name >> output >> extent >> maximum zoom >> Check the Write Leaflet-based viewer > Run.
Access selected directory.
Caching is a technique that saves query results for future use. It allows the Key server to provide query results immediately after a user makes requests, without performing the query on the server.
First, what is a Tile?
A map tile is a map segment that interlocks with several other map tiles to render imagery on a web browser. Map tiles help users request and access specific portions of a map without dealing with the whole imagery.
Map tiles consist of map tiles. Yes, they are. They are rendered at varying zoom levels to allow the user to browse through different locations.
Here’s how it works.
The mapping platform divides your browser window into squares. Each square represents a map tile. As seen in the image below, zooming in on “tile C” displays yet another set of tiles, C1, C2 … Cn.
1 Map tiles consist of map tiles
Presently, the raster and vector tiling systems are the most widely adopted.
What are Raster Tiles?
Raster tiles are image-based map tiles. They are typically stored in .PNG and .jpg file formats and ordered side by side in a pyramid scheme.
Each map tile has its set storage scheme. An essential parameter in a storage scheme is the Coordinate system origin. Most web maps adopt the Web Mercator coordinate system (ESPG: 3857) developed by Google.
Some other key parameters in the scheme are:
- Zoom levels
- Pixel size
- Tile shape and size, amongst others
Using the Web Mercator coordinate system, the world map can be displayed as a single square, representing a zero-zoom level tile. Subsequent zoom levels are simply a division by 4, creating four new tiles on each level.
Each tile is uniquely identified using the coordinate system origin and the tile numbering system. There are two major tile numbering systems used today;
[0,0] By Google
Google assigns X, and Y coordinates to each tile. Each tile begins with coordinate 0,0 numbered from upper left to lower right. To identify a tile in this system, the zoom level needs to be known.
2 Google assigns X and Y coordinates to each tile on every zoom level
 By Bing
While this system also assigns an origin, a new tile number (from 0 – 3) is added at every zoom level. If the tiles at the zero-zoom level are 0, 1, 2, and 3 respectively, the tiles in the next zoom level of the second tile will be 10, 11, 12, and 13 – numbered from upper left to lower right.
3 Bing assigns numeric values to identify each map tile
The size of each raster tile varies between 64 x 64 pixels, 256 x 256 (typically), and 512 x 512 pixels. The pixel size remains the same across zoom levels. This requires that raster tiles are stored separately on every level. At 20 zoom levels, an estimated 1 trillion tiles are required.
The Contrast – Vector Tiles
Vector tiles are object-based map tiles. Rather than raster images, they are made up of vector objects – points lines, and polygons. They are more interactive and do not require data to be stored at every zoom level. This is a key difference. It provides more flexibility as zoom levels are progressive (e.g., zoom 5, 5.5, etc.) rather than incremental (e.g., zoom 5, 6, etc.)
Both tiling systems are similar in their use of tiling grids. Vector tiles are also identified using a storage scheme. For most, a tile on every zoom level records the zoom level, column, and line. In the image below, the identified tile, on the sixth zoom level, will be numbered 6|2|3.
4 Vector tiles are simply an addition of grids to existing map elements
Creating a Raster Tile in QGIS
When working on a project on QGIS, you can create raster tiles in .PNG format using the QTiles plugin. In this tutorial, I’ll be using a dataset from Natural Earth. If this is for practice purposes, here’s the download link and follow through with the steps.
Step 1: Import Dataset
Import your raster file (file extension – .TIF) by navigating to the directory through the browser panel or using the data source manager. That is: Data source manager >> Raster >> File >> Browse > OK.
5 Access the data source manager dialogue and import raster data in QGIS
Step 2: Install QTiles Plugin
To do this: Manage and Install plugins >> search: “QTiles” >> Install plugin > Close
6 Download and install the QTiles plugin in QGIS
Step 3: Set Parameters
Open the QTIles Dialogue from your toolbar
>> Set the Tileset name to QTIles.
>> Set output to directory and navigate to your preferred storage directory.
>> Set extent to layer extent – select file name
>> Set maximum zoom to 6 – for the number of zoom levels.
In the parameter section, set your preferred file formats, transparency, pixel size, etc. (I stick with the defaults here)
>> Check the Write Leaflet-based viewer
7 Set up your QTiles dialogue
When complete, navigate to the directory selected.
Each folder represents a zoom level. Every folder has more tiles than the one before (increment by a factor of 4)
8 Access the created raster tiles from the selected directory
In the selected directory, open the QTiles.html file to view the tiles using the Leaflet web mapping library.
Caching Raster Tiles
Rendering raster maps is performed on the server side rather than the client side (user). This makes it faster and less dependent on device processing power. Caching is a technique that saves query results for future use. It allows the server to provide query results immediately after a user makes requests, without performing the query on the server.
Caching reduces the number of tasks performed on the GIS database servers. For altimetry maps, street maps, and other frequently changed maps, the cache data must be updated regularly.
Using Content Delivery Network (CDN)
Delivering raster maps on a web application will require massive processing power on the server side. This need is served by a CDN by replicating and delivering static content on the go. Adopting a CDN for content delivery aids the performance of web applications when working at scale.
Web mapping applicants take advantage of the large distribution of caching servers. Here are some services to consider:
Use Cases of Raster Maps
Raster tiles are widely adopted in the mapping world. Here are some popular use cases:
- Elevation data
- Satellite images
- Precipitation maps
- Topographic maps with hill-shades
- Live traffic data
- Land use/land cover maps
Advantages of Raster Tiled Maps
- Map rendering is relatively faster as it does not depend on the user’s device.
- It offers partial offline access using cache storage.
- An easy caching process on Content Delivery Network (CDN)
- Raster files have larger file sizes than vector tiles.
- Maps are not interactive enough. Features such as panning and rotating a map simultaneously rotates the text.
- Individual map elements cannot be excluded
- High internet speed is required to avoid pixelized images on zoom
- Individual locations on the map are not clickable.