roads at z5–z6 is the other half of coarse-zoom tile weight #10

Closed
opened 2026-08-01 19:12:55 +00:00 by art-bot · 1 comment
Collaborator

The z5 tile covering all of Sweden carries 17 644 road segments (430 kB) even though
the zoom filters have already reduced it to motorway + trunk. That is simply how much
motorway and trunk there is in two countries.

Thinning further means one of:

  • dropping trunk at z5 (a cartographic decision — at z5 a country is a few hundred
    pixels wide, so arguably only motorways belong);
  • simplifying line geometry much harder at the bottom of the cascade (simplify_line
    tolerance is pixelSize / 2 everywhere today).

Measure before choosing. Decode the z5 tile and see whether the bytes are feature count
or vertex count — the two options attack different halves, and the answer probably differs
between Sweden (sparse, huge) and Poland (compact, dense).

Related: the railways issue is the larger win in the same tile. Background:
docs/performance.md.

The z5 tile covering all of Sweden carries **17 644 road segments (430 kB)** even though the zoom filters have already reduced it to motorway + trunk. That is simply how much motorway and trunk there is in two countries. Thinning further means one of: - dropping `trunk` at z5 (a cartographic decision — at z5 a country is a few hundred pixels wide, so arguably only motorways belong); - simplifying line geometry much harder at the bottom of the cascade (`simplify_line` tolerance is `pixelSize / 2` everywhere today). **Measure before choosing.** Decode the z5 tile and see whether the bytes are feature count or vertex count — the two options attack different halves, and the answer probably differs between Sweden (sparse, huge) and Poland (compact, dense). Related: the `railways` issue is the larger win in the same tile. Background: `docs/performance.md`.
Author
Collaborator

Fixed on main as c8621b0.

Measured first, as the issue asked — and the answer rules out both options it lists.
Both "drop trunk at z5" and "simplify harder" attack vertex count. The bytes were
feature count: roads carries 2.00 points per feature at z5, z6 and z7 in both
large countries (78 003 features for Sweden at z5, 22 701 for Poland). The layer is not
over-detailed, it is over-divided — the same disease as #9, and merge_lines is the
same cure. No cartographic decision about trunk was needed.

New merge_from_zoom, set to 12. The boundary is a data fact, not a budget — and the
caveat I left in CLAUDE.md after #9, that ST_Collect would need a spatial split, was
simply wrong. GEOS merges Sweden's whole 2.19M-row z13 table in 12 s and Poland's largest
z14 group (3.23M rows, 37M points) in 21 s. The real reason not to go higher is that the
merge has nothing to do up there: that 3.23M-row service group yields 2.93M chains — a
9% return for ~9 GB of backend memory — because driveways and parking aisles do not
join end to end. One zoom lower the z13 filter has dropped the class, and the same
operation returns 11×.

tile before after
z5 17/10 (C. Europe) 358 kB 11 kB
z5 17/9 (Nordic) 420 kB 9 395 B
z6 34/19 (PL) 306 kB 7 444 B
z8 143/84 (PL) 149 kB 8 366 B
z11 Stockholm 304 kB 30 kB
z12 Stockholm 188 kB 41 kB
SE z5 78 003 features 470

Whole-tile across this and #9: z5 over central Europe 790 kB → 529 kB → 182 kB, z11
over Stockholm 370 kB → 95 kB.

Verified by rendering the same camera over Poland at z6 before and after and diffing the
images: 2.5% of pixels differ and every one is on the edge of a line — same network,
same routes, no gaps. 306 kB of that tile was the cost of drawing an identical picture out
of 40× more features. The ~21% of motorway length that parallel_merge_pixels: 1
removes is the second carriageway of a dual carriageway; Iceland, which has almost none,
loses 0.1%, and only 39 km of Sweden's 10 195 km of motorway ends further than one pixel
from a drawn line.

Follow-ups filed from what this exposed: the coarse-tile leader is now cover, and
waterways/transit have the identical 2.0-points-per-feature signature.

Fixed on `main` as c8621b0. **Measured first, as the issue asked — and the answer rules out both options it lists.** Both "drop `trunk` at z5" and "simplify harder" attack vertex count. The bytes were feature count: `roads` carries **2.00 points per feature at z5, z6 *and* z7** in both large countries (78 003 features for Sweden at z5, 22 701 for Poland). The layer is not over-detailed, it is over-*divided* — the same disease as #9, and `merge_lines` is the same cure. No cartographic decision about `trunk` was needed. New `merge_from_zoom`, set to 12. **The boundary is a data fact, not a budget** — and the caveat I left in CLAUDE.md after #9, that `ST_Collect` would need a spatial split, was simply wrong. GEOS merges Sweden's whole 2.19M-row z13 table in 12 s and Poland's largest z14 group (3.23M rows, 37M points) in 21 s. The real reason not to go higher is that the merge has *nothing to do* up there: that 3.23M-row `service` group yields 2.93M chains — a **9% return for ~9 GB of backend memory** — because driveways and parking aisles do not join end to end. One zoom lower the z13 filter has dropped the class, and the same operation returns **11×**. | tile | before | after | |---|---|---| | z5 17/10 (C. Europe) | 358 kB | **11 kB** | | z5 17/9 (Nordic) | 420 kB | **9 395 B** | | z6 34/19 (PL) | 306 kB | **7 444 B** | | z8 143/84 (PL) | 149 kB | **8 366 B** | | z11 Stockholm | 304 kB | **30 kB** | | z12 Stockholm | 188 kB | **41 kB** | | SE z5 | 78 003 features | 470 | Whole-tile across this and #9: **z5 over central Europe 790 kB → 529 kB → 182 kB**, z11 over Stockholm 370 kB → 95 kB. Verified by rendering the *same camera* over Poland at z6 before and after and diffing the images: 2.5% of pixels differ and every one is on the **edge** of a line — same network, same routes, no gaps. 306 kB of that tile was the cost of drawing an identical picture out of 40× more features. The ~21% of motorway *length* that `parallel_merge_pixels: 1` removes is the second carriageway of a dual carriageway; Iceland, which has almost none, loses 0.1%, and only 39 km of Sweden's 10 195 km of motorway ends further than one pixel from a drawn line. Follow-ups filed from what this exposed: the coarse-tile leader is now `cover`, and `waterways`/`transit` have the identical 2.0-points-per-feature signature.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
art/ismap#10
No description provided.