Raster Layers
Cloud-Optimized GeoTIFF and satellite imagery visualization
See Peer Dependencies for the complete list of required packages for each component.
Live Demo - GPU-accelerated COG visualization with Sentinel-2 imagery
Upgrading to v4
v4 moves the raster and Zarr layers to @developmentseed/* 0.10. Version 0.10 changed the libraries' API: every layer now takes its data as one source (a URL, an opened file, or a *Source.open() result). The components keep their props, so most apps only need the package bump.
pnpm add @geoql/v-maplibre@^4 @developmentseed/deck.gl-geotiff@^0.10 @developmentseed/deck.gl-raster@^0.10 @developmentseed/geotiff@^0.10 @developmentseed/proj@^0.10
# Zarr: also
pnpm add @developmentseed/deck.gl-zarr@^0.10
| Component | What changed | What to do |
|---|---|---|
| All four | The @developmentseed/* peers must be 0.10. 0.9 and older fail. | Bump all of them together. |
VLayerMultiCog | sources values are URLs (or opened GeoTIFFs), not { url } objects. | { red: { url: a } } → { red: a } |
VLayerCog | geotiff takes a URL, URL, ArrayBuffer, GeoTIFF or COGSource. A Blob is no longer accepted. | Pass await blob.arrayBuffer(). |
VLayerCog, VLayerMultiCog | maxRequests defaults to the library's 256. The per-origin concurrencyLimiter (6 per origin by default) still caps network requests. | Nothing, unless you relied on 6. |
VLayerMosaic | Each item gets an id that keys the cache of opened sources. It defaults to the asset URL. | Nothing. Set id if two items share a URL. |
| All four | New @source-load event with the opened source. @geotiff-load keeps its payload. | Optional. |
| All four | Projections resolve with @developmentseed/proj: EPSG 4326, 4269, 3857 and the UTM zones offline, others fetched once from epsg.io. | Allow https://epsg.io in your CSP connect-src, or call registerProjection() first (see Projections). |
COGLayer
GPU-accelerated Cloud-Optimized GeoTIFF visualization with automatic reprojection.
Installation
pnpm add @developmentseed/deck.gl-geotiff@^0.10 @developmentseed/deck.gl-raster@^0.10 @developmentseed/geotiff@^0.10 @developmentseed/proj@^0.10
Features
- Fully client-side (no server required)
- GPU-accelerated rendering
- Automatic CRS reprojection
- Intelligent tile streaming
- Overview level selection
- Support for multi-band imagery
Basic Usage
<script setup lang="ts">
import { VMap } from '@geoql/v-maplibre';
import { VLayerCog } from '@geoql/v-maplibre/geotiff';
const mapOptions = {
style: 'https://basemaps.cartocdn.com/gl/dark-matter-nolabels-gl-style/style.json',
center: [31.5, 30.0],
zoom: 8,
};
// Sentinel-2 RGB imagery COG
const COG_URL = 'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/36/Q/WD/2020/7/S2A_36QWD_20200701_0_L2A/TCI.tif';
</script>
<template>
<VMap :options="mapOptions" style="height: 500px">
<VLayerCog
id="cog-layer"
:geotiff="COG_URL"
@geotiff-load="(tiff, { geographicBounds }) => console.log('Loaded:', geographicBounds)"
/>
</VMap>
</template>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | required | Unique layer identifier |
geotiff | string | URL | ArrayBuffer | GeoTIFF | COGSource | required | The COG: a URL, its bytes, an opened GeoTIFF, or a COGSource from COGSource.open() to share one source across layers |
tileSize | number | 256 | Tile size in pixels |
maxZoom | number | - | Maximum zoom level |
minZoom | number | 0 | Minimum zoom level |
opacity | number | 1 | Layer opacity (0-1) |
visible | boolean | true | Layer visibility |
pickable | boolean | false | Enable picking |
debug | boolean | false | Show debug overlay |
maxRequests | number | 256 | Tile requests the layer may have in flight. concurrencyLimiter caps the network requests. |
concurrencyLimiter | ConcurrencyLimiter | null | shared default | Per-origin limit for tile requests. Omit it for the shared default of 6 requests per origin (the HTTP/1.1 browser limit). Pass null to turn limiting off for HTTP/2 or HTTP/3 sources, or a PerOriginSemaphore from @developmentseed/geotiff for a custom limit. Ignored when geotiff is a COGSource. Also on VLayerMultiCog. |
Events
| Event | Payload | Description |
|---|---|---|
@geotiff-load | (tiff, { geographicBounds }) | GeoTIFF loaded with bounds |
@source-load | COGSource | The COG was opened. Also on VLayerMultiCog (MultiCOGSource). |
@error | Error | The COG could not be opened or a tile failed. Also on VLayerMultiCog. |
@click | PickingInfo | Clicked on layer |
@hover | PickingInfo | Hovering over layer |
<script setup lang="ts">
import { PerOriginSemaphore } from '@developmentseed/geotiff';
// HTTP/2 bucket: allow 24 parallel range requests instead of 6.
const limiter = new PerOriginSemaphore({ maxRequests: 24 });
</script>
<template>
<VLayerCog
id="cog"
geotiff="https://example.com/scene.tif"
:concurrency-limiter="limiter"
@error="(e) => console.error(e)"
/>
</template>
Fit to Bounds
<script setup lang="ts">
import { shallowRef } from 'vue';
import type { Map } from 'maplibre-gl';
const mapInstance = shallowRef<Map | null>(null);
const handleGeotiffLoad = (
_tiff: unknown,
{ geographicBounds }: { geographicBounds: { west: number; south: number; east: number; north: number } }
) => {
const { west, south, east, north } = geographicBounds;
mapInstance.value?.fitBounds(
[[west, south], [east, north]],
{ padding: 40, duration: 1000 }
);
};
</script>
<template>
<VMap :options="mapOptions" @loaded="(map) => mapInstance = map">
<VLayerCog
id="cog"
:geotiff="cogUrl"
@geotiff-load="handleGeotiffLoad"
/>
</VMap>
</template>
Land Cover Example
Visualize NLCD land use classification data:
<VLayerCog
id="landcover"
:geotiff="nlcdUrl"
:opacity="0.7"
/>
MosaicLayer
Client-side COG mosaic layer that renders multiple Cloud-Optimized GeoTIFFs from STAC items. All rendering happens in the browser with no server required.
Installation
pnpm add @developmentseed/deck.gl-geotiff@^0.10 @developmentseed/deck.gl-raster@^0.10 @developmentseed/geotiff@^0.10 @developmentseed/proj@^0.10
Features
- Fully client-side mosaicking (no tile server required)
- STAC API integration for discovering imagery
- Multiple render modes: True Color, False Color Infrared, NDVI
- GPU-accelerated rendering with automatic reprojection
- Spatial indexing for efficient tile loading
- Support for 4-band imagery (RGBN)
Basic Usage
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { VMap } from '@geoql/v-maplibre';
import {
VLayerMosaic,
type MosaicSource,
type MosaicRenderMode,
} from '@geoql/v-maplibre/geotiff';
const mapOptions = {
style: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',
center: [-104.9903, 39.7392],
zoom: 10,
};
const renderMode = ref<MosaicRenderMode>('trueColor');
const stacItems = ref<MosaicSource[]>([]);
// Fetch STAC items from Microsoft Planetary Computer
async function fetchSTACItems() {
const params = {
collections: 'naip',
bbox: '-106.6,38.7,-104.6,40.4',
datetime: '2023-01-01/2023-12-31',
limit: '1000',
};
const response = await fetch(
'https://planetarycomputer.microsoft.com/api/stac/v1/search?' +
new URLSearchParams(params)
);
const { features } = await response.json();
stacItems.value = features;
}
onMounted(fetchSTACItems);
</script>
<template>
<VMap :options="mapOptions" style="height: 500px">
<VLayerMosaic
v-if="stacItems.length > 0"
id="naip-mosaic"
:sources="stacItems"
:render-mode="renderMode"
/>
</VMap>
</template>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | required | Unique layer identifier |
sources | MosaicSource[] | required | Array of STAC-like items with bbox and COG asset URLs |
renderMode | 'trueColor' | 'falseColor' | 'ndvi' | 'custom' | 'trueColor' | Render mode for band combination |
customRenderModules | Function | - | Custom render modules (only used when renderMode is 'custom') |
colormapData | Uint8ClampedArray | cfastie | Custom colormap texture data for NDVI (256 RGBA colors) |
maxCacheSize | number | Infinity | Maximum number of tiles to cache |
beforeId | string | - | Insert layer before this layer ID |
opacity | number | 1 | Layer opacity (0-1) |
visible | boolean | true | Layer visibility |
pickable | boolean | false | Enable picking |
Events
| Event | Payload | Description |
|---|---|---|
@source-load | MosaicSource | COG source loaded successfully |
@error | (Error, MosaicSource?) | Error loading a COG source |
@click | PickingInfo | Clicked on layer |
@hover | PickingInfo | Hovering over layer |
Render Modes
| Mode | Description |
|---|---|
trueColor | RGB composite (bands 1, 2, 3) |
falseColor | False Color Infrared - NIR, Red, Green (bands 4, 1, 2) - highlights vegetation |
ndvi | Normalized Difference Vegetation Index with cfastie colormap |
custom | Use customRenderModules prop for custom band math |
MosaicSource Type
interface MosaicSource {
id?: string; // keys the cache of opened sources; defaults to the asset URL
bbox: [number, number, number, number]; // [west, south, east, north]
assets: {
image: {
href: string; // URL to the COG file
};
};
}
This matches the STAC Item format, so you can pass STAC search results directly.
MultiCOGLayer
Composites bands that live in separate COGs into one image, for example Sentinel-2 bands at 10 m and 20 m. All files must be one scene (same CRS and extent). The layer tiles on the finest band, and the GPU resamples the coarser ones.
Installation
pnpm add @developmentseed/deck.gl-geotiff@^0.10 @developmentseed/deck.gl-raster@^0.10 @developmentseed/geotiff@^0.10 @developmentseed/proj@^0.10
Basic Usage
<script setup lang="ts">
import { VMap } from '@geoql/v-maplibre';
import { VLayerMultiCog } from '@geoql/v-maplibre/geotiff';
import { LinearRescale } from '@developmentseed/deck.gl-raster/gpu-modules';
const base =
'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/33/S/VB/2024/7/S2B_33SVB_20240725_0_L2A';
// One URL per band, keyed by the band name you use in `composite`.
const sources = {
red: `${base}/B04.tif`,
green: `${base}/B03.tif`,
blue: `${base}/B02.tif`,
};
const composite = { r: 'red', g: 'green', b: 'blue' };
// Sentinel-2 reflectance is uint16; rescale 0 - 0.15 back to 0 - 1.
const renderPipeline = [
{ module: LinearRescale, props: { rescaleMin: 0, rescaleMax: 0.15 } },
];
</script>
<template>
<VMap :options="{ center: [14.5, 37.5], zoom: 9 }" style="height: 500px">
<VLayerMultiCog
id="sentinel2"
:sources="sources"
:composite="composite"
:render-pipeline="renderPipeline"
/>
</VMap>
</template>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | required | Unique layer identifier |
sources | Record<string, string | URL | ArrayBuffer | GeoTIFF> | MultiCOGSource | required | One file per band, keyed by band name, or a MultiCOGSource from MultiCOGSource.open() |
composite | { r: string; g?: string; b?: string; a?: string } | first band as grey | Which band goes to each output channel |
renderPipeline | RasterModule[] | - | GPU modules applied after compositing (e.g. LinearRescale, Colormap) |
maxError | number | 0.125 | Reprojection mesh error in pixels |
maxRequests | number | 256 | Tile requests the layer may have in flight |
maxCacheSize / maxCacheByteSize | number | - | Tile cache limits |
debounceTime | number | - | Tile fetch debounce (ms) |
refinementStrategy | 'best-available' | 'no-overlap' | 'never' | 'best-available' | Tile refinement |
concurrencyLimiter | ConcurrencyLimiter | null | shared default | Per-origin limit shared by every band. null turns it off. Ignored when sources is a MultiCOGSource. |
opacity / visible / pickable / autoHighlight / beforeId | As on VLayerCog | ||
debug / debugOpacity / debugLevel | boolean / number / 1 | 2 | 3 | false / 0.5 / 1 | Tile debug overlay |
Events
| Event | Payload | Description |
|---|---|---|
@source-load | MultiCOGSource | The scene was opened |
@geotiff-load | (geotiffs: ReadonlyMap<string, GeoTIFF>, { primaryKey, geographicBounds }) | The bands were opened; primaryKey is the finest band |
@error | Error | A file could not be opened, the files are not one scene, or a tile failed |
@click / @hover | PickingInfo | Picking |
ZarrLayer
Renders a GeoZarr array, with reprojection. The layer is format-agnostic: you read each tile with zarrita in getTileData and turn it into an image in renderTile.
Installation
pnpm add @developmentseed/deck.gl-zarr@^0.10 @developmentseed/deck.gl-raster@^0.10 @developmentseed/proj@^0.10 zarrita
Basic Usage
<script setup lang="ts">
import { shallowRef, onMounted } from 'vue';
import * as zarr from 'zarrita';
import { VMap } from '@geoql/v-maplibre';
import { VLayerZarr } from '@geoql/v-maplibre/geotiff';
import type { GetTileDataOptions } from '@developmentseed/deck.gl-zarr';
const store = shallowRef<zarr.Readable | null>(null);
onMounted(async () => {
store.value = await zarr.withConsolidatedMetadata(
new zarr.FetchStore('https://example.com/forecast.zarr'),
{ format: 'v3' },
);
});
// Read one tile: zarrita slices the spatial dims for you (sliceSpec).
async function getTileData(
arr: zarr.Array<zarr.DataType>,
{ sliceSpec, width, height }: GetTileDataOptions,
) {
const { data } = await zarr.get(arr, sliceSpec);
return { data: data as Float32Array, width, height };
}
// Map values to grey: -60 °C → black, 40 °C → white.
function renderTile(tile: { data: Float32Array; width: number; height: number }) {
const pixels = new Uint8ClampedArray(tile.width * tile.height * 4);
tile.data.forEach((v, i) => {
const c = ((v + 60) / 100) * 255;
pixels.set([c, c, c, 255], i * 4);
});
return { image: new ImageData(pixels, tile.width, tile.height) };
}
</script>
<template>
<VMap :options="{ center: [0, 30], zoom: 1.5 }" style="height: 500px">
<VLayerZarr
v-if="store"
id="temperature"
:node="store"
variable="temperature_2m"
:selection="{ init_time: 0, lead_time: 0 }"
:get-tile-data="getTileData"
:render-tile="renderTile"
/>
</VMap>
</template>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | required | Unique layer identifier |
node | zarr.Readable | zarr.Group | zarr.Array | ZarrSource | required | A zarrita store, an opened group or array, or a ZarrSource from ZarrSource.open() |
variable | string | - | Path to the array inside the store or group. An array inherits its group's GeoZarr attributes. Ignored for a ZarrSource. |
selection | Record<string, number | zarr.Slice | null> | required | One entry per non-spatial dimension. {} for a 2-D array. |
metadata | unknown | - | GeoZarr attributes to use instead of the store's (for data without GeoZarr metadata). Ignored for a ZarrSource. |
getTileData | (arr, GetTileDataOptions) => Promise<DataT> | required | Reads one tile. options has x, y, z, sliceSpec, width, height, device, signal. |
renderTile | (data: DataT) => RenderTileResult | required | Returns { image } or { renderPipeline } |
opacity / visible / pickable / beforeId | As on VLayerCog |
Events
| Event | Payload | Description |
|---|---|---|
@source-load | ZarrSource | The data was opened |
@error | Error | The data could not be opened or a tile failed |
@click / @hover | PickingInfo | Picking |
Projections
All raster and Zarr layers reproject on the GPU. They resolve the file's CRS with @developmentseed/proj:
- EPSG 4326, 4269, 3857 and the UTM zones resolve offline.
- Any other EPSG code is fetched once from
https://epsg.io/<code>.json, so allowhttps://epsg.ioin your CSPconnect-src. - To avoid the request (offline apps, strict CSP), register the definition before the layer mounts:
import { registerProjection } from '@developmentseed/proj';
// WKT (or a proj string) for EPSG:32662, Plate Carrée
registerProjection(32662, 'PROJCS["WGS 84 / Plate Carree", ...]');
IDW Interpolation Heatmap
For Inverse Distance Weighting interpolation (temperature, pollution, continuous values), use maplibre-gl-interpolate-heatmap:
pnpm add maplibre-gl-interpolate-heatmap
This is different from deck.gl's density heatmap - it calculates weighted averages rather than point density. See the live example for implementation details.