Whole file
protomaps/pmtiles
The author described this change as “python writer: fix logical error when a packed leaf directory overflows [#37]”. It counts as a record because the check below fails on the code as it stood at a32947688 and passes on df8256f10, with nothing else changed between the two runs.
Projectprotomaps/pmtiles
Fix saved2022-03-20
Sharing licenceBSD-3-Clause · LICENSE
Change size+1 −2
What the code was meant to do, written into the code itself as a save note
python writer: fix logical error when a packed leaf directory overflows [#37]
The change
| 39 | 39 | ||
| 40 | 40 | for group in itertools.groupby(entries_in_leaves,key=by_parent): | |
| 41 | 41 | subpyramid_entries = list(group[1]) | |
| 42 | + | root = subpyramid_entries[0] | |
| 42 | 43 | if len(packed_entries) + len(subpyramid_entries) <= max_dir_size: | |
| 43 | 44 | # the first item MUST be the root of the pyramid (sorted) - but it may have multiple roots | |
| 44 | - | root = subpyramid_entries[0] | |
| 45 | 45 | packed_entries.extend(subpyramid_entries) | |
| 46 | 46 | packed_roots.append((root.z,root.x,root.y)) | |
| 47 | 47 | else: | |
| 48 | 48 | # flush the current packed entries | |
| 49 | - | root = packed_entries[0] | |
| 50 | 49 | ||
| 51 | 50 | for p in packed_roots: | |
| 52 | 51 | root_entries.append(Entry(p[0],p[1],p[2],current_offset,17 * len(packed_entries),True)) |
The check that tells the two apart
fail→pass·python/test/test_writer.py::TestTilePyramid::test_leafdir_overflow
Check file python/test/test_writer.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before ita32947688adede92a2d3ad4032dc798730af58f7
Broken version dated2022-03-17
Modulepython.pmtiles.writer
Units changedmake_pyramid
Fingerprint0c5d001e1e2ab9eb
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.