Skip to content

About

Visualize velocity layers such as wind, ocean currents, and waves using Leaflet and MapLibre.

Resources

Stars

4 stars

Watchers

1 watching

Forks

 
 

Repository files navigation

IH-Velocity-TS

A TypeScript fork of leaflet-velocity-ts, now extended and reorganized to support both Leaflet and MapLibre with a clean separation between core logic and mapping libraries.

This plugin allows for the visualization of velocity fields such as wind or ocean currents in both Leaflet and MapLibre maps. It features a 🌊 wave visualization mode and a modular architecture for easy integration.

Screenshot


🔄 What's New in This Fork?

  • MapLibre Support:

    • Use velocity layers natively in MapLibre maps with a dedicated entry point.
  • Wave Mode & API Extensions:

    • Wave-style particle animations and height visualization.
    • Additional options for wave display and control panel.

    Screenshot


✨ Usage

MapLibre

import { MapLibreVelocityLayer } from "ih-velocity-ts/maplibre";
const layer = new MapLibreVelocityLayer({
  // ...options (see below)
});

Leaflet

import "ih-velocity-ts/leaflet";
const layer = L.velocityLayer({
  // ...options (see below)
});

Common Options Example

{
  displayValues: true,
  displayOptions: {
    velocityType: "Global Wind",
    position: "bottomleft",
    emptyString: "No data",
    angleConvention: "bearingCW",
    showCardinal: true,
    speedUnit: "m/s",
    directionString: "Direction",
    speedString: "Speed",
    heightString: "Height",   // 🌊 Wave-specific
    heightUnit: "m"           // 🌊 Wave-specific
  },
  data: data, // see demo/*.json or use a compatible data service

  minVelocity: 0,
  maxVelocity: 10,
  velocityScale: 0.005,
  colorScale: [],
  opacity: 0.97,
  paneName: "overlayPane",
  particlelineWidth: 1.9,

  // 🌊 WAVE MODE CONFIG
  waveMode: true,
  wavesParticlesSeparation: 3.5
}

🌊 Wave Mode Details

When waveMode is enabled:

  • Particles animate with wave-like appearance rather than simple motion streaks.
  • Wave Height is read from the third data parameter (typically [u, v, height]) and used to scale the wave particles by size and color.
  • Control Panel includes height data (if available), displaying wave intensity alongside speed and direction.

Additional Wave Options

Option Type Default Description
waveMode boolean false Enable wave visualization mode.
wavesParticlesSeparation number 3.5 Controls the spacing between particles in wave mode.
heightString string "Height" Label prefix for wave height in the control.
heightUnit string "m" Unit of wave height displayed in the control.

📦 Public methods

Method Params Description
setData {Object} Update the layer with new data
setOptions {Object} Update the layer with new options

🧪 Development

npm install
npm run watch

📚 License and Credits

This project is a fork of leaflet-velocity-ts, which itself is a fork of leaflet-velocity, originally developed by CSIRO.

Project Lineage

  • 📦 leaflet-velocity – Original plugin developed under CSIRO license.
  • 🧪 leaflet-velocity-ts – TypeScript rewrite with performance and compatibility improvements.
  • 🌊 ih-velocity-ts – This fork adds wave representation and MapLibre support with a modular architecture.

License Summary

ih-velocity-ts is released under the CSIRO License.

Original License Notice from CSIRO

Redistribution and use in source and binary forms, with or without modification, are permitted under specific terms. See the full CSIRO License for details.


🤝 Contributions

This fork is open to contributions. Feel free to open an issue or submit a pull request if you'd like to suggest improvements or report bugs.

About

Visualize velocity layers such as wind, ocean currents, and waves using Leaflet and MapLibre.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages