Repository navigation
Raster band selection, config legend classes and unscale (#357, #350) - #427
Merged
Merged
Conversation
A raster asset can now set bidx to pick the band of a multi-band COG, and the band's STAC nodata and classes are read from that band. Config legend_classes now replace the STAC classes on a raster, as they do on a vector, so a class can be left out of the colormap; a class whose value is the band's nodata is always left out. When STAC gives a band scale or offset, the tile URL asks TiTiler to unscale, so rescale and the legend are in real units; config unscale overrides. The two tile URL builders are now one function, which also accepts #-prefixed colors and warns when an inline colormap makes the URL too long.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #357. Closes #350.
Band selection (#357). A raster asset can set
bidx(1-based) to pick the band of a multi-band COG. Without it, TiTiler refuses a multi-band source and every tile fails with a 500. The band's STACnodataandclassification:classesare now read from the chosen band rather than always band 1.Legend classes on rasters (#350). Config
legend_classesnow replace the STAC classes on a raster, as they already did on vectors. They also build the TiTiler colormap, so a class left out renders transparent. A class whose value is the band's nodata is always left out, which removes fill classes such as NLCD 250 without any config. Colors may be given as#RRGGBBor STACRRGGBB.Unscale. When a band's STAC entry gives a
scaleother than 1 or anoffsetother than 0, the tile URL adds&unscale=true, sorescaleand the legend are in real units. A configunscale: true|falseoverrides this. This was needed for the NOAA Coral Reef Watch COGs (int16 in hundredths of a degree) in bosl-high-seas. I checked against TiTiler:/cog/inforeportsscales: [0.01]forssta-latest.tif, and a tile withunscale=true&rescale=-1,4returns 200.The two TiTiler URL builders (versioned and plain) are now one function,
cogTileUrl. It warns on the console when an inline colormap makes the URL longer than 8,000 characters (an 832-class EVT colormap made 47 kB).Migration. For a raster whose STAC declares a scale or offset,
rescaleis now read in real units. An app with such a layer must change itsrescaleor set"unscale": falsewhen it bumps its pin. The bosl-high-seas session checked all 60 of that app's raster collections and none declares a scale or offset, so only its new CRW layers are affected.The docs' raster options table now has rows for
bidx,unscaleandlegend_classes.Tests: nine new cases in
test/dataset-catalog.test.js.