What a machine does with it

A vector tile has an integer grid

Six essays on this ladder treat a vector tile as the thing a raster tile is not: geometry, resolution-free, styled at draw time. Its coordinates are integers on a lattice 4,096 units across a tile, the tile halves at every level, and at 55° north one unit is 88 metres at zoom 6 and 21 millimetres at zoom 18.

A vector tile is chosen over a raster one for a reason everybody can state: the geometry survives. A raster tile is a picture, fixed at the resolution it was rendered at, and its pixel is a place with a size. A vector tile carries the lines themselves, so the client can restyle them, label them, query them, and draw them at whatever resolution the display has — which is why a screen map is a pyramid of tiles that a vector format was supposed to free from resolution.

The lines it carries are integers. The convention every implementation follows puts a tile’s own extent at 4,096 units across, so a coordinate inside a tile is a whole number between 0 and 4,096 — and the tile is a different size at every zoom level and a different amount of ground at every latitude, because the scale of a screen map is not one number.

One unit of a vector tile, in metres of ground. A vector tile's coordinates are integers on a lattice 4096 units across the tile, and the tile halves at every level, so one unit is a distance that halves too: 5.48 m at z10 and 0.086 m at z16, at 55°. It is also a different distance at every latitude, by cos φ, because the tile is in Web Mercator — the same factor that makes a grid metre a different quantity of ground at every latitude, arriving in the file format rather than in the projection.
Fig. 1 One unit of a vector tile, in metres of ground, on log axes. It halves exactly with each zoom level — checked against 2^Δz to nine figures — and it is cos φ smaller on the ground at high latitude, because the tile is in Web Mercator. At 55° north one unit is 87.7 m at zoom 6, 1.37 m at zoom 12 and 21 mm at zoom 18.

The arithmetic of a unit

A tile at zoom z spans 2πR / 2^z of the Web Mercator plane — 9,784 m at zoom 12 — and the extent divides that into 4,096. So one lattice unit is

2πR / (2^z · extent)

of map, and multiplying by cos φ gives ground. There is nothing surprising in the formula and every number in it is a convention: 4,096 is a convention, 256 pixels per tile is a convention, and the doubling is a convention. What is not a convention is that the result is a distance, and that the geometry is snapped to it.

Two consequences follow immediately and neither is usually stated when a vector tile is described as resolution-free.

The first is that the same geometry is a different geometry at every level. Zoom 12’s lattice and zoom 13’s are different lattices; a vertex lands on a different ground point in each; and the two tiles’ versions of one feature are not the same shape.

The second is that below some level a feature has no width. Not a small width — none, because both of its sides quantise into the same lattice column.

What the shape does across the pyramid

A vector tile is not scale-free. The same 300-metre ring, quantised to the lattice of each zoom level. Its area is different at every one of them, by 0.27, -0.80, -0.01, -0.02, 0.01 per cent, and at z6, where one unit is 88 metres, 40 of its 64 vertices land on top of another. The promise a vector tile is chosen for is that the geometry survives and the styling is decided later. The geometry is a different geometry at every level.
Fig. 2 The same 300-metre ring, quantised to the lattice of five zoom levels. Its area is different at every one: +0.27, −0.80, −0.01, −0.02 and +0.01 per cent, with no pattern in the sign. At zoom 6, where one unit is 88 m, forty of its sixty-four vertices land on top of another and the ring has twenty-four distinct points left.

The area wandering both ways is the same finding the generalisation ladder reached about a simplification tolerance, arriving from the encoding side. A quantisation moves each vertex to the nearest lattice point, which is a displacement of up to half a unit in each direction with no preferred sign, so the enclosed area is perturbed by a quantity that is as likely to be positive as negative. There is no correction.

The vertex merging is the sharper effect. Forty of sixty-four vertices gone is not a loss of precision, it is a change of object: the ring has become a twenty-four-sided polygon with several zero-length edges in it, and a zero-length edge is a degenerate segment that some geometry code handles and some does not, and it breaks the containment test before it breaks anything visible.

Below this level the feature has no width at all. The highest zoom at which one lattice unit is still wider than the feature, so that below it the feature's two sides quantise into the same column. Not a small width: none. A fourteen-metre river is a polygon at z16 and a line of zero area at z8, and nothing stored in the tile records which it was — the collapse happens in the encoder, after every decision about what to keep has been made.
Fig. 3 The highest zoom at which one lattice unit is still wider than a feature, so that below it the feature’s two sides quantise into the same column. A fourteen-metre river is a polygon at zoom 9 and a line of zero area at zoom 8, and the transition is a level lower at 75° than at the equator because the lattice is finer there.

The latitude dependence in that table is the one nobody plans for. A two-metre feature survives to zoom 12 at the equator, zoom 11 at 55° and zoom 10 at 75°: the lattice is finer on the ground at high latitude, so features survive to coarser levels there. A rule of thumb for “the zoom at which this class of feature disappears” is therefore a rule of thumb that is wrong by one or two levels depending on where the feature is.

Two resolutions, and only one of them is the point

The confusion this rung exists to clear up is between two different resolutions a tile carries, which are easy to conflate because both are measured in ground metres.

The level of detail is a modelling decision: which features appear at which zoom, and how much they are generalised. It is documented, it is configurable, it is what a cartographer works on, and it is the thing the tile scheme exists to manage.

The lattice is not a decision at all in the same sense. It is a property of the container, applied after every other decision, and it is the same 1/4,096 of a tile whether the tile carries a country outline or a kerb line. It is chosen once, for the format, on an argument about display pixels.

For most levels the second is far finer than the first and can be ignored: at zoom 14 the lattice is 34 cm at 55° and no generalisation tolerance is anywhere near that. At the coarse end they cross over. At zoom 6 the lattice is 88 m, which is a serious quantity of ground and is comparable to the tolerances used there — so at the levels where the geometry has been most reduced, the container is also doing some of the reducing, and the two are not distinguishable in the output.

The scale asked for and the scale the pyramid has, at 0°. A tiling scheme exists only at integer zoom levels, a factor of two apart in resolution, so a request for any scale between them is answered by the nearest rung. The ratio runs from 0.707 to 1.405 — 1/√2 to √2 — and repeats identically at every doubling, which is four times that in area. A request for 1:10,000 is served at zoom 16, which is 1:8,531; A request for 1:25,000 is served at zoom 14, which is 1:34,124; A request for 1:50,000 is served at zoom 13, which is 1:68,247. Nothing anywhere reports it, because the map that arrives is a perfectly good map of something.
Fig. 4 The pyramid’s own ladder from earlier in this collection, for comparison. Every level here is a decision somebody made about what to show. The lattice is the row underneath it that nobody made a decision about, and at the top few levels it is the same order of magnitude.

The seam, which is not about the lattice

The obvious worry about tiling is that neighbouring tiles will not agree at their shared edge. For the lattice itself that worry is unfounded: tile boundaries are at multiples of the tile size and the extent divides evenly, so the lattices of adjacent tiles at the same zoom are aligned and a vertex on the boundary encodes identically in both.

The disagreement is elsewhere, and it is the generalisation.

The seam, where two tiles were generalised separately. A line crossing a tile boundary, 801 vertices over 4.0 km. Simplified as one line at ε = 20 m it keeps 19 vertices; simplified inside each tile — which is how a tile is made, because a tile is generalised as a tile — it keeps 18, and the two answers separate by 15.1 m of ground, 76 per cent of the tolerance, on top of the tolerance. The lattices of the two tiles are aligned and encode the shared vertex identically; what disagrees is what each tile decided to keep.
Fig. 5 A line crossing a tile boundary, 801 vertices over four kilometres. Simplified as one line at ε = 20 m it keeps 19 vertices; simplified inside each tile — which is how a tile is made, because a tile is generalised as a tile — it keeps 18, and the two answers separate by 15.1 m of ground. That is 76 per cent of the tolerance, on top of the tolerance.

A tile is produced from the data that falls in it. The generalisation therefore runs on a piece of the line, with the piece’s own endpoints pinned at the tile boundary, and Douglas–Peucker’s recursion splits at the vertex furthest from the chord between whatever endpoints it was given. Different endpoints, different split, different survivors — which is the same non-commutation the generalisation ladder measured, applied to a cut rather than to a projection — and the two tiles’ answers do not join into the line that would have been produced by generalising the whole.

The effect is not a discontinuity at the seam. Both tiles honour the shared vertex, so the drawn line is continuous. What differs is the interior of each piece, by a distance comparable to the tolerance, so a feature that spans a tile boundary is drawn slightly differently from the way it would have been if the boundary had fallen elsewhere — and it will fall elsewhere at the next zoom level.

This is the tile-boundary problem rung four of this ladder identified for labels and symbols, appearing in the geometry itself. There the fix is a buffer; here a buffer does not help, because the trouble is not that the tile lacks data outside itself but that it decided what to keep without it.

What was computed, and how

The quantisation is done in the Web Mercator plane in metres, rounding to multiples of the lattice step measured from the world origin — which is what a tile-local integer amounts to once the tile’s own offset is added back — and decoded through the inverse Mercator to get the ground position.

That decoding is where the one bug in this rung’s machinery lived, and it is worth stating because it produced entirely plausible output. The northing was computed by taking the Mercator formula’s result and multiplying by the Earth’s radius a second time; the decoding divided by it again, so a round trip was exact and the quantisation in between happened at a step 6.4 million times too fine. The result was a ladder in which the lattice halved correctly, the ground distances were right, and no vertex ever merged with another. Every number was defensible and the effect the essay is about had been scaled out of existence.

The check that caught it is the one the essay’s third figure now runs as an assertion: at a lattice step of 88 metres, a ring 300 metres across must lose vertices. An arithmetic that says otherwise is wrong about something, and the failure was invisible until a quantity was predicted before it was measured.

A file stored to 5 decimal places, drawn at zoom 12. Which of the two quantisations is the coarser, against latitude. East–west the answer never changes: a degree of longitude shrinks as cos φ and a Mercator pixel covers ground as cos φ, and it is the same cos φ, so the ratio is flat to 0.33 per cent — and what is left of it is N(φ)/a, the ellipsoid, rather than arithmetic. North–south the two cross at 88.3°: below it the file is the limit on where a vertex can be, above it the screen is.
Fig. 6 The neighbouring question this ladder has already answered: where the geographic and the projected quantisations cross over. A vector tile’s lattice is a third quantisation on top of both, applied last, and it is the only one of the three that changes with the zoom level rather than with the data.
The tile pyramid, four levels down to quadkey 120. The world as a square, quartered three times. Each level's tile is exactly half the width of its parent, so a tile is four tiles at the next level and never needs resampling to serve one — the property the whole scheme rests on, and one that holds only because the projected world is square. Level 3 has 64 tiles at 19567.9 metres per pixel, which at 55° north is 11223.7 metres of ground per pixel rather than the number the scheme publishes.
Fig. 7 The pyramid the lattice sits inside. Each level has four times the tiles of the one above and the same 4,096 units in each of them, so the total number of representable positions quadruples with every level — which is the sense in which a vector tile is resolution-free, and it is a statement about the pyramid rather than about any tile in it.

What a client can do about it

A reader who has to consume vector tiles rather than produce them has three options and they are worth ranking.

Read at the finest level available. The lattice halves with zoom, so a geometry pulled from zoom 16 is quantised sixty-four times more finely than the same feature at zoom 10. If a measurement is being made from tile data, the level it is made at is part of the measurement, and the finest level is the least wrong one. It is also the most tiles.

Do not measure from tiles at all. Areas, lengths and containment tests belong to the source geometry, and a well-built service publishes that separately for exactly this reason. The tile pyramid is a rendering artefact and treating it as a data product is the underlying mistake that all of this is a symptom of.

And where a measurement must come from tiles, report the level with it. A length from zoom 12 and a length from zoom 14 are different numbers about the same feature, and stating which one produced the figure is the same discipline a ruler measurement needs — a quantity with no limit as the resolution improves is not a property of the object.

The corresponding instruction for a producer is shorter: the extent is configurable, and a tile carrying geometry that will be measured rather than only drawn should raise it. Doubling the extent to 8,192 costs one bit per coordinate and halves every quantisation effect in this essay.

Raising the extent buys a zoom level, and costs a bit

The producer’s instruction at the end of the last section — raise the extent — is worth stating as the equivalence it is, because the two things it trades against each other are usually thought of as unrelated.

The lattice step is 2πR / (2^z · extent), so z and log₂(extent) enter it identically. Doubling the extent from 4,096 to 8,192 gives exactly the lattice of the next zoom level down, at every latitude, to the last bit.

The costs are not remotely the same. Serving one level deeper means four times the tiles, four times the requests and four times the storage across the pyramid. Doubling the extent means one more bit per coordinate — under ten per cent on a varint-encoded delta, since the deltas between successive vertices are small and gain one bit only when they cross a byte boundary. The same lattice, for a tenth of the cost, and the reason nobody does it is that the extent is a default in a specification and the zoom level is a knob a service operator turns.

The arithmetic behind the default is worth checking while it is in hand. Four thousand and ninety-six units across a 256-pixel tile is sixteen units per pixel, so a vertex is placed to a sixteenth of a pixel rather than the quarter usually quoted — a comfortable margin, and one that narrows on modern displays: at a device pixel ratio of two the tile is drawn across 512 physical pixels and the margin is an eighth, and at three it is a twelfth.

That still leaves the lattice far below what a display resolves, which is exactly the specification’s argument and exactly its limit. The margin is generous for drawing and irrelevant to measuring, and the sixteenth of a pixel says nothing about the 88 metres of ground the same lattice is worth at zoom 6. A resolution argued in pixels answers a question about pictures, and the essay’s whole subject is the questions that are not about pictures.

Where the model stops

One extent and one projection. Four thousand and ninety-six units is the near-universal convention and Web Mercator is the near-universal projection, and both are inputs here. A tile scheme in another projection has the same lattice and a different latitude dependence — an equal-area tiling’s units would be constant on the ground and variable on the page, which is the trade the other way round.

Nothing here measures what it buys. The whole point of a coarse lattice is that small integers compress well, and the byte saving from quantising at 4,096 rather than storing doubles is the reason the format is usable at all, in the same way that the square world costs the poles and buys everything else. That saving is real and large and is not weighed against these costs anywhere in this essay.

Nothing is said about attributes. A tile carries feature properties as well as geometry, and those are quantised too — numbers are stored to a stated precision, and a value that varies below it becomes a constant. That is the same failure in a different column and it is not measured here.

And the merging measured is of one ring. How many vertices merge depends on the vertex spacing relative to the lattice step, which is a property of the data. What is general is the threshold — a feature narrower than one unit has no width — and that is arithmetic rather than an experiment.

The generalisation

A format’s storage decision is a modelling decision, and it is made after every modelling decision anybody documented. The projection was chosen, the generalisation tolerance was chosen, the level of detail was chosen — and then the encoder quantised, at a resolution nobody in that chain selected, because it is a property of the container.

The pattern is the one every fixed-point representation produces. An audio file’s bit depth is a floor on what can be represented and it is chosen for file size; a colour image’s eight bits per channel is why banding exists in gradients that were smooth in the source. In each case the quantity that suffers is not the one the format’s description talks about.

What the tile case adds is the interaction with the pyramid. An audio file has one bit depth. A tile pyramid has a different lattice at every level, so the same feature is represented at a dozen different resolutions and none of them is the source. Anything read back from a tile — an area, a length, a containment test — is read from whichever level the client happened to have loaded, and the answer depends on the zoom the user was at.

Who found it, and when

The vector tile specification that made the convention universal is Mapbox’s, first published in 2014, and it fixes the extent at 4,096 by default while allowing others. The choice is well reasoned in the specification itself: 4,096 is 2¹², so twelve bits per coordinate, and it is four times a 256-pixel tile’s resolution, so a vertex can be positioned to a quarter of a pixel — which is below what a display can resolve and is therefore, at the zoom the tile is drawn at, invisible.

That reasoning is correct and complete for the purpose it states. The gap is that the tile is not only drawn at the zoom it was built for. It is drawn when over-zoomed, which this ladder has already measured; it is queried; and its geometry is read back by software that has no idea what lattice it came off.

The zero-width feature is old news in raster cartography, where it is called the minimum-drawable-dimension and has been in specifications since the nineteenth century — a stream narrower than the pen that draws it becomes a single line by convention, and the convention is documented. The vector-tile version happens silently in an encoder.

Where the ladder goes next

This rung is about a resolution the format imposes. The cells ladder next door has a debt of a different kind: it measured what moving a field between two grids costs, using two schemes whose cells are rectangles in the same coordinate — which is what made every overlap a rectangle, and which is not true of any of the schemes anybody actually argues about.

Named alongside this one

Essays reaching for the same objects. Nobody chose these; they are what the concept index makes visible.

What links here

Every essay whose body links to this one.

The objects this essay names

Each one links to every other essay that touches it.

GeneralisationGround resolutionLatticePrecisionQuantisationResolutionSeamTile pyramidTopologyVector tileWeb MercatorZoom