Vector tiles accuracy

From Maria GDK Wiki
Jump to navigation Jump to search

Vector tiles is the format used in Maria GDK to display vector data. This format is slightly different from other vector formats because coordinates are expressed in a local tile coordinate system, consisting of 4096x4096 units. This means that the vertexes of source data are "snapped" to the nearest unit in a tile, introducing a small amount of error. For each increasing zoom level, each tile is divided into four, reducing the error introduced. The vector tile format is intended for presentation, and the size of the tile coordinate system was chosen so that the error should always be smaller than the size of a pixel on the screen. Still, it can be useful to know the maximum accuracy of vector vector tiles at various zoom levels. This does not consider the accuracy of the source data in relation to the real-world objects they represent, which is not relevant in this context.

Note that these numbers describe the accuracy of the data stored in a vector tiles file. If the overzoom function is used in an application, the accuracy in meters remains that of the highest zoom level, but it decreases relative to the size of a pixel on screen.

Maximum accuracy versus zoom levels

This table is based on the tile matrix of a GeoPackage with projection EPSG:3857 and GoogleMapsCompatible tiling. Each zoom level has a stated pixel size in meters, and each tile has a size of 256 x 256 pixels. In Maria GDK, a vector tile has the same size as a raster tile in pixels. We can the calculate the "pixel size" of a vector tile by multiplying the raster tile pixel size with the ratio of 256 / 4096.

The maximum error introduced when converting to vector tiles is when the original vertex is located exactly in the middle of four tile units. In this case, the error can be calculated using Pythagoras:

max_error = sqrt((unit_size / 2)**2 + (unit_size / 2)**2)
Zoom level Raster pixel size Vector tile unit size Vector tile max error
0 156543.0339 9783.9396 6918.2901
1 78271.517 4891.9698 3459.145
2 39135.7585 2445.9849 1729.5725
3 19567.8792 1222.9925 864.7863
4 9783.9396 611.4962 432.3931
5 4891.9698 305.7481 216.1966
6 2445.9849 152.8741 108.0983
7 1222.9925 76.437 54.0491
8 611.4962 38.2185 27.0246
9 305.7481 19.1093 13.5123
10 152.8741 9.5546 6.7561
11 76.437 4.7773 3.3781
12 38.2185 2.3887 1.689
13 19.1093 1.1943 0.8445
14 9.5546 0.5972 0.4223
15 4.7773 0.2986 0.2111
16 2.3887 0.1493 0.1056
17 1.1943 0.0746 0.0528
18 0.5972 0.0373 0.0264
19 0.2986 0.0187 0.0132