Skip to content

Read, bake and quilt raster charts - #48

Merged
beetlebugorg merged 5 commits into
mainfrom
feat/raster-charts
Aug 6, 2026
Merged

Read, bake and quilt raster charts#48
beetlebugorg merged 5 commits into
mainfrom
feat/raster-charts

Conversation

@beetlebugorg

Copy link
Copy Markdown
Owner

tile57_raster_chart is a peer of tile57_chart: it serves tiles and nothing else, so there is no portrayal to run, no pick to answer and no view to render. MBTiles opens in place through the vendored SQLite amalgamation, read-only and mmapped, so a half-gigabyte file never becomes resident.

The reader corrects four things SQLite does not: it flips the TMS row to XYZ, ignores the zoom range in the file name, computes absent zoom and bounds from the tile index, and reads the tile size from a picture header. A missing tile is NULL with TILE57_OK — about a third of the ground inside a coastal pyramid's own bounds carries no tile.

raster.bsb reads a BSB/KAP sheet and tile57 bake writes it to the same structure the ENC bake writes, carrying the sheet's PLY border, KNP/SC scale and CED date. The georeferencing comes from fitRefs over the sheet's REF points, not the published PWY polynomial, which misses its own control points by 7 km on the North Pacific sheet. The fit is ellipsoidal and bivariate: the spherical form leaves 37 times the residual, and NOAA's skewed plotting sheets defeat a per-axis fit by 0.9°. A sheet whose fit cannot reproduce its own control points is refused by name.

tile57_compose_rasters quilts them through the same ownership partition vector charts use — same scale bands, same date tie-break. A chart declaring no scale owns no ground and is skipped. One compositor holds one kind.

mariner.chart_over_image drops the DEPARE, DRGARE, UNSARE and LNDARE fills for the outputs with no depth buffer, and engages the S-52 §10.3.4.2 DisplayPlane precedence. tile57_mariner_image_dim gives the dim factor so a daylight photograph does not destroy dark adaptation at night.

tile57 raster info prints what a chart declares beside what its name claims.

Also here. The sprite shaders discard a fully transparent fragment. --soundings and --no-soundings on the png CLI.

A raster chart is a chart made of pictures. tile57 reads two kinds.

An MBTiles opens in place: SQLite reads it read-only with PRAGMA mmap_size, so
a half-gigabyte file never becomes resident. The reader inverts the TMS row,
calculates a zoom range and bounds the file omits, reads the tile size from a
picture header, and ignores the file name — two measured charts declare
minzoom 9 and maxzoom 17 and are named Z10-Z18.

A BSB/KAP sheet bakes. fitRefs calculates the georeferencing from the sheet's
control points, ellipsoidal and bivariate: the published PWY polynomial misses
its own points by 7 km on a 1:10,000,000 sheet, spherical Mercator leaves 37
times the residual, and NOAA publishes sheets skewed 31 degrees. The bake
applies the datum shift, warps to web mercator, clips to the PLY border, and
writes the archive the ENC bake writes, with the PLY as coverage, KNP/SC as the
compilation scale and CED as the date key. A sheet is refused when the fit
misses its own control points.

The scale decides the quilt. A baked sheet gives one and composes through the
ownership partition by scale band and date. An MBTiles gives none, owns no
ground, and the compositor skips it.

mariner.chart_over_image removes the DEPARE, DRGARE, UNSARE and LNDARE fills so
a raster chart below shows through, and keeps the contours, symbols, lights,
soundings, text and pattern boundaries. It engages the S-52 10.3.4.2
DisplayPlane precedence, which applies when an image is below the chart.
imageDim gives the dim factor for the colour scheme.

tile57_raster_chart_* opens a raster chart and gives a tile.
tile57_compose_rasters quilts them; one compositor holds one kind.
tile57 bake takes a KAP or a BSB_ROOT, and tile57 raster info prints what a
chart declares beside what its name claims.

The PNG codec moves beside the tile formats and gains a decoder.
The flags set the mariner soundings switch. Use them to show spot soundings
without the full OTHER category.
The page gives how to read a raster chart, what the reader corrects, why an
absent tile is usual, how the scale decides the quilt, chart over picture, how
to bake a BSB/KAP sheet and how to quilt them.
The raster underlay draws through the sprite pipeline with depth write, to hide
the chart's area fills where a picture covers them. A baked RNC is transparent
outside its neat line, and those pixels wrote depth and cut holes in the chart
below.

Costs nothing for a sprite or a glyph: both draw with depth write off, so this
only skips a fragment that would blend to nothing.
The header, the feature list, the quickstart and the output table. Drops the
WASM claim, which is an implementation detail of the web build and not finished.
@beetlebugorg
beetlebugorg merged commit ff3fb12 into main Aug 6, 2026
5 checks passed
@beetlebugorg
beetlebugorg deleted the feat/raster-charts branch August 6, 2026 02:07
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