WeatherLayers
DemoIntegrationsDocsStatus
  • Overview
  • WeatherLayers GL
    • Quick Start
    • Layers
      • Particle Layer
      • Raster Layer
      • Contour Layer
      • HighLow Layer
      • Front Layer
      • Grid Layer
      • Data Loading
      • Data Properties
      • Style Properties
    • Controls
      • Legend Control
      • Timeline Control
      • Tooltip Control
      • Attribution Control
      • Logo Control
      • Control
    • Types
    • Functions
    • Data Sources
    • Security
    • Troubleshooting
    • Pricing
    • Changelog
    • Roadmap
  • WeatherLayers Cloud
    • Quick Start
    • Client
    • Types
    • Security
    • Troubleshooting
    • Datasets
    • Pricing
    • Changelog
    • Roadmap
  • Contact
Powered by GitBook
On this page
  • Example
  • Example: Picking
  • Data Properties
  • Style Properties
  • Picking Info
  1. WeatherLayers GL
  2. Layers

Raster Layer

Last updated 2 months ago

Variable rendered as a color overlay

Example

import { Deck } from '@deck.gl/core';
import { ClipExtension } from '@deck.gl/extensions';
import * as WeatherLayers from 'weatherlayers-gl';

// load data
const image = await WeatherLayers.loadTextureData(url);

const deckgl = new Deck({
  layers: [
    new WeatherLayers.RasterLayer({
      id: 'raster',
      // data properties
      image: image,
      bounds: [-180, -90, 180, 90],
      // style properties
      palette: [
        [0, [255, 255, 255]],
        [5, [127, 255, 255]],
        [10, [127, 255, 127]],
        [15, [255, 255, 127]],
        [20, [255, 127, 127]],
        [25, [127, 0, 0]],
      ],
      extensions: [new ClipExtension()],
      clipBounds: [-181, -85.051129, 181, 85.051129],
    }),
  ],
});

Example: Picking

import { Deck } from '@deck.gl/core';
import { ClipExtension } from '@deck.gl/extensions';
import * as WeatherLayers from 'weatherlayers-gl';

// load data
const image = await WeatherLayers.loadTextureDataCached(url);

const deckgl = new Deck({
  layers: [
    new WeatherLayers.RasterLayer({
      // data properties
      image: image,
      bounds: [-180, -90, 180, 90],
      extensions: [new ClipExtension()],
      clipBounds: [-181, -85.051129, 181, 85.051129],
      // style properties
      palette: [
        [0, [255, 255, 255],
        [5, [127, 255, 255],
        [10, [127, 255, 127],
        [15, [255, 255, 127],
        [20, [255, 127, 127],
        [25, [127, 0, 0],
      ],
      pickable: true,
    }),
  ],
  onHover: event => console.log(event.raster),
});

Data Properties

Style Properties

palette

Type: color palette text or array, required

Palette used to interpolate values to colors.

Formats:

Picking Info

If pickable: true, the picking info passed to callbacks (onHover, onClick, etc.) provides information on which pixel was picked. It contains an additional raster field.

Float32 data are recommended for the best precision.

See common for all layers.

See common for all layers.

text (string) - see for details

array ([number, PaletteColor][]) - PaletteColor is any object accepted by

Type:

See and .

Style properties
Text format
Chroma.js constructor
Tooltip control
BitmapLayer Pixel Picking
Raster Layer
Data properties
RasterPointProperties