Wind arrow layer
The WindArrowLayer
shows the wind speed in meter per second (m/s). Forecast for speed and direction at an altitude of 10 m above ground.
The WindArrowLayer contains both a background to which is applied a color ramp and a set of moving arrow-shaped particles, for this reason, the constructor WindArrowLayer has more options that then other weather layers.
Example
Extends: Arrow layer
Parameters
Options to provide to the Layer constructor
(WindArrowLayerOptions)
options.id
default: "MapTiler Arrow Wind"
|
ID of the layer |
---|---|
options.colorramp
ColorRamp
default:
ColorRamp.builtin.VIRIDIS |
Colormap to use. Maximum range possible spans from 0 m/s to 75 m/s. Default spans from 0 m/s to 40 m/s |
options.opacity
default: 0.8
|
Opacity of the layer in [0, 1] |
options.smooth
default: true
|
Whether or not the colorramp must be smooth |
options.color
RgbaColor
default: [255, 255, 255, 192]
|
Color of the arrows when slow. RGBA 0-255. |
options.fastColor
RgbaColor
default: [255, 255, 255, 192]
|
Color of the arrows when moving "fast". RGBA 0-255. |
options.density
default: 2
|
Number of arrows visible per 1000 px^2 |
options.fadeFactor
default: 0.1
|
How much the particles fade over time |
options.fastSpeed
default: 0.8
|
What is considered "fast" (in px/sec) for coloring purposes. Only makes sense when fastColor is used |
options.maxAmount
default: 128
|
Quantity of arrows to be created. Has to be a power of 2 and at least 4. The actual exact number will be arrows * arrows.
Try to keep this value as low as possible to optimize performance.
The number of actually visible arrows is determined by density.
|
options.pixelRatio
default: 2 for normal displays and 1 for HiDPI displays
|
Use more pixels to make particles more smooth (especially when tilted) |
options.refreshInterval
default: 800
|
Time interval (in milliseconds) how often the arrows are refreshed to avoid degradation. Random 1/4 of the arrows is always randomly reset |
options.rttTimestep
default: 200
|
Timestep between arrows render - shorter value means smoother direction change, but can lead to errors in speed computation (current speed is derived from movement on screen) which cause size and color glitches. |
options.size
default: 18
|
Size of the arrows |
options.speed
default: 0.001
|
Speed factor of the arrows |
options.worldSpaceConstant
default: false
|
The world space constant (when true ) means the speed of the arrows is compensated with the zoom level so that they travel the same real world distance per unit of time.
When false , the arrows travel the same distance in screen space, so that regardless the zoom level, they will travel a constant number of pixels per unit of time.
|
Methods
Check out the Layers method reference
Get the wind speed and direction in multiple measurement units at a given location
Object
: the value(s) as an object.
compassDirection | Conventionnaly, wind direction is refered as where the wind comes from. For instance a north wind is a wind coming from the north. This property retrieves one of the 16 compass direction. |
---|---|
directionAngle | Angular direction in dregree towards which the wind is blowing, with:
|
speedFeetPerSecond | Wind speed in ft/s (feet per second) |
speedKilometersPerHour | Wind speed in km/h (kilometer per hour) |
speedKnots | Wind speed in knots (nautical miles per hour) |
speedMetersPerSecond | Wind speed in m/s (meters per second) |
speedMilesPerHour | Wind speed in mph (miles per hour) |
Events
Check out the Layers events reference