# @sakitam-gis/mapbox-wind

> mapbox wind

Latest version **2.0.6** (published 2026-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @sakitam-gis/mapbox-wind
pnpm add @sakitam-gis/mapbox-wind
yarn add @sakitam-gis/mapbox-wind
bun add @sakitam-gis/mapbox-wind
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2026-11-19 |
| First published | 2020-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 2.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 714 |
| Author | sakitam-fdd |
| Maintainers | sakitam-gis-owner, sakitam-fdd |
| Keywords | mapbox, 3d, webgl, map, vis, gis |

## Links

- npm: https://www.npmjs.com/package/@sakitam-gis/mapbox-wind
- Repository: https://github.com/sakitam-fdd/wind-layer
- Homepage: https://github.com/sakitam-fdd/wind-layer#readme
- Issues: https://github.com/sakitam-fdd/wind-layer/issues
- npm.io page: https://npm.io/package/@sakitam-gis/mapbox-wind

## Dependencies (6)

- [gl-matrix](https://npm.io/package/gl-matrix.md) ^3.4.4
- [wind-core](https://npm.io/package/wind-core.md) 1.1.9
- [wind-gl-core](https://npm.io/package/wind-gl-core.md) 2.0.4
- [@sakitam-gis/rbush](https://npm.io/package/@sakitam-gis/rbush.md) 3.1.3
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) ^0.5.2
- [@sakitam-gis/vis-engine](https://npm.io/package/@sakitam-gis/vis-engine.md) ^1.5.3

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 2.0.6 (latest) — 2026-11-19
- 2.0.0-alpha.0 (alpha) — 2023-06-06
- 2.0.4 — 2024-04-28
- 2.0.3 — 2024-04-14
- 2.0.2 — 2024-03-21
- 2.0.1 — 2024-03-17
- 2.0.0 — 2024-02-29
- 1.1.2 — 2022-11-26
- 1.1.1 — 2022-11-22
- 1.1.1-alpha.2 — 2021-04-09
- 1.1.1-alpha.1 — 2021-03-30
- 1.1.1-alpha.0 — 2021-03-26
- 1.1.0-alpha.0 — 2021-03-26
- 1.0.0-alpha.10 — 2020-07-05
- 1.0.0-alpha.9 — 2020-06-21
- … 6 more at https://npm.io/package/@sakitam-gis/mapbox-wind/versions

## README

# `mapbox-wind`

> [mapbox-gl](https://mapbox.com) wind layer adapter

## Usage

### Install

```bash
pnpm i @sakitam-gis/mapbox-wind -S
```

## Example

### raster

```js
const source = new mapboxWind.TileSource('carto', {
    tileSize: 256,
    minZoom: 0,
    maxZoom: 22,
    roundZoom: true,
    subdomains: ['a', 'b', 'c', 'd'],
    // coordinates: [
    //   [-180, 85.051129],
    //   [180, 85.051129],
    //   [180, -85.051129],
    //   [-180, -85.051129],
    // ],
    url: 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png',
    wrapX: true,
});

const layer = new mapboxWind.Layer('carto', source, {
    styleSpec: {
      'opacity': [
        'interpolate',
        ['exponential', 0.5],
        ['zoom'],
        1,
        1,
        2,
        1
      ],
    },
    renderType: mapboxWind.RenderType.image,
});

map.addLayer(layer);
```

### colorize

```js
const tileSource = new mapboxWind.TileSource('wind', {
  tileSize: 256,
  minZoom: 0,
  maxZoom: 4,
  roundZoom: true,
  decodeType: mapboxWind.DecodeType.imageWithExif,
  wrapX: true,
  // tileBounds: [-78.120282611, -75.191804486, 132.453327310, 68.846393966],
  url: 'http://localhost:5000/2023111700/2023111703/{z}/{x}/{y}/wind-surface.jpeg',
});

const layer = new mapboxWind.Layer('wind', tileSource, {
  styleSpec: {
    'fill-color': [
      'interpolate',
      ['step', 1],
      ['get', 'value'],
      ...interpolateColor
    ],
    'opacity': 1,
  },
  renderFrom: mapboxWind.RenderFrom.rg,
  widthSegments: 1,
  heightSegments: 1,
  displayRange: [0, 104],
  renderType: mapboxWind.RenderType.colorize,
  picking: true,
  // mask: {
  //   data: clip,
  //   // type: mapboxWind.MaskType.outside,
  //   type: mapboxWind.MaskType.inside, // 默认是 inside，即只显示范围内的
  // }
});

map.addLayer(layer);
```

### particles

```js
const tileSource = new mapboxWind.TileSource('wind', {
  tileSize: 256,
  minZoom: 0,
  maxZoom: 4,
  roundZoom: true,
  decodeType: mapboxWind.DecodeType.imageWithExif,
  wrapX: true,
  // tileBounds: [-78.120282611, -75.191804486, 132.453327310, 68.846393966],
  url: 'http://localhost:5000/2023111700/2023111703/{z}/{x}/{y}/wind-surface.jpeg',
});

const layer = new mapboxWind.Layer('wind', tileSource, {
  styleSpec: {
    'fill-color': [
      'interpolate',
      ['step', 1],
      ['get', 'value'],
      0, '#fff',
      104, '#fff',
    ],
    'opacity': [
      'interpolate',
      ['exponential', 0.5],
      ['zoom'],
      1,
      1,
      2,
      1
    ],
    numParticles: [
      'interpolate',
      ['exponential', 0.5],
      ['zoom'],
      0, // zoom
      65535 / 8, // numParticles
      8, // zoom
      65535 / 16 // numParticles
    ],
    ...particlesConfig,
  },
  renderFrom: mapboxWind.RenderFrom.rg,
  displayRange: [0, 104],
  renderType: mapboxWind.RenderType.particles,
  // mask: {
  //   data: clip,
  //   // type: mapboxWind.MaskType.outside,
  //   type: mapboxWind.MaskType.inside, // 默认是 inside，即只显示范围内的
  // }
});

map.addLayer(layer);
```

### arrow

```js
const tileSource = new mapboxWind.TileSource('wind', {
  tileSize: 256,
  minZoom: 0,
  maxZoom: 4,
  roundZoom: true,
  decodeType: mapboxWind.DecodeType.imageWithExif,
  wrapX: true,
  // tileBounds: [-78.120282611, -75.191804486, 132.453327310, 68.846393966],
  url: 'http://localhost:5000/2023111700/2023111703/{z}/{x}/{y}/wind-surface.jpeg',
});

const layer = new mapboxWind.Layer('wind', tileSource, {
  styleSpec: {
    'fill-color': [
      'interpolate',
      ['step', 1],
      ['get', 'value'],
      ...interpolateColor
      // 0, '#fff',
      // 104, '#fff',
    ],
    'opacity': 1,
    space: 20,
    size: [12, 10],
  },
  renderFrom: mapboxWind.RenderFrom.rg,
  displayRange: [0, 104],
  renderType: mapboxWind.RenderType.arrow,
  // mask: {
  //   data: clip,
  //   // type: mapboxWind.MaskType.outside,
  //   type: mapboxWind.MaskType.inside, // 默认是 inside，即只显示范围内的
  // }
});

map.addLayer(layer);
```

## 数据源

数据源支持 3 类

1. TileSource：瓦片数据源（墨卡托）
2. ImageSource：单张图片（墨卡托）
3. TimelineSource：时序数据源

以上三类仅仅是数据源不同，图层使用方式是一致的

---
_Source: https://npm.io/package/@sakitam-gis/mapbox-wind · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
