Repository navigation
feat(examples): experimental titiler .npy tile example - #700
Merged
Merged
Conversation
Port #469 onto current main as an experimental example. It renders tiles from the public titiler.xyz instance with RasterTileLayer directly: titiler serves each tile as a raw NumPy `.npy` array, which the browser decodes with npyjs and uploads as an RGBA texture plus a mask texture. Changes from #469: - Move to `examples/experimental/titiler-cog`. It keeps the flat `/examples/titiler-cog/` URL, and is badged experimental and listed in the experimental section of the docs examples page. - Use the shared example components (ControlPanel, DebugControls, DeckGlOverlay, LoadingWidget) and current dependency versions. - Adapt to the `TilesetDescriptor` -> `RasterTilesetDescriptor` rename. - Destroy tile textures in `onTileUnload`, following the ownership model from the destroy-tile-textures design. - Don't pass titiler's `minzoom` as `minZoom`. RasterTileLayer renders nothing below `minZoom`, so the imagery vanished when zooming out past z8, though titiler serves coarser tiles fine. - Add a `host=` query parameter to every titiler URL. titiler echoes the request `Origin` as `Access-Control-Allow-Origin`, but titiler.xyz's CDN caches responses without regard to `Origin`, so it can serve a page a response cached for another site (or for curl, with no CORS header at all) and the browser blocks it. The host, rather than the full origin, because the CDN rejects query strings containing `http://localhost`. - Check npy Fortran order, since the RGBA repack assumes C order. - Show titiler's tilejson `data_type` and band count in the panel. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Note
This PR was written by Claude (Claude Code) on behalf of @kylebarron, not by @kylebarron.
A rebased version of #469: an experimental example that renders tiles from titiler.xyz with
RasterTileLayerdirectly. titiler serves each tile as a raw NumPy.npyarray, and the browser decodes it with npyjs and uploads an RGBA texture plus a mask texture.Closes #461, closes #469
Changes from #469
examples/experimental/titiler-cog, published at the flat/examples/titiler-cog/URL, badged experimental, and listed in the experimental section of the docs examples page (with a new card image).ControlPanel,DebugControls,DeckGlOverlay,LoadingWidget) and current dependency versions.TilesetDescriptor→RasterTilesetDescriptorrename.onTileUnload.minzoom(8) asminZoom.RasterTileLayerrenders nothing belowminZoom, so the imagery vanished when zooming out, though titiler serves coarser tiles fine.data_typeand band count in the panel.titiler.xyz CORS caching workaround
titiler echoes the request's
OriginasAccess-Control-Allow-Origin, but titiler.xyz's CloudFront cache doesn't includeOriginin its cache key and sends noVary: Origin. A response cached for one site, or for a request with noOrigin(curl), is served to every other site for up to an hour (max-age=3600), and the browser blocks it. I reproduced this on fresh URLs, and at one point the exact/tileMatrixSets/WebMercatorQuadURL this example fetched was cached without any CORS header.As a workaround, every titiler URL gets a
host=<location.host>parameter, so each site has its own cache entries. It's the host, not the full origin, because the CDN returns 403 for query strings containinghttp://localhost. The parameter can go once the CDN varies onOrigin.Test plan
typecheckandbuildpass.Binding sampler not setwarning, which comes fromSimpleMeshLayer.🤖 Written by Claude Code