Repository navigation
docs: Add an example rendering TiTiler NumPy tiles - #1327
Conversation
Adds examples/raster-numpytiles.ipynb, which renders a Sentinel-2 true-color COG from titiler.xyz's `.npy` tile endpoint with `RasterLayer`'s generic constructor: an async fetch callback that loads each tile with `np.load`, and a render callback that uses TiTiler's mask band as the alpha band. It's an example of the "any Python code" rendering that the COG examples describe, with a tile server as the source instead of a GeoTIFF. The notebook sets the TileMatrixSet's `boundingBox` to the dataset's bounds, since deck.gl-raster 0.8.1 requires one and only loads tiles inside it. developmentseed/deck.gl-raster#684 removes the need. Also adds the example's screenshot to assets/, an entry in examples/index.md, and the docs nav entry. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@vincentsarago I haven't read through this yet, but this is what claude edited and appears to work. The primary difference is that we inject a bounding box into the TMS. developmentseed/deck.gl-raster#684 tracks the upstream to infer TMS bounds if they're not provided |
When my claude limits are back, I want to ask about that |
|
Also note that the simplest way to render from titiler would be to have titiler return PNG buffers directly. Then |
other than this question lgtm |
|
@kylebarron here is what Claude told me 🤖What happens in the kernel:
If we really want to
|
> [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. Bumps: - `@deck.gl/*` 9.4.0 → [9.4.1](https://github.com/visgl/deck.gl/releases/tag/v9.4.1) - `@developmentseed/{deck.gl-raster,affine,morecantile,raster-reproject}` 0.8.1 → [0.9.0](https://github.com/developmentseed/deck.gl-raster/releases/tag/v0.9.0) → [0.10.0](https://github.com/developmentseed/deck.gl-raster/releases/tag/v0.10.0) The deck.gl overrides in `pnpm-workspace.yaml` go to `^9.4.1` too. Without that, pnpm keeps every overridden deck.gl package at 9.4.0 and only `@deck.gl/react` moves. deck.gl-raster 0.10 now depends on `@developmentseed/range-reader`, so I added it to the commented-out local-checkout overrides. The breaking changes in deck.gl-raster 0.9 and 0.10 are in `deck.gl-geotiff`, `deck.gl-zarr` and `geotiff`, which Lonboard doesn't use. Lonboard only imports `RasterTileLayer`, `TileMatrixSetAdaptor` and `MinimalTileData`, and needs no code changes. Upstream fixes relevant to Lonboard: - deck.gl-raster: tile textures are destroyed when a raster layer is removed (developmentseed/deck.gl-raster#728), and a WebGL vertex array no longer leaks per tile (developmentseed/deck.gl-raster#786). - deck.gl-raster: missing TileMatrixSet bounds are inferred and `extent` is honored (developmentseed/deck.gl-raster#684). The `TMSBoundingBox` step in `examples/raster-titiler.ipynb` (#1327) should no longer be needed. That isn't tested here. - deck.gl: the MapLibre overlay container is removed with the overlay (visgl/deck.gl#10899), and `GlobeController` can zoom past level 12 (visgl/deck.gl#10737). The `beforeId` fix for interleaved MapLibre (visgl/deck.gl#10734) merged after 9.4.1, so the `idle` workaround tracked in #1293 stays. Supersedes Dependabot's #1350, which stops at deck.gl-raster 0.9.0. Closes #1350 ## Testing - `pnpm build`, `pnpm check` and `pnpm test` (12 tests) pass. - `uv run pytest` passes: 367 passed, 1 skipped, including `tests/ui`. - `tsc --noEmit` reports the same 9 errors as `main`, and no new ones. - No test covers `RasterLayer.from_geotiff`, the only path that uses deck.gl-raster's `RasterTileLayer`. I checked it by hand with a throwaway UI test. It opens a 2048×2048 EPSG:32618 COG with 3 overviews and renders it with no basemap. Tiles reach the canvas on this branch and on `main`, and the browser console output is the same on both. 🤖 Written by [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
deck.gl-raster 0.9 infers a missing TileMatrixSet bounding box, and `extent` limits tile requests to the scene. Require a lonboard release after 0.17.0, which bundles deck.gl-raster 0.8.1. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
Adds
examples/raster-titiler.ipynb, which renders a Sentinel-2 true-color COG from titiler.xyz's.npytile endpoint withRasterLayer's generic constructor: an async fetch callback that loads each tile withnp.load, and a render callback that uses TiTiler's mask band as the alpha band. It's an example of the "any Python code" rendering that the COG examples describe, with a tile server as the source instead of a GeoTIFF.The notebook passes morecantile's
WebMercatorQuadas is, andextentkeeps tile requests inside the scene. That needs deck.gl-raster 0.9 or later (developmentseed/deck.gl-raster#684), whichmainbundles since #1355. Lonboard 0.17.0 bundles 0.8.1, so the notebook requireslonboard>0.17.0. Don't publish the docs with this example until that release is out.Also adds the example's screenshot to
assets/, an entry inexamples/index.md, and the docs nav entry.Testing
I ran the notebook's code against titiler.xyz in the
tests/uibrowser harness, on a build ofmain. All 9 tiles of the scene loaded at zoom 9, no request fell outsideextent, and the map matched the screenshot inassets/. The "Debugging the render callback" cells also work.🤖 Written by Claude Code