developmentseed / developmentseed/deck.gl-raster
Handle tile boundaries for convolutional raster operations
- Dominant language
- TypeScript
- Stars
- 228
- Forks
- 29
- Avg merge
- 12h 27m
- Merged PRs (30d)
- 4
Description
Summary from chat with @kylebarron:
Hillshade and similar raster operations need neighboring pixels to compute each output pixel. Current examples are mostly per-pixel transforms so handling tile edges are not a major issue. Hillshading is different since slope/aspect at tile edges requires elevation values from adjacent tiles. Without "padded reads" or some form of neighbor backfilling visible grid lines will appear at the internal COG tile boundaries.
Example with visible grid lines:
https://github.com/user-attachments/assets/902c5f46-15b2-4450-b252-73f202add027
Example branch: https://github.com/developmentseed/deck.gl-raster/tree/feat-hillshade-example
Useful sources from MapLibre:
- DEMData says it handles backfilling from neighboring tiles:
[maplibre-gl-js/src/data/dem_data.ts#L24-L27](https://github.com/maplibre/maplibre-gl-js/blob/main/src/data/dem_data.ts#L24-L27)
- Initial border fill by duplicating edge pixels:
[maplibre-gl-js/src/data/dem_data.ts#L75-L92](https://github.com/maplibre/maplibre-gl-js/blob/main/src/data/dem_data.ts#L75-L92)
- The actual backfillBorder(...) method in Maplibre:
[maplibre-gl-js/src/data/dem_data.ts#L124-L151](https://github.com/maplibre/maplibre-gl-js/blob/main/src/data/dem_data.ts#L124-L151)
- Current MapLibre helper that calls tile.dem.backfillBorder(): https://github.com/maplibre/maplibre-gl-js/blob/main/src/tile/tile_manager_raster_dem.ts#L4-L42
Other useful resources:
- https://www.mapzen.com/blog/mapping-mountains/
- https://tangrams.github.io/terrain-demos/?url=styles/imhof.yaml#12.825/37.8589/-121.9371
Small note on the Tangram/Mapzen link, they seem useful mostly for terrain styling ideas but not necessarily for runtime tile-boundary handling. In the post there's a description on computing normals from heightmaps but also a note that the normal maps can be precomputed offline and served as separate tiles (which moves the neighborhood/edge handling/problem into the tile-generation pipeline).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.