Git Product home page Git Product logo

leaflet-velocity's Introduction

leaflet-velocity NPM version NPM Downloads

A plugin for Leaflet (v1.0.3, and v0.7.7) to create a canvas visualisation layer for direction and intensity of arbitrary velocities (e.g. wind, ocean current).

Live Demo: https://danwild.github.io/leaflet-velocity/

  • Uses a modified version of WindJS for core functionality.
  • Similar to wind-js-leaflet, however much more versatile (provides a generic leaflet layer, and not restricted to wind).
  • Data input format is the same as output by wind-js-server, using grib2json.

Screenshot

Example use:

var velocityLayer = L.velocityLayer({
	
	displayValues: true,
	displayOptions: {
		velocityType: 'Global Wind',
		position: 'bottomleft',
		emptyString: 'No velocity data',
		angleConvention: 'bearingCW',
		displayPosition: 'bottomleft',
		displayEmptyString: 'No velocity data',
		speedUnit: 'kt'
	},
	data: data,           // see demo/*.json, or wind-js-server for example data service
	
	// OPTIONAL
	minVelocity: 0,       // used to align color scale
	maxVelocity: 10,      // used to align color scale
	velocityScale: 0.005, // modifier for particle animations, arbitrarily defaults to 0.005
	colorScale: [],       // define your own array of hex/rgb colors
	onAdd: null,          // callback function
	onRemove: null,       // callback function

	// optional pane to add the layer, will be created if doesn't exist
	// leaflet v1+ only (falls back to overlayPane for < v1)
	paneName: 'overlayPane'
});

The angle convention option refers to the convention used to express the wind direction as an angle from north direction in the control. It can be any combination of bearing (angle toward which the flow goes) or meteo (angle from which the flow comes), and CW (angle value increases clock-wise) or CCW (angle value increases counter clock-wise). If not given defaults to bearingCCW.

The speed unit option refers to the unit used to express the wind speed in the control. It can be m/s for meter per second, k/h for kilometer per hour or kt for knots. If not given defaults to m/s.

Public methods

method params description
setData data: {Object} update the layer with new data
setOptions options: {Object} update the layer with new options

Build / watch

npm run watch

Reference

leaflet-velocity is possible because of things like:

Example data

Data shown for the Great Barrier Reef has been derived from CSIRO's eReefs products

License

MIT License (MIT)

leaflet-velocity's People

Contributors

brentfraser avatar claustres avatar danwild avatar pvernier avatar

Watchers

 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.