@maptiler/weather
Version:
Weather layers for MapTiler Cloud and MapTiler SDK
117 lines (116 loc) • 3.26 kB
TypeScript
import { ColorRamp } from '../../core/ColorRamp';
import { RgbaColor } from '../../utils';
/**
* Type as returned by the `.pickAt()` method
*/
type WindPickAt = {
/**
* Wind speed in m/s (meters per second)
*/
speedMetersPerSecond: number;
/**
* Wind speed in km/h (kilometer per second)
*/
speedKilometersPerHour: number;
/**
* Wind speed in mph (miles per hour)
*/
speedMilesPerHour: number;
/**
* Wind speed in ft/s (feet per second)
*/
speedFeetPerSecond: number;
/**
* Wind speed in knots (nautical miles per hour)
*/
speedKnots: number;
/**
* Angular direction in dregree towards which the wind is blowing, with:
* - `0°`: true north
* - `90°`: east
* - `180°`: south
* - `270°`: west
*/
directionAngle: number;
/**
* 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.
*/
compassDirection: string;
};
type WindLayerOptions = {
/**
* ID of the layer
*/
id?: string;
/**
* Quantity of particles to be created. Default value is `128`.
* Has to be a power of 2 and at least `4`.
* The actual exact number will be `particles * particles`.
* Try to keep this value as low as possible to optimize performance.
*
* The number of actually visible particles is determined by {@link density}.
*/
maxAmount?: number;
/**
* Color of the particle. RGBA 0-255. Defaults to `[255, 255, 255, 192]`
*/
color?: RgbaColor;
/**
* Color of the particle when moving "fast". RGBA 0-255. Defaults to {@link color}
*/
fastColor?: RgbaColor;
/**
* What is considered "fast" (in px/sec) for coloring purposes.
* Only makes sense when {@link fastColor} is used.
*/
fastSpeed?: number;
/**
* Number of particles visible per 1000 px^2. Default is `2`.
*/
density?: number;
/**
* Use more pixels to make particles more smooth (especially when tilted).
* Defaults to `2` for normal displays and `1` for HiDPI displays.
*/
pixelRatio?: number;
/**
* Size of the particle. Defaults to `1.5`
*/
size?: number;
/**
* Speed factor of the particles. Defaults to `0.001`
*/
speed?: number;
/**
* Time interval (in milliseconds) how often the particles
* are refreshed to avoid degradation.
* Random `1/16` of the particles is always randomly reset.
* Default value is `800`.
*/
refreshInterval?: number;
/**
* How much the particles fade over time.
* Default value is `0.1`.
*/
fadeFactor?: number;
/**
* Opacity of the layer in [0, 1]
*/
opacity?: number;
/**
* Colormap to use
*/
colorramp?: ColorRamp;
/**
* Whether or not the colorramp shows interpolated colors
*/
smooth?: boolean;
/**
* If this is `true`, the particles gets slighly larger as they become faster.
* Default: `false`
*/
fastIsLarger?: boolean;
};
export type { WindPickAt, WindLayerOptions };