Coder Social home page Coder Social logo

mabhub / deck.gl-particle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from weatherlayers/deck.gl-particle

0.0 0.0 0.0 2.03 MB

Particle simulation layer for deck.gl

Home Page: https://weatherlayers.github.io/deck.gl-particle/

License: Mozilla Public License 2.0

JavaScript 100.00%

deck.gl-particle's Introduction

deck.gl-particle

Particle simulation layer for deck.gl

Demo

Screenshot

Usage

import { Deck } from '@deck.gl/core';
import { ParticleLayer } from 'deck.gl-particle';

const deckgl = new Deck({
  layers: [
    new ParticleLayer({
      id: 'particle',
      image: ..., // see deck.gl BitmapLayer image property
      imageUnscale: ..., // [number, number]
      bounds: ..., // [number, number, number, number]
      numParticles: ..., // number
      maxAge: ..., // number
      speedFactor: ..., // number
      color: ..., // [number, number, number]
      width: ..., // number
      opacity: ..., // number
    });
  ],
});

Requires WebGL 2 (Chrome, Firefox, Edge, Safari 15).

This means that the layer doesn't work in a WebGL 1 interleaved context (such as Mapbox). Use overlaid context instead. See deck.gl base maps.

Data

Image contains particle speeds in deck.gl COORDINATE_SYSTEM.LNGLAT, u component encoded into R channel, v component encoded into G channel. See sample image. The image texture can be generated with the following commands, with u.grib and v.grib files as input:

gdalbuildvrt -separate wind_data.vrt u.grib v.grib v.grib
gdal_translate -ot Byte -scale -128 127 0 255 wind_data.vrt wind_data.png

Pass the generated image texture, the original data bounds and the geographic bounds to ParticleLayer:

  image: 'wind_data.png',
  imageUnscale: [-128, 127],
  bounds: [-180, -90, 180, 90],

Inspired by

Weather map visualization layers as a service

There is a commercial library with particle layer improvements and additional layers available with WeatherLayers.com subscription.

deck.gl-particle's People

Contributors

zakjan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.