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: Arrows
  • Example: Wind Barbs
  • Data Properties
  • Style Properties
  1. WeatherLayers GL
  2. Layers

Grid Layer

Last updated 9 months ago

Variable rendered as grid of values or symbols (arrows, wind barbs)

Example

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

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

const deckgl = new Deck({
  layers: [
    new WeatherLayers.GridLayer({
      id: 'grid',
      // data properties
      image: image,
      bounds: [-180, -90, 180, 90],
    }),
  ],
});

Example: Arrows

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

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

const deckgl = new Deck({
  layers: [
    new WeatherLayers.GridLayer({
      // data properties
      image: image,
      imageType: WeatherLayers.ImageType.VECTOR,
      bounds: [-180, -90, 180, 90],
      
      // style properties
      style: WeatherLayers.GridStyle.ARROW,
      iconBounds: [0, 100],
    }),
  ],
});

Example: Wind Barbs

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

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

const deckgl = new Deck({
  layers: [
    new WeatherLayers.GridLayer({
      // data properties
      image: image,
      imageType: WeatherLayers.ImageType.VECTOR,
      bounds: [-180, -90, 180, 90],
      
      // style properties
      style: WeatherLayers.GridStyle.WIND_BARB,
      iconBounds: [0, 100 * 0.51444], // 100 kts to m/s
    }),
  ],
});

Data Properties

Style Properties

style

Type: enum WeatherLayers.GridStyle, values: VALUE, ARROW, WIND_BARB, optional

Default: VALUE

Style of the grid points, values or symbols.

If style: ARROW or style: WIND_BARB, imageType must be VECTOR.

density

Type: number, optional

Default: 0

Grid point density. Recommended values are -2, -1, 0, 1, 2 (lowest to highest density). Larger values can cause performance issues.

unitFormat

Default: null

Unit definition to be used for formatting numbers.

textFormatFunction

Type: function (value: number, unitFormat: UnitFormat) => string, optional

Default: (value, unitFormat) => unitFormat ? formatValue(value, unitFormat) : Math.round(value).toString()

Function to format the value.

textFontFamily

Type: string, optional

Default: "Helvetica Neue", Arial, Helvetica, sans-serif

textSize

Type: number, optional

Default: 12

textColor

Type: color [number, number, number, number?], optional

Default: [255, 255, 255]

textOutlineWidth

Type: number, optional

Default: 1

textOutlineColor

Type: color [number, number, number, number?], optional

Default: [13, 13, 13]

iconBounds

Type: tuple of lower and upper bound [number, number], required if style: ARROW

Default if style: WIND_BARB: [0, 100 * 0.51444] (100 knots to m/s, assumes the data units are m/s)

Bounds of the icon in the data units. The lower bound is usually 0, the upper bound is the largest value in the data units that matches the largest value of the icons.

If style: WIND_BARB, the upper bound must match 100 knots in the data units.

iconSize

Type: [number, number] | number, optional

Default: 12

If an array is passed in, it's treated as minimal and maximal icon size. The actual icon size is scaled by the data value.

iconColor

Type: color [number, number, number, number?], optional

Default: [255, 255, 255]

palette

Type: color palette text or array, optional

Palette used to interpolate values to colors.

Formats:

See common for all layers.

See common for all layers.

Type: , optional

Font family of the text. See .

Size of the text. See .

Color of the text. See .

Width of outline around the text, relative to the font size. See .

Color of outline around the text. See .

Size of the icon. See .

Color of the icon. See .

text (string) - see for details

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

Style properties
TextLayer fontFamily
TextLayer getSize
TextLayer getColor
TextLayer outlineWidth
TextLayer outlineColor
IconLayer getSize
IconLayer getColor
Text format
Chroma.js constructor
Data properties
Grid Layer
Grid Layer: Arrows
Grid Layer: Wind Barbs
UnitFormat