Arrow layer
The ArrowLayer contains both a background to which is applied a color ramp and a set of moving arrow-shaped particles, for this reason, the constructor ArrowLayer has more options that then other weather layers.
Constructor
Extends: Intesity layer
Parameters
options.decodeChannels
default:
"rg" |
Channels to read the UV values from. |
---|---|
options.decodeAsWaves
default: false
|
Decode the channels as "direction + period" rather than "UV".
If true , the first channel is assumed to be direction (0-360deg) and the second to be the period (1/speed).
|
options.decodeMin
default: 0
|
Minimum encoded value. |
options.decodeMax
default: 1
|
Maximum encoded value. |
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.color
RgbaColor
default:
[255, 255, 255, 192] |
Color of the arrows. RGB[A] - Array of 3-4 numbers. 0-255 per channel. |
options.fastColor
RgbaColor
default: same as color
|
Color of the arrows when moving "fast". RGB[A] - Array of 3-4 numbers. 0-255 per channel. |
options.fastSpeed | What is considered "fast" (in px/sec) for coloring purposes. Only makes sense when fastColor is used. |
options.density
default: 2
|
Number of arrows visible per 1000 px^2. |
options.pixelRatio
default: 2 for normal displays and 1 for HiDPI displays
|
Use more pixels to make arrows more smooth (especially when tilted). |
options.size
default: 1.5
|
Size of the arrow. |
options.speed
default: 0.001
|
Speed factor of the arrows. |
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.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.
|
options.worldSpaceFactor
default: 0.005
|
Only used if worldSpaceConstant
is set to true . The factor is used to reduce the speed of the arrows.
|
options.speedWeightedByVectorNorm
default: true
|
If true , the arrow speed will be weighted by the norm of the UV vector.
If false , he arrow speed is only defined by the options speed .
|
options.scaleSize
default: true
|
Should the size of the arrow be scaled.
If If
If an object of shape
If |
null
, the same data will also be displayed as raster.
Methods
Check out the Layers method reference
This function is called in the constructor if it receives the options.
This function is useful for initializing a layer with data that comes from an asynchronous function.
For example: used in the onAdd
function of the layer after fetching the data from the MapTiler cloud.
TileLayerOptions
)
: Options specific to the intensity visualization. Same as the layer constructor
ArrowLayerOptions
)
: Options specific to the arrows visualization. Same as the layer constructor
ColoringFragmentBase[]
)
: If not null, the same data will also be displayed as raster. Same as the layer constructor
Define the size of the largest (fastest) arrows. Due to WebGL limitation the max size is often of 64 pixels on low density monitors and 32 pixels on hight density monitor (ie. HiDPI and Retina).
Define the refresh interval of the particle in ms.
Returns the ratio between the number of actually visible particle (to statisfy the specified density) and the maximum amount (maxAmount).
Value >1 mean that more particles would be utilized if availabe.
Useful for debugging and fine-tuning client application.
number
: ratio between the number of actually visible particle and the maximum amount.
Set the density of the arrows. The maximum value is bounded by the constructor parameter maxAmount. To make the maximum larger, maxAmount must be higher (may impact performance on lower end devices).
Defines wether the arrows' speed should be proportional to world distnace (true) or to screen distance (false). When using world space, the speed will appear faster on screen as we zoom in. When using screen space, the arrows will keep the same speed regardless of the zoom level.