Repository navigation
Description
Before you start
- I searched the existing issues and the roadmap and did not find a duplicate request.
What problem does this solve?
Many Earth-observation data cubes are published as STAC collections of cloud-optimised GeoTIFFs: one file per tile, per date and per band. Examples are INPE's Brazil Data Cube (BDC) and Sentinel-2 on Earth Search or Planetary Computer. RustGIS already has the two halves:
- STAC Search (
stac.search,stac.addAsset) adds one item's asset as a COG read in place. - The time slider (feat: time slider for layers and dated imagery #543) follows a COG whose address has date placeholders, one file per date.
I tried them together on BDC's Sentinel-2 16-day cube (S2-16D-2): a year of NDVI over Sorriso, Mato Grosso.
- Setup:
layer.addUrlwithhttps://data.inpe.br/bdc/data/s2-16d/v2/020/019/{YYYY}/{MM}/{DD}/S2-16D_V2_020019_{YYYYMMDD}_NDVI.tifand tendates. - Result:
time.exportwrote 10 frames in about 7 s. The crop cycle shows clearly: bare fields in August, soy in January, second-crop maize in May. - What else worked:
stac.searchagainsthttps://data.inpe.br/bdc/stac/v1finds the items. BDC's own Albers projection, which is user-defined in each file's GeoKeys, is read correctly.
It also showed what is missing to use such a cube as a cube:
- One layer is one tile. BDC's tiles are about 105 km across. A view across a tile edge is blank on the far side (the top of the frames above). Sentinel-2 scenes on Earth Search overlap and change from date to date, so no single address template covers an area.
- The dates have to be typed. BDC's 16-day composites restart on 1 January each year, so they aren't a regular step. The dates are in the STAC items, but the slider can't take them from there.
- The values are raw. BDC's NDVI is
int16withscale0.0001 andnodata-9999, which its STAC item'sraster:bandsstates. The layer draws the stored integers in grey, with no data drawn as values.
Proposed solution
A new command, stac.addCube, adds a STAC collection's band as one raster layer that follows the time slider.
- Command:
stac.addCube {"url", "collection", "asset", "bbox"? | "view", "start", "end", "maxCloud"?, "name"?}.- It searches the collection over the area and period, paging, with a cap of say 2,000 items.
- It groups the items by date:
datetime, orstart_datetimefor composites. - The slider's
datesare the distinct dates found. This answers point 2.
- Drawing:
- At each step, the layer draws that date's assets that intersect the view, each read in place as dated COGs are now: a mosaic per date. This answers point 1.
- Where items overlap, the first valid pixel wins, in the search's order (
sortbycloud cover where the API sorts). - Items in different projections (Sentinel-2's UTM zones) are reprojected as a single COG is today.
- Values: the asset's
raster:bands(scale,offset,nodata) are applied, so NDVI reads -1 to 1 and no data is transparent. A single band gets a colour ramp by default. This answers point 3. - In the app: in the STAC Search pane, Add as Time Series next to Find Items, with a band picker, when the items found span several dates.
- Saved with the project:
- the search: the API, collection, asset, area and period;
- the asset addresses per date, so the project opens without searching again;
- Refresh searches again, for a cube that has grown since.
- Where it works:
- On the desktop, any STAC API whose assets can be read in place.
- On the web, only where the data server allows it (CORS). BDC's data server doesn't send CORS headers, so BDC cubes would be desktop-only.
- Planetary Computer's signed asset addresses expire after about an hour. They would be signed again when a step is drawn.
- Docs and tests:
- A STAC cubes section in
data.md, with the BDC example. - Tests against a small static STAC catalog in the test fixtures, so they need no network:
- two tiles and three dates, irregular;
- the dates found;
- the mosaic at a tile edge;
raster:bandsscale and nodata;- the cap;
- a project round trip.
- A STAC cubes section in
This would also give #555 (a time series at a point) and #556 (a summary over time) a second kind of stack beside Zarr. A point's series reads one pixel per date. A season's maximum NDVI folds the dates' mosaics over an area. I'd leave those to their own issues.
Questions before I start:
- A layer that draws several COGs per date is a new kind of raster layer. Should it extend the dated COG layer (
time_url), or be a layer of its own? - In the project: keep the asset addresses (no search on open), or the search alone (always current, but it needs the API)?
- The caps: are 2,000 items, and the time slider's 20,000 dates, right?
Estimated scope
Medium: a broader feature that is feasible in a reasonable timeframe
Alternatives considered
- A layer per tile with a typed date list: this works today, as tried above. But it needs a layer per tile, a hand-made date list, and manual scaling.
- Mosaicking each date first (
raster.mosaic) and stacking the results: this downloads and holds every tile, while the cube is meant to be read in place. - BDC's own services: WTSS for series and BDC Explorer for viewing. They work, but outside the map, and only for BDC.
Related
#543 (time slider), #77 (feature parity with GeoLibre: "Time Slider", "Multidimensional rasters"), #554 (Zarr on the time slider), #555 (time series at a point), #556 (summary over time).
Activity
elpidioassinaturas commentedon Oct 19, 2026
One more requirement, which I found while making the figures for this issue: one fixed display scale across all dates and tiles.
The COGs read in place, both the dated
layer.addUrlandstac.addAsset, are tile layers. Each file is stretched in grey on its own, between the 2nd and 98th percentiles of its coarsest overview (crates/tiles/src/cog.rs). They take no colour ramp, fixed range or no-data value, becauseraster.symbology,raster.stretchandraster.maskneed a raster layer.So in the animation described in the issue, a given grey is not the same NDVI in August and in January, and not the same on two tiles of one date. The seasonal change shows, but part of each frame's contrast comes from its own stretch. For a cube that is the wrong default: the point of stepping through dates is to compare them.
What the cube layer should do:
raster:bandsscale/offset.raster:bandsnodatadrawn transparent.For comparison, the panel below shows what that looks like:
S2-16D-2NDVI over Sorriso (MT), tiles020018and020019, on 12 Aug 2024, 1 Jan 2025 and 9 May 2025.rustgis-clion main (a47ce62), by first clipping the view's window out of the COGs with GDAL into local GeoTIFFs. As raster layers they acceptramp.add,raster.symbology,raster.stretch(custom 0–9000) andraster.mask(-9999).The cube layer should give this without the download step.
🤖 Generated with Claude Code
COG: files side by side meet without a line (#575)
STAC: a collection's band as a data cube on the time slider (#559) (#605