Skip to main content
Docs homeExamplesGitHub
Layers

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
ComponentWhat changedWhat to do
All fourThe @developmentseed/* peers must be 0.10. 0.9 and older fail.Bump all of them together.
VLayerMultiCogsources values are URLs (or opened GeoTIFFs), not { url } objects.{ red: { url: a } } → { red: a }
VLayerCoggeotiff takes a URL, URL, ArrayBuffer, GeoTIFF or COGSource. A Blob is no longer accepted.Pass await blob.arrayBuffer().
VLayerCog, VLayerMultiCogmaxRequests 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.
VLayerMosaicEach 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 fourNew @source-load event with the opened source. @geotiff-load keeps its payload.Optional.
All fourProjections 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

Live Demo

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

PropTypeDefaultDescription
idstringrequiredUnique layer identifier
geotiffstring | URL | ArrayBuffer | GeoTIFF | COGSourcerequiredThe COG: a URL, its bytes, an opened GeoTIFF, or a COGSource from COGSource.open() to share one source across layers
tileSizenumber256Tile size in pixels
maxZoomnumber-Maximum zoom level
minZoomnumber0Minimum zoom level
opacitynumber1Layer opacity (0-1)
visiblebooleantrueLayer visibility
pickablebooleanfalseEnable picking
debugbooleanfalseShow debug overlay
maxRequestsnumber256Tile requests the layer may have in flight. concurrencyLimiter caps the network requests.
concurrencyLimiterConcurrencyLimiter | nullshared defaultPer-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

EventPayloadDescription
@geotiff-load(tiff, { geographicBounds })GeoTIFF loaded with bounds
@source-loadCOGSourceThe COG was opened. Also on VLayerMultiCog (MultiCOGSource).
@errorErrorThe COG could not be opened or a tile failed. Also on VLayerMultiCog.
@clickPickingInfoClicked on layer
@hoverPickingInfoHovering 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

Live Demo

Visualize NLCD land use classification data:

<VLayerCog
  id="landcover"
  :geotiff="nlcdUrl"
  :opacity="0.7"
/>

MosaicLayer

Live Demo

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

PropTypeDefaultDescription
idstringrequiredUnique layer identifier
sourcesMosaicSource[]requiredArray of STAC-like items with bbox and COG asset URLs
renderMode'trueColor' | 'falseColor' | 'ndvi' | 'custom''trueColor'Render mode for band combination
customRenderModulesFunction-Custom render modules (only used when renderMode is 'custom')
colormapDataUint8ClampedArraycfastieCustom colormap texture data for NDVI (256 RGBA colors)
maxCacheSizenumberInfinityMaximum number of tiles to cache
beforeIdstring-Insert layer before this layer ID
opacitynumber1Layer opacity (0-1)
visiblebooleantrueLayer visibility
pickablebooleanfalseEnable picking

Events

EventPayloadDescription
@source-loadMosaicSourceCOG source loaded successfully
@error(Error, MosaicSource?)Error loading a COG source
@clickPickingInfoClicked on layer
@hoverPickingInfoHovering over layer

Render Modes

ModeDescription
trueColorRGB composite (bands 1, 2, 3)
falseColorFalse Color Infrared - NIR, Red, Green (bands 4, 1, 2) - highlights vegetation
ndviNormalized Difference Vegetation Index with cfastie colormap
customUse 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

Live Demo

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

PropTypeDefaultDescription
idstringrequiredUnique layer identifier
sourcesRecord<string, string | URL | ArrayBuffer | GeoTIFF> | MultiCOGSourcerequiredOne 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 greyWhich band goes to each output channel
renderPipelineRasterModule[]-GPU modules applied after compositing (e.g. LinearRescale, Colormap)
maxErrornumber0.125Reprojection mesh error in pixels
maxRequestsnumber256Tile requests the layer may have in flight
maxCacheSize / maxCacheByteSizenumber-Tile cache limits
debounceTimenumber-Tile fetch debounce (ms)
refinementStrategy'best-available' | 'no-overlap' | 'never''best-available'Tile refinement
concurrencyLimiterConcurrencyLimiter | nullshared defaultPer-origin limit shared by every band. null turns it off. Ignored when sources is a MultiCOGSource.
opacity / visible / pickable / autoHighlight / beforeIdAs on VLayerCog
debug / debugOpacity / debugLevelboolean / number / 1 | 2 | 3false / 0.5 / 1Tile debug overlay

Events

EventPayloadDescription
@source-loadMultiCOGSourceThe scene was opened
@geotiff-load(geotiffs: ReadonlyMap<string, GeoTIFF>, { primaryKey, geographicBounds })The bands were opened; primaryKey is the finest band
@errorErrorA file could not be opened, the files are not one scene, or a tile failed
@click / @hoverPickingInfoPicking

ZarrLayer

Live Demo

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

PropTypeDefaultDescription
idstringrequiredUnique layer identifier
nodezarr.Readable | zarr.Group | zarr.Array | ZarrSourcerequiredA zarrita store, an opened group or array, or a ZarrSource from ZarrSource.open()
variablestring-Path to the array inside the store or group. An array inherits its group's GeoZarr attributes. Ignored for a ZarrSource.
selectionRecord<string, number | zarr.Slice | null>requiredOne entry per non-spatial dimension. {} for a 2-D array.
metadataunknown-GeoZarr attributes to use instead of the store's (for data without GeoZarr metadata). Ignored for a ZarrSource.
getTileData(arr, GetTileDataOptions) => Promise<DataT>requiredReads one tile. options has x, y, z, sliceSpec, width, height, device, signal.
renderTile(data: DataT) => RenderTileResultrequiredReturns { image } or { renderPipeline }
opacity / visible / pickable / beforeIdAs on VLayerCog

Events

EventPayloadDescription
@source-loadZarrSourceThe data was opened
@errorErrorThe data could not be opened or a tile failed
@click / @hoverPickingInfoPicking

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 allow https://epsg.io in your CSP connect-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

Live Demo

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.