Raster Tiles and Vector Tiles
🎯 Introduction
By the end of this article, you will be able to choose raster or vector tiles based on display and interaction requirements.
🖼 Raster Tiles
A raster tile is an image that has already been rendered, commonly in PNG, JPEG, or WebP format. PNG suits line and polygon layers requiring transparency; JPEG suits photographic imagery; WebP often provides smaller web images, depending on service support.
Raster tiles move cartographic rendering to the server. The frontend can display the returned images directly, making them suitable for basemaps and thematic maps that do not require client-side attribute access.
Roads, labels, and colors in the image are already pixels. The frontend can display them but cannot directly read a road’s attributes from the image.
🧩 Vector Tiles
A vector tile stores points, lines, polygons, and selected attributes within a small extent. MVT is a common vector tile specification, and PBF is a commonly used binary encoding for transmission.
Vector tiles separate data from styling: the frontend can color the same road data by classification or hide it at certain zoom levels, while transferring only objects in the current extent.
The frontend can dynamically change colors, widths, and visibility levels based on attributes. However, an object may be split across tiles, so a tile’s geometry may not contain its complete boundary.
📦 Why Not Use One Huge GeoJSON File?
A huge GeoJSON file downloads, parses, and stores objects outside the viewport too. Vector tiles divide data by extent and zoom level, requesting finer detail when zoomed in and allowing aggregated or simplified data when zoomed out.
| Requirement | Choice |
|---|---|
| Display only a background or imagery | Raster tiles |
| Style dynamically by attributes | Vector tiles |
| Query complete objects or perform precise analysis | Vector tiles plus a details API, or a spatial service directly |
🧾 Summary
- Raster tiles return images; vector tiles return small blocks of vector data.
- PNG, JPEG, and WebP are raster image encodings, not coordinate systems.
- MVT specifies vector tiles; PBF is commonly used for transmission.
- Vector tiles suit display but do not necessarily contain complete objects.
❓ Knowledge Check
Q1: Can vector tiles fully replace GeoJSON?
No. They suit map display and local interaction. Complete exports, editing, and analysis still require complete data.
🧪 Exercise
Choose a data source for “display imagery,” “color roads by classification,” and “calculate complete road lengths.” Explain each choice.
// Write your code here
🎉 You can now distinguish the two common map tile types!
