MCPcopy Index your code
hub / github.com/Gisat/deck.gl-geotiff

github.com/Gisat/deck.gl-geotiff @v2.6.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.6.0 ↗ · + Follow
218 symbols 485 edges 53 files 22 documented · 10%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

@gisatcz/deckgl-geolib

version

A Deck.gl extension for rendering Cloud-Optimized GeoTIFF (COG) data.

This library allows you to efficiently visualize high-resolution bitmap and terrain data directly from COG sources. It includes the CogBitmapLayer for 2D imagery and thematic layers and the CogTerrainLayer for 3D terrain meshes.

Features

  • COG Rendering: Efficiently loads and displays COG files directly without a backend server.
  • Bitmap and Terrain Layers: Supports visualizing both raster and elevation data.
  • Customizable Rendering: Custom color scales, multichannel support, heatmaps, categorical classification, and opacity control.
  • Terrain Texturing: Drape a styled visualization (elevation heatmap, external imagery) directly onto the 3D terrain mesh — no separate layer needed.
  • Kernel Analysis: Compute slope and hillshade directly from elevation data using 3×3 neighborhood kernels (Horn's method / ESRI algorithm).
  • Swiss Relief Shading: Apply hypsometric color blending with hillshade and slope for superior terrain perception. Supports both terrain baking and transparent glaze overlays on satellite imagery.
  • Raw Value Picking: Access original raster values (elevation, band values, slope, hillshade) at hover/click locations with no extra network requests.

Installation

To use this library, you need to have deck.gl and its dependencies installed.

npm install @gisatcz/deckgl-geolib
# or
yarn add @gisatcz/deckgl-geolib

For more information, visit the npm package page.

Documentation

Usage

1. CogBitmapLayer

Used for displaying 2D rasters: Raw Observation (Satellite/Aerial), Data Structure (Multi-band/Single-band), and Analysis Output (Thematic/Categorical).

import { CogBitmapLayer } from '@gisatcz/deckgl-geolib';

const cogLayer = new CogBitmapLayer({
  id: 'cog_bitmap_name',
  rasterData:  'cog_bitmap_data_url.tif',
  isTiled: true,
  cogBitmapOptions: {
    type: 'image'
  }
});

2. CogTerrainLayer

Used for displaying 3D terrain from elevation data. Supports draping a styled texture derived from the elevation itself.

import { CogTerrainLayer } from '@gisatcz/deckgl-geolib';

const cogLayer = new CogTerrainLayer({
  id: 'cog_terrain_name',
  elevationData: 'cog_terrain_data_url.tif',
  isTiled: true,
  tileSize: 256,
  operation: 'terrain+draw',
  terrainOptions: {
    type: 'terrain',
    useHeatMap: true,
    useChannel: 1,
    colorScale: ['#440154', '#20908d', '#fde725'],
    colorScaleValueRange: [0, 3000],
  }
});

3. Kernel Analysis (Slope & Hillshade)

Compute slope or hillshade directly from elevation data and drape it as a texture on the terrain mesh.

import { CogTerrainLayer } from '@gisatcz/deckgl-geolib';

const slopeLayer = new CogTerrainLayer({
  id: 'cog_slope',
  elevationData: 'cog_terrain_data_url.tif',
  isTiled: true,
  tileSize: 256,
  operation: 'terrain+draw',
  terrainOptions: {
    type: 'terrain',
    useChannel: 1,
    useSlope: true,           // or useHillshade: true
    useHeatMap: true,
    colorScale: [[255, 255, 255], [235, 200, 150], [200, 80, 50], [100, 40, 30]],
    colorScaleValueRange: [0, 90], // degrees
  },
});

Data Preparation

For this library to work efficiently, your COG must be Web-Optimized and projected in Web Mercator (EPSG:3857).

Quick Checklist: 1. Projection: Web Mercator EPSG:3857 2. Tiling: 256x256 tiles 3. Compression: DEFLATE is recommended

Use the following rio-cogeo command to generate compatible files:

rio cogeo create \
  --cog-profile=deflate \
  --blocksize=256 \
  --overview-blocksize=256 \
  --web-optimized \
  --nodata=nan \
  --forward-band-tags \
  [input_file.tif] \
  [output_cog_file.tif]

Architecture & Development

This repository is a monorepo containing the core library and example applications.

  • geoimage/: The core library source code.
  • example/: A React application for testing the layers.

Building Locally

# 1. Install dependencies
yarn install

# 2. Build the library
yarn build

# 3. Run the example app
yarn start

Maintained by Gisat

Extension points exported contracts — how you extend this code

RoutesProps (Interface)
(no doc)
example/src/Routes.tsx
TerrainCoordinate (Interface)
(no doc)
geoimage/src/utils/terrainPickingUtils.ts
CogDataSource (Interface)
(no doc)
example/src/examples/dataSources.ts
TileResult (Interface)
(no doc)
geoimage/src/core/types.ts
TileBounds (Interface)
(no doc)
geoimage/src/layers/CogBitmapLayer.ts
MeshResult (Interface)
(no doc)
geoimage/src/workers/TerrainWorkerPool.ts
PendingTask (Interface)
(no doc)
geoimage/src/workers/TerrainWorkerPool.ts

Core symbols most depended-on inside this repo

_addTriangle
called by 13
geoimage/src/core/delatin/index.ts
isF32NoData
called by 10
geoimage/src/core/lib/numberUtils.ts
_legalize
called by 9
geoimage/src/core/delatin/index.ts
initializeCog
called by 8
geoimage/src/core/CogTiles.ts
getImage
called by 8
geoimage/src/core/lib/TileCacheManager.ts
orient
called by 7
geoimage/src/core/delatin/index.ts
buildTerrainOptions
called by 5
example/src/examples/CogTerrainKernelExample.tsx
getBoundsAsLatLon
called by 5
geoimage/src/core/CogTiles.ts

Shape

Method 114
Function 66
Class 26
Interface 12

Languages

TypeScript100%

Modules by API surface

geoimage/src/core/delatin/index.ts25 symbols
geoimage/src/core/lib/TileCacheManager.ts22 symbols
geoimage/src/core/CogTiles.ts19 symbols
geoimage/src/core/lib/BitmapGenerator.ts14 symbols
geoimage/src/workers/TerrainWorkerPool.ts13 symbols
geoimage/src/layers/CogTerrainLayer.ts12 symbols
geoimage/src/core/lib/TerrainGenerator.ts11 symbols
geoimage/src/layers/CogBitmapLayer.ts9 symbols
geoimage/src/core/GeoImage.ts7 symbols
geoimage/src/core/lib/KernelGenerator.ts6 symbols
geoimage/src/core/lib/TileReader.ts5 symbols
geoimage/src/core/helpers/skirt.ts5 symbols

For agents

$ claude mcp add deck.gl-geotiff \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact