Skip to content

Support GeoTIFF raster layers in the library - #307

Merged
frewsxcv merged 2 commits into
mainfrom
feat/library-raster-layers
Oct 9, 2026
Merged

frewsxcv merged 2 commits into
mainfrom
feat/library-raster-layers

Conversation

@frewsxcv

@frewsxcv frewsxcv commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

The app could already load and render GeoTIFF rasters from a file, but every library entry was loaded as GeoJSON because the format was hardcoded in render_add_layer_window.

  • rgis-library: Entry::format() derives the format from the URL extension (.geojson / .tif / .tiff), so existing entries don't need a new field. A test makes sure every entry has a recognized extension.
  • rgis-ui: AddLayerOutput::LoadFromLibrary now carries a file_format, which is passed to LoadFileMessage::FromNetwork instead of GeoJson. Entries with an unknown format get a disabled Add button.
  • Two new entries under World: "Shaded Relief" (grayscale) and "Natural Earth Shaded Relief" (color).

Raster files

Both come from Natural Earth's 50m rasters (10800×5400, stored in strips). The GeoTIFF loader only reads tiled files, so I downsampled them to 4096×2048 and converted them to tiled COGs (512px blocks, no overviews):

File Compression Size
World/Shaded-Relief.tif DEFLATE + predictor 2 1.6 MB
World/Natural-Earth-Shaded-Relief.tif JPEG at quality 85 (YCbCr) 1.2 MB

Both files are already uploaded to the rgis-library bucket and can be downloaded from their public URLs.

Testing

  • cargo test -p rgis-library passes.
  • Both files load through geo_raster::GeoTiffSource as 4096×2048 rasters with EPSG:4326 and a full-world extent. The JPEG file's average R/G/B values match gdalinfo -stats to within 0.1, so the YCbCr colors decode correctly.
  • In the native debug build, "Natural Earth Shaded Relief" loaded from the library with no errors: 250 ms to download, 1.0 s to decode (unoptimized build).
  • There is no Playwright test yet for adding a raster from the library.

Library entries previously always loaded as GeoJSON. Entries now derive
their format from the URL extension, and the format is passed through
LoadFromLibrary to the network loader, which already routes rasters to
the GeoTIFF loader.

Adds two World rasters (Natural Earth 50m shaded relief, grayscale and
color), hosted as 4096x2048 tiled COGs in the rgis-library bucket, and a
test that every library entry has a recognized format.
@frewsxcv
frewsxcv added this pull request to the merge queue Oct 9, 2026
Merged via the queue into main with commit 11c2065 Oct 9, 2026
3 checks passed
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