Skip to content

Read 0-based BSB palettes, and bake from a caller-owned list - #56

Merged
beetlebugorg merged 2 commits into
mainfrom
feat/chart-scan
Aug 11, 2026
Merged

Read 0-based BSB palettes, and bake from a caller-owned list#56
beetlebugorg merged 2 commits into
mainfrom
feat/chart-scan

Conversation

@beetlebugorg

Copy link
Copy Markdown
Owner

Two changes, both needed to import raster charts from a host.

A BSB palette numbered from 0 crashed the bake. BSB numbers its palette from 1, so the parser indexed palette[idx - 1]. One sheet in 968 of a US West Coast set hit it. The header now records which number the file gave its first entry, and both places that read a colour index by it; pixel value 0 stops being treated as "no data" on those sheets. Tested both conventions.

tile57_bake_files and tile57_bake_rasters bake a caller-supplied list to caller-supplied paths, the counterpart to tile57_bake_tree. The caller owning the list is the point: label can name a finished chart by index so no string crosses the ABI, and a host that wants the coarse charts first sorts its own list that way, which is what makes a partly finished bake usable. The raster half writes partition.tpart beside the archives, as the CLI does, so a host does not rebuild the quilt at every open. A chart that will not bake is skipped rather than fatal — a BSB set routinely carries a sheet with no georeference.

tile57_info.is_raster tells a raster archive from a vector chart. Both open and both carry coverage and a scale, and tile_type cannot carry the difference because TILE57_TILE_TYPE_MLT is 2 and 2 is PNG in the PMTiles header. Without it a host composes an RNC as vector tiles.

Verified against 968 KAP sheets: all bake, 966 archives (two share a stem), and the two refusals are sheets with no georeference.

@beetlebugorg
beetlebugorg merged commit a1deb5e into main Aug 11, 2026
5 checks passed
@beetlebugorg
beetlebugorg deleted the feat/chart-scan branch August 11, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant