@xweather/mapsgl 1.8.4 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mapsgl.d.ts CHANGED
@@ -546,6 +546,8 @@ declare const enum ShaderType {
546
546
  FRAGMENT = "fragment"
547
547
  }
548
548
 
549
+ export declare const sharedFPSMeter: FPSMeter;
550
+
549
551
  export declare type Size = {
550
552
  width: number;
551
553
  height: number;
@@ -1064,7 +1066,7 @@ export declare class Animation extends EventDispatcher {
1064
1066
  /**
1065
1067
  * Stops the animation and resets it to its original starting position.
1066
1068
  */
1067
- stop(): void;
1069
+ stop(advanceToStopPosition?: boolean): void;
1068
1070
  /**
1069
1071
  * Restarts the animation from the beginning if it is currently playing.
1070
1072
  */
@@ -1207,6 +1209,8 @@ export declare type AnimationState = ObjectValue<typeof AnimationState>;
1207
1209
  export declare type AnyAuthenticator = Authenticator<any>;
1208
1210
 
1209
1211
  export declare type AnyMapController = MapController<any>;
1212
+
1213
+ export declare type AnyTileCache = TileCache<any>;
1210
1214
 
1211
1215
  /**
1212
1216
  * An enumerated value representing an API endpoint action.
@@ -1693,15 +1697,6 @@ export declare class Bounds {
1693
1697
  constructor(left: number, right: number, top: number, bottom: number);
1694
1698
  }
1695
1699
 
1696
- /**
1697
- * Defines the granularity of subdivision for circles with `circle-pitch-alignment: 'map'` and for heatmap kernels.
1698
- * More subdivision will cause circles to more closely follow the planet's surface.
1699
- *
1700
- * Possible values: 1, 3, 5, 7.
1701
- * Subdivision of 1 results in a simple quad.
1702
- */
1703
- export declare type CircleGranularity = 1 | 3 | 5 | 7;
1704
-
1705
1700
  /**
1706
1701
  * Circle style properties control how circles get rendered on a map. Use these properties in conjunction with `fill`
1707
1702
  * and `stroke` to define the style for a circle layer.
@@ -1860,6 +1855,10 @@ export declare interface ColorScaleOptions {
1860
1855
  */
1861
1856
  masks?: Array<ColorMaskOptions>;
1862
1857
  }
1858
+
1859
+ export declare class ConstantStyleValue<T> extends StyleValue_2<T> {
1860
+ constructor(value: T | any[] | StyleEvaulatorFunction<T>);
1861
+ }
1863
1862
 
1864
1863
  /**
1865
1864
  * Contour style properties control how contoured data gets rendered on a map. Contour layers are rendered by sampling
@@ -1876,7 +1875,13 @@ export declare interface ContourStyleSpec {
1876
1875
  * major contour lines will not be rendered. This value must be in the same units as the data source.
1877
1876
  */
1878
1877
  majorInterval: StyleValue<number>;
1878
+ /**
1879
+ * The width of the contour lines in pixels.
1880
+ */
1879
1881
  width: StyleValue<number>;
1882
+ /**
1883
+ * The width of the major contour lines in pixels.
1884
+ */
1880
1885
  majorWidth: StyleValue<number>;
1881
1886
  scale: StyleValue<number>;
1882
1887
  offset: StyleValue<number>;
@@ -1890,7 +1895,9 @@ export declare interface ControlStore {
1890
1895
  dataInspector: DataInspectorControl;
1891
1896
  }
1892
1897
 
1893
- declare const convert: (type: string, value: number, from: string, to: string) => number;
1898
+ export declare type ConversionMeasurement = Measurement | 'temperature-change';
1899
+
1900
+ declare const convert: (type: ConversionMeasurement | string, value: number, from: string, to: string) => number;
1894
1901
 
1895
1902
  export declare type Coordinate = {
1896
1903
  lat: number;
@@ -1913,6 +1920,9 @@ declare const CtoF: (c: number) => number;
1913
1920
 
1914
1921
  declare const CtoFUnit: (c: number) => number;
1915
1922
 
1923
+ export declare class DataDrivenStyleValue<T> extends StyleValue_2<T> {
1924
+ }
1925
+
1916
1926
  export declare interface DataEvaluator {
1917
1927
  title: string | ((data: FeatureQueryResult) => string);
1918
1928
  alwaysShow?: boolean;
@@ -1956,6 +1966,7 @@ export declare class DataInspectorControl {
1956
1966
  export declare interface DataInspectorControlOptions {
1957
1967
  event: 'click' | 'move';
1958
1968
  stream: boolean;
1969
+ showCoordinates: boolean;
1959
1970
  tooltip: any;
1960
1971
  }
1961
1972
 
@@ -2101,9 +2112,11 @@ export declare interface Disposable {
2101
2112
  * @template Task - The download task type that extends DownloadTask
2102
2113
  */
2103
2114
  export declare class DownloadManager<Task extends DownloadTask<any>> extends EventDispatcher {
2115
+ id: string;
2104
2116
 
2105
2117
  /**
2106
2118
  * Gets the progress tracker for download operations.
2119
+ * Progress is calculated from actual task states for accuracy.
2107
2120
  * @returns The Progress instance tracking download statistics.
2108
2121
  */
2109
2122
  get progress(): Progress;
@@ -2116,7 +2129,7 @@ export declare class DownloadManager<Task extends DownloadTask<any>> extends Eve
2116
2129
  * @param options.defaultConcurrency - Default maximum concurrent downloads. Defaults to 16.
2117
2130
  * @param options.perHostConcurrency - Per-host concurrency limits, keyed by host name.
2118
2131
  */
2119
- constructor(options?: Partial<DownloadManagerOptions<TaskData<Task>>>);
2132
+ constructor(options?: Partial<DownloadManagerOptions<Task>>);
2120
2133
  /**
2121
2134
  * Checks if a task result exists in the cache.
2122
2135
  * @param key - The unique identifier for the task.
@@ -2129,12 +2142,6 @@ export declare class DownloadManager<Task extends DownloadTask<any>> extends Eve
2129
2142
  * @returns The cached task data, or undefined if not found.
2130
2143
  */
2131
2144
  get(key: string): TaskData<Task> | undefined;
2132
- /**
2133
- * Sets the tile fetcher function to use for requests.
2134
- * The fetcher function should return a Promise that resolves with a Response object.
2135
- * @param fetcher -
2136
- */
2137
- setFetcher(fetcher: Fetcher<Task>): void;
2138
2145
  /**
2139
2146
  * Sets the task runner function used to execute download tasks.
2140
2147
  * @param runner - The task runner function that handles task execution with retry logic.
@@ -2160,13 +2167,15 @@ export declare class DownloadManager<Task extends DownloadTask<any>> extends Eve
2160
2167
  * @param predicate - A callback that receives a task and returns true for a match.
2161
2168
  */
2162
2169
  hasTask(predicate: (task: Task) => boolean): boolean;
2170
+ private _totalTasks;
2163
2171
  /**
2164
2172
  * Adds a task to the download queue and optionally starts processing.
2165
2173
  * Tasks are organized by host for per-host concurrency control and sorted by priority.
2166
2174
  * @param task - The download task to enqueue.
2167
2175
  * @param start - If true, immediately starts processing the queue. Defaults to true.
2176
+ * @param isRetry - If true, this is a retry and should not increment total. Defaults to false.
2168
2177
  */
2169
- enqueue(task: Task, start?: boolean): void;
2178
+ enqueue(task: Task, start?: boolean, isRetryParam?: boolean): void;
2170
2179
  /**
2171
2180
  * Aborts a specific download task.
2172
2181
  * If the task is in-flight, the request is aborted. If pending, it's removed from the queue.
@@ -2179,6 +2188,9 @@ export declare class DownloadManager<Task extends DownloadTask<any>> extends Eve
2179
2188
  * @param predicate - A callback that receives a task and returns true if it should be aborted.
2180
2189
  */
2181
2190
  abortWhere(predicate: (task: Task) => boolean): void;
2191
+ /**
2192
+ * Aborts all tasks.
2193
+ */
2182
2194
  abortAll(): void;
2183
2195
 
2184
2196
  }
@@ -2413,16 +2425,25 @@ export declare interface EncodedRasterDataset {
2413
2425
  */
2414
2426
  export declare interface EncodedSourceSpecification<Dataset extends EncodedRasterDataset> extends TileSourceSpecification {
2415
2427
  /**
2416
- * The datasets that are encoded in the tile data.
2428
+ * The datasets that are encoded in the tile data. These are used for requesting tiles from the server.
2429
+ * If the data is transformed (e.g., converting precip to snowfall), use `effectiveDatasets` to provide
2430
+ * the transformed datasets with updated dataMin/dataMax values for operations and rendering.
2417
2431
  */
2418
2432
  datasets: Array<Partial<Dataset>>;
2433
+ /**
2434
+ * The effective datasets used for operations and rendering. If not provided, defaults to `datasets`.
2435
+ * Use this when data transformations change the dataMin/dataMax values (e.g., converting precipitation
2436
+ * to snowfall). The original `datasets` are still used for tile requests.
2437
+ */
2438
+ effectiveDatasets?: Array<Partial<Dataset>>;
2419
2439
  /**
2420
2440
  * Optional function to transform tile data after it has been loaded. This allows for custom processing or
2421
2441
  * modification of the tile data before it is used for rendering, such as converting it to other values
2422
2442
  * derived from the original encoded data.
2423
2443
  * @param data - The loaded tile data as an RGBA image.
2424
2444
  * @param datasets - An array of dataset objects associated with this source, which contains information about the
2425
- * original encoded data and its value ranges.
2445
+ * original encoded data and its value ranges. This array can be modified in-place to update dataMin/dataMax
2446
+ * values for transformed data.
2426
2447
  */
2427
2448
  transformTileData?: (data: RGBAImage, datasets: Array<Dataset>) => void;
2428
2449
  }
@@ -2438,10 +2459,15 @@ export declare class EncodedTileSource<Source extends EncodedSourceSpecification
2438
2459
  shouldUseTimesFromMetadata: boolean;
2439
2460
  maxTextureSize: number;
2440
2461
  private _worker;
2462
+ private _aggregateProgress;
2441
2463
 
2442
2464
  get type(): string;
2465
+ get operation(): TimeSeriesOperationType;
2443
2466
  constructor(id: string, spec: Partial<Source>);
2444
2467
 
2468
+ shouldRequestTile(tile: Tile<EncodedTileData>, reload?: boolean, intervals?: Array<Date>): boolean;
2469
+ abortTileByCoord(coord: TileCoord): void;
2470
+
2445
2471
  /**
2446
2472
  * Returns the metadata for the specified band, if available.
2447
2473
  * @param band - The band to get metadata for.
@@ -2456,6 +2482,7 @@ export declare class EncodedTileSource<Source extends EncodedSourceSpecification
2456
2482
  */
2457
2483
  getDataRange(band: SampleChannel): ValueRange;
2458
2484
 
2485
+ protected onLoadProgress(e: any): void;
2459
2486
  }
2460
2487
 
2461
2488
  /**
@@ -2466,24 +2493,17 @@ export declare class EncodedTileSource<Source extends EncodedSourceSpecification
2466
2493
  */
2467
2494
  declare const equalUnits: (units1: MapUnits, units2: MapUnits) => boolean;
2468
2495
 
2469
- export declare type ExpressionInputType = string | number | boolean | ExpressionLookupType;
2470
-
2471
- export declare type ExpressionLookupType = [
2472
- 'get',
2473
- string,
2474
- ...(ExpressionLookupType)[]
2475
- ] | [
2476
- 'has',
2477
- string,
2478
- ...(ExpressionLookupType)[]
2479
- ] | [
2480
- 'at',
2481
- number,
2482
- Array<any>
2483
- ] | [
2484
- 'length',
2485
- string | number | Array<any>
2486
- ];
2496
+ /**
2497
+ * Mapbox-style expression: operator name followed by arguments.
2498
+ * Arguments may be literals or nested expressions (recursive).
2499
+ */
2500
+ export declare type Expression = [ExpressionOperator, ...ExpressionValue[]];
2501
+
2502
+ /**
2503
+ * Mapbox-style expression array, e.g. ['get', 'opacity'] or ['*', ['get', 'x'], 2].
2504
+ * Allowed in style config; converted to DataDrivenStyleValue in the PaintStyle constructor.
2505
+ */
2506
+ export declare type ExpressionArray = any[];
2487
2507
 
2488
2508
  /**
2489
2509
  * Defines a custom expression operation to calculate the result of a custom expression function. The custom expression
@@ -2527,44 +2547,82 @@ export declare interface ExpressionOperation {
2527
2547
  chunk: string;
2528
2548
  }
2529
2549
 
2530
- export declare type ExpressionSpecification = [
2531
- '!',
2532
- ExpressionInputType
2533
- ] | [
2534
- '==',
2535
- ExpressionInputType,
2536
- ExpressionInputType
2537
- ] | [
2538
- '!=',
2539
- ExpressionInputType,
2540
- ExpressionInputType
2541
- ] | [
2542
- '>',
2543
- ExpressionInputType,
2544
- ExpressionInputType
2545
- ] | [
2546
- '>=',
2547
- ExpressionInputType,
2548
- ExpressionInputType
2549
- ] | [
2550
- '<',
2551
- ExpressionInputType,
2552
- ExpressionInputType
2553
- ] | [
2554
- '<=',
2555
- ExpressionInputType,
2556
- ExpressionInputType
2557
- ] | [
2558
- 'in',
2559
- ExpressionInputType,
2560
- ...(ExpressionInputType | ExpressionInputType[])[]
2561
- ] | [
2562
- 'all',
2563
- ...(boolean | ExpressionSpecification)[]
2564
- ] | [
2565
- 'any',
2566
- ...(boolean | ExpressionSpecification)[]
2567
- ];
2550
+ /**
2551
+ * Supported expression operator names (first element of an expression array).
2552
+ * @see evaluateExpression
2553
+ */
2554
+ declare const ExpressionOperator: {
2555
+ readonly literal: "literal";
2556
+ readonly get: "get";
2557
+ readonly has: "has";
2558
+ readonly var: "var";
2559
+ readonly properties: "properties";
2560
+ readonly zoom: "zoom";
2561
+ readonly coalesce: "coalesce";
2562
+ readonly eq: "==";
2563
+ readonly neq: "!=";
2564
+ readonly lt: "<";
2565
+ readonly lte: "<=";
2566
+ readonly gt: ">";
2567
+ readonly gte: ">=";
2568
+ readonly not: "!";
2569
+ readonly all: "all";
2570
+ readonly any: "any";
2571
+ readonly toNumber: "to-number";
2572
+ readonly toString: "to-string";
2573
+ readonly toLocaleString: "to-locale-string";
2574
+ readonly toUnit: "to-unit";
2575
+ readonly toBoolean: "to-boolean";
2576
+ readonly typeOf: "typeof";
2577
+ readonly number: "number";
2578
+ readonly string: "string";
2579
+ readonly boolean: "boolean";
2580
+ readonly object: "object";
2581
+ readonly add: "+";
2582
+ readonly subtract: "-";
2583
+ readonly mod: "%";
2584
+ readonly pow: "^";
2585
+ readonly multiply: "*";
2586
+ readonly divide: "/";
2587
+ readonly abs: "abs";
2588
+ readonly ceil: "ceil";
2589
+ readonly floor: "floor";
2590
+ readonly round: "round";
2591
+ readonly min: "min";
2592
+ readonly max: "max";
2593
+ readonly sqrt: "sqrt";
2594
+ readonly ln: "ln";
2595
+ readonly ln2: "ln2";
2596
+ readonly log2: "log2";
2597
+ readonly log10: "log10";
2598
+ readonly sin: "sin";
2599
+ readonly cos: "cos";
2600
+ readonly tan: "tan";
2601
+ readonly asin: "asin";
2602
+ readonly acos: "acos";
2603
+ readonly atan: "atan";
2604
+ readonly e: "e";
2605
+ readonly pi: "pi";
2606
+ readonly at: "at";
2607
+ readonly in: "in";
2608
+ readonly regex: "regex";
2609
+ readonly indexOf: "index-of";
2610
+ readonly length: "length";
2611
+ readonly slice: "slice";
2612
+ readonly concat: "concat";
2613
+ readonly downcase: "downcase";
2614
+ readonly upcase: "upcase";
2615
+ readonly step: "step";
2616
+ readonly interpolate: "interpolate";
2617
+ readonly case: "case";
2618
+ readonly match: "match";
2619
+ readonly let: "let";
2620
+ };
2621
+
2622
+ export declare type ExpressionOperator = ObjectValue<typeof ExpressionOperator>;
2623
+
2624
+ /** Value that can appear as an expression or as an argument (literal or nested expression). */
2625
+ export declare type ExpressionValue = string | number | boolean | null | object | Expression;
2568
2626
 
2569
2627
  export declare type FeatureQueryResult = {
2570
2628
  value: number;
@@ -2592,7 +2650,7 @@ export declare interface FillStyleSpec {
2592
2650
  /**
2593
2651
  * Color of the fill.
2594
2652
  */
2595
- color: StyleValue<string | Color | StyleExpression>;
2653
+ color: StyleValue<string | Color>;
2596
2654
  /**
2597
2655
  * The image to use for the fill pattern. Can be an image identifier string or a {@link RemoteSymbolImage}.
2598
2656
  * @remarks
@@ -2613,6 +2671,14 @@ export declare interface FillStyleSpec {
2613
2671
  */
2614
2672
  sort: string | SortProperty;
2615
2673
  }
2674
+
2675
+ /**
2676
+ * Mapbox-style filter expression array. Evaluates to boolean (feature included when truthy).
2677
+ * Use with StyleExpression for evaluation. Supports decision expressions (==, !=, <, <=, >, >=,
2678
+ * all, any, !, in, regex, case, match, etc.) and property lookups (get, has).
2679
+ * @see StyleExpression
2680
+ */
2681
+ export declare type FilterExpression = ExpressionValue;
2616
2682
 
2617
2683
  declare const FtoC: (f: number) => number;
2618
2684
 
@@ -2769,8 +2835,18 @@ export declare type GeoJsonProperties = {
2769
2835
 
2770
2836
  /**
2771
2837
  * A subclass of {@link VectorTileSource} that is used to represent GeoJSON data.
2838
+ *
2839
+ * This source tracks a single in-flight data update (`pendingDataUpdate`) to make update
2840
+ * lifecycle events deterministic when remote loads and `setData()` calls overlap. The revision-
2841
+ * based update state prevents duplicate or out-of-order `DATA_UPDATE_*` events, avoids stale
2842
+ * async completions mutating newer state, and reduces no-op update churn during rapid updates.
2772
2843
  */
2773
2844
  export declare class GeoJSONSource extends VectorTileSource {
2845
+ private static readonly DATA_UPDATE_ERROR_MESSAGE;
2846
+ /**
2847
+ * Whether the GeoJSON data is dynamic, meaning it will be updated frequently. Default is `false`.
2848
+ */
2849
+ dynamic: boolean;
2774
2850
 
2775
2851
  private _transformGeoJSON?;
2776
2852
  get type(): string;
@@ -2783,8 +2859,15 @@ export declare class GeoJSONSource extends VectorTileSource {
2783
2859
  * The GeoJSON data associated with the source, either provided statically or from a remote source.
2784
2860
  */
2785
2861
  get data(): GeoJSONFeatureCollection;
2786
- private coalesce;
2787
- private pendingLoad;
2862
+ private needsUpdate;
2863
+ /**
2864
+ * The revision number of the data.
2865
+ */
2866
+ private dataRevision;
2867
+ /**
2868
+ * The pending data update being processed.
2869
+ */
2870
+ private pendingDataUpdate;
2788
2871
  constructor(id: string, spec: Partial<GeoJSONSourceSpecification>);
2789
2872
  /**
2790
2873
  * Sets the URL of the GeoJSON data.
@@ -2805,6 +2888,11 @@ export declare class GeoJSONSource extends VectorTileSource {
2805
2888
  expireAllTiles(): void;
2806
2889
  reload(): void;
2807
2890
  private updateWorkerData;
2891
+ private processWorkerUpdate;
2892
+ private beginDataUpdate;
2893
+ private flushQueuedDataUpdate;
2894
+ private completeDataUpdate;
2895
+ private failDataUpdate;
2808
2896
  }
2809
2897
 
2810
2898
  /**
@@ -2819,6 +2907,10 @@ export declare interface GeoJSONSourceSpecification extends SourceSpecification
2819
2907
  * The GeoJSON URL template string to use when requesting GeoJSON data.
2820
2908
  */
2821
2909
  url: string;
2910
+ /**
2911
+ * Whether the GeoJSON data is dynamic, meaning it will be updated frequently. Default is `false`.
2912
+ */
2913
+ dynamic?: boolean;
2822
2914
  /**
2823
2915
  * A function that transforms the GeoJSON data before it is sent to the worker for processing.
2824
2916
  * @param source - The GeoJSON source.
@@ -2840,7 +2932,7 @@ export declare type GeoJSONTypes = GeoJSON['type'];
2840
2932
  * @param system - The system to get the default unit for.
2841
2933
  * @returns The default unit for the given measurement and system.
2842
2934
  */
2843
- declare const getDefaultUnit: (type: Measurement, system: UnitSystem) => string;
2935
+ declare const getDefaultUnit: (type: ConversionMeasurement, system: UnitSystem) => string;
2844
2936
 
2845
2937
  /**
2846
2938
  * Returns the default units for the given system.
@@ -2858,6 +2950,8 @@ declare const getMeasurementType: (str: string) => Measurement | undefined;
2858
2950
  * @returns The system for the given units.
2859
2951
  */
2860
2952
  declare const getSystemForUnits: (units: MapUnits) => UnitSystem;
2953
+
2954
+ declare const getUnitPrecision: (unit: string) => number;
2861
2955
 
2862
2956
  export declare type GoogleMap = google.maps.Map;
2863
2957
 
@@ -2917,7 +3011,7 @@ export declare interface HeatmapStyleSpec {
2917
3011
  * Defines the normalized (`0` to `1`) color scale used to color pixels based on its density value, where `0`
2918
3012
  * is none and `1` being the highest density.
2919
3013
  */
2920
- color: Array<number | string>;
3014
+ color: StyleValue<Array<number | string>>;
2921
3015
  /**
2922
3016
  * Radius of influence of each data point in screen points.
2923
3017
  */
@@ -3252,7 +3346,7 @@ export declare type LayerMetadata = {
3252
3346
  sourceLayerId: string;
3253
3347
  sourceLayerType: string;
3254
3348
  type: string;
3255
- filter: ExpressionSpecification;
3349
+ filter: FilterExpression;
3256
3350
  paint: PaintStyle;
3257
3351
  options?: Record<string, unknown>;
3258
3352
  };
@@ -3333,13 +3427,15 @@ export declare interface LayerRenderer {
3333
3427
  * Called before the primary render method to perform any setup or rendering that needs to be done before
3334
3428
  * rendering, such as rendering to a framebuffer or updating compute passes.
3335
3429
  * @param elapsedTime - The render loop's elapsed time.
3430
+ * @param frameContext - Map and layer state for this frame; the renderer must use this instead of reading from the layer or map.
3336
3431
  */
3337
- prerender(elapsedTime: number): void;
3432
+ prerender(elapsedTime: number, frameContext: RenderFrameContext): void;
3338
3433
  /**
3339
3434
  * Render the layer's data.
3340
3435
  * @param elapsedTime - The render loop's elapsed time.
3436
+ * @param frameContext - Map and layer state for this frame; the renderer must use this instead of reading from the layer or map.
3341
3437
  */
3342
- draw(elapsedTime: number): void;
3438
+ draw(elapsedTime: number, frameContext: RenderFrameContext): void;
3343
3439
  /**
3344
3440
  * Performs any necessary set up to prepare the renderer for offscreen rendering, such as setting up a framebuffer.
3345
3441
  */
@@ -3358,6 +3454,14 @@ export declare interface LayerSpecification {
3358
3454
  * Type of layer.
3359
3455
  */
3360
3456
  type: LayerType;
3457
+ /**
3458
+ * The minimum zoom level for the layer.
3459
+ */
3460
+ minZoom?: number;
3461
+ /**
3462
+ * The maximum zoom level for the layer.
3463
+ */
3464
+ maxZoom?: number;
3361
3465
  /**
3362
3466
  * Data source associated with the layer.
3363
3467
  * @remarks
@@ -3392,15 +3496,21 @@ export declare interface LayerSpecification {
3392
3496
  */
3393
3497
  mask?: LayerMaskSpecification;
3394
3498
  /**
3395
- * Filter expression to use for filtering features from the data source. This is only used for vector tile data
3396
- * sources whose tiles are in the Mapbox Vector Tile (MVT) format.
3397
- * @see ExpressionSpecification
3499
+ * Filter expression for vector tile layers. Evaluated with StyleExpression.
3500
+ * @see FilterExpression
3398
3501
  */
3399
- filter?: ExpressionSpecification;
3502
+ filter?: FilterExpression;
3400
3503
  /**
3401
3504
  * Time series configuration for the layer when time-based.
3402
3505
  */
3403
3506
  timeSeries?: Partial<LayerTiming>;
3507
+ /**
3508
+ * Optional measurement metadata associated with this layer's values.
3509
+ */
3510
+ measurement?: {
3511
+ type: ConversionMeasurement;
3512
+ units: string;
3513
+ };
3404
3514
  /**
3405
3515
  * Data resolution to use, which controls which data zoom level is requested for a specific map zoom level.
3406
3516
  * @remarks
@@ -4101,14 +4211,14 @@ get needsViewportUpdate(): boolean;
4101
4211
 
4102
4212
  /**
4103
4213
  * Adds a new weather layer to the map.
4104
- * @param id - One of the supported weather layer identifiers.
4214
+ * @param idOrConfig - One of the supported weather layer identifiers or a weather layer configuration object.
4105
4215
  * @param overrides - An object containing data and render style overrides for the weather layer.
4106
4216
  * @param beforeId - The identifier of an existing map layer to insert the new layer before, which will result in
4107
4217
  * the new layer appearing below the target layer. If not provided, then the new layer will be added to the end of
4108
4218
  * the layer stack and above all other layers.
4109
4219
  * @returns The newly added map layer or an array of layers if the weather layer identifier maps to multiple layers.
4110
4220
  */
4111
- addWeatherLayer(id: string, overrides?: Partial<WeatherLayerOptions>, beforeId?: string): WebGLLayer | Array<WebGLLayer>;
4221
+ addWeatherLayer(idOrConfig: WeatherLayerConfiguration | string, overrides?: Partial<WeatherLayerOptions>, beforeId?: string): WebGLLayer | Array<WebGLLayer>;
4112
4222
  /**
4113
4223
  * Removes a weather layer from the map.
4114
4224
  * @param id - One of the supported weather layer identifiers.
@@ -4719,6 +4829,10 @@ declare const Operator: {
4719
4829
 
4720
4830
  export declare type Operator = ObjectValue<typeof Operator>;
4721
4831
 
4832
+ export declare interface Opts {
4833
+ capacity: number;
4834
+ }
4835
+
4722
4836
  /**
4723
4837
  * The mode for handling symbol overlap.
4724
4838
  */
@@ -4808,7 +4922,7 @@ export declare class PaintStyle {
4808
4922
  iconAnimated(data?: StylableData): boolean;
4809
4923
  iconFactor(data?: StylableData): number;
4810
4924
  iconAtlas(data?: StylableData): SymbolIconAtlas;
4811
- textValue(data?: StylableData, line?: number): string | PropertyValue;
4925
+ textValue(data?: StylableData, line?: number): string;
4812
4926
  textTransform(data?: StylableData, line?: number): string;
4813
4927
  textFont(data?: StylableData, line?: number): string;
4814
4928
  textSize(data?: StylableData, line?: number): number;
@@ -4909,22 +5023,22 @@ export declare const ParticleDensity: {
4909
5023
  * Least amount of particles will be rendered. This density setting may not provide enough speed and direction
4910
5024
  * information on the map since coverage is minimal. Sets the particle count per tile to 8^2.
4911
5025
  */
4912
- readonly minimal: 8;
5026
+ readonly minimal: 16;
4913
5027
  /**
4914
5028
  * Slightly less particle density than `normal`, allowing the most visibiilty to content underneath while
4915
5029
  * providing good speed and direction information. Sets the particle count per tile to 16^2.
4916
5030
  */
4917
- readonly low: 24;
5031
+ readonly low: 32;
4918
5032
  /**
4919
5033
  * Provides a good amount of particles and speed and direction information while still allowing a good portion
4920
5034
  * of content underneath to remain visible. Sets the particle count per tile to 48^2.
4921
5035
  */
4922
- readonly normal: 48;
5036
+ readonly normal: 64;
4923
5037
  /**
4924
5038
  * Slightly higher particle density than `normal` while still allowing some content underneath to remain visible.
4925
5039
  * Sets the particle count per tile to 76^2.
4926
5040
  */
4927
- readonly high: 76;
5041
+ readonly high: 96;
4928
5042
  /**
4929
5043
  * Highest density that will essentially fill the layer with particle data, preventing content underneath from
4930
5044
  * being visible. Note that overall map performance may be affected with this setting for some hardware
@@ -5079,32 +5193,6 @@ declare const ProjectionType: {
5079
5193
 
5080
5194
  export declare type ProjectionType = ObjectValue<typeof ProjectionType>;
5081
5195
 
5082
- /**
5083
- * Defines a property value that is based on a property name or an array of property names from a JSON object. The
5084
- * property value can also be transformed using a custom function to format the value before rendering.
5085
- */
5086
- export declare interface PropertyValue {
5087
- /**
5088
- * Property key path or an array of property key paths from a JSON object. If an array is provided, then the first
5089
- * property that is not undefined will be used.
5090
- */
5091
- property: string | Array<string>;
5092
- /**
5093
- * Optional measurement type the value represents. This is used to select the proper units to convert the value to
5094
- * before rendering. If not provided, then the value will be rendered as is.
5095
- */
5096
- measurement?: {
5097
- type: string;
5098
- units: string;
5099
- };
5100
- /**
5101
- * Custom function to transform the property value before rendering. This is useful for formatting the value before
5102
- * rendering, such as converting units, rounding, or applying other transformations.
5103
- * @param value - The property value to transform.
5104
- */
5105
- transform?: (value: string | number, units?: string) => string | number;
5106
- }
5107
-
5108
5196
  /**
5109
5197
  * A `Query` object is a convenience wrapper for setting up and configuring a query string used
5110
5198
  * for API queries.
@@ -5252,7 +5340,92 @@ export declare interface RemoteSymbolImage {
5252
5340
  /** Indicates if the image is a pattern image. */
5253
5341
  pattern?: boolean;
5254
5342
  }
5343
+
5344
+ /**
5345
+ * Context built by the layer each frame and passed to prerender() and draw().
5346
+ * Contains all map and layer state needed for the render path so the renderer
5347
+ * does not access the parent layer or the layer's map.
5348
+ */
5349
+ export declare interface RenderFrameContext {
5350
+ /** Elapsed time since the start of the render loop. Used by the renderer to animate the layer. */
5351
+ elapsedTime: number;
5352
+ /** Latest calculated FPS of the context. */
5353
+ fps: number;
5354
+ /** Map state snapshot. */
5355
+ map: RenderFrameContextMap;
5356
+ /** Layer id. */
5357
+ layerId: string;
5358
+ /** Scene to render into. */
5359
+ scene: MapScene;
5360
+ /** Whether this layer is used as a mask (stencil). */
5361
+ isLayerMask: boolean;
5362
+ /** Layer mask config if any. */
5363
+ mask?: LayerMask;
5364
+ /** Whether the layer is visible. */
5365
+ visible: boolean;
5366
+ /** Request a redraw on the next frame. */
5367
+ setNeedsUpdate(): void;
5368
+ /** Tile-layer-specific state; set when the layer is a tile layer. */
5369
+ tileLayer?: RenderFrameContextTileLayer;
5370
+ /** Tile cache from the layer's source; set when the layer has a tile source. Used by renderers instead of accessing layer.source.tiles. */
5371
+ tileCache?: AnyTileCache;
5372
+ /** Tile dimensions from the layer's source; set when the layer has a tile source. Used for texture array setup. */
5373
+ tileSize?: {
5374
+ width: number;
5375
+ height: number;
5376
+ };
5377
+ /** Layer paint style (from layer.paint). Set by the layer when building context. */
5378
+ paint?: PaintStyle;
5379
+ /** Map style (map.style). Used by vector/grid passes for fonts, image atlas, etc. */
5380
+ mapStyle?: MapStyle;
5381
+ }
5382
+
5383
+ /**
5384
+ * Snapshot of map transform state passed into the render path so the renderer
5385
+ * does not read from the map or layer during prerender/draw.
5386
+ */
5387
+ export declare interface RenderFrameContextMap {
5388
+ center: Coordinate;
5389
+ zoom: number;
5390
+ bounds: CoordinateBounds;
5391
+ bearing: number;
5392
+ pitch: number;
5393
+ tileSize: number;
5394
+ projection: {
5395
+ type: ProjectionType;
5396
+ subdivisionGranularity: SubdivisionGranularitySetting;
5397
+ };
5398
+ transform: MapTransform;
5399
+ placement: SymbolPlacement;
5400
+ globiness: number;
5401
+ isGlobe: boolean;
5402
+ camera: {
5403
+ position: Vector3;
5404
+ };
5405
+ clippingPlane: Vector4;
5406
+ globeMatrix: Matrix4;
5407
+ mercatorMatrix: Matrix4;
5408
+ projGlobeMatrix: Matrix4;
5409
+ zoomTransition: number;
5410
+ cutoffParams: [number, number, number, number];
5411
+ farZ: number;
5412
+ pixelsPerMercatorPixelRatio: number;
5413
+ }
5414
+
5415
+ /**
5416
+ * Optional tile-layer-specific state for resolution and LOD. Present when the
5417
+ * layer is a tile layer.
5418
+ */
5419
+ export declare interface RenderFrameContextTileLayer {
5420
+ viewport: Viewport;
5421
+ pyramid: TilePyramid<any>;
5422
+ getDataZoom(): number;
5423
+ getVisibleTileCoords(zoom: number): TileCoord[];
5424
+ getCurrentInterval?(): TimeInterval | undefined;
5425
+ }
5255
5426
 
5427
+ declare const resolveMeasurementForUnits: (type: ConversionMeasurement) => Measurement;
5428
+
5256
5429
  /**
5257
5430
  * RGBAImage represents a 2D grid of image data. Them image data should NOT be premultipled since ImageData is not.
5258
5431
  * Therefore, UNPACK_PREMULTIPLY_ALPHA_WEBGL must be used when uploading the image data to the GPU via a texture.
@@ -5445,10 +5618,10 @@ export declare class SourceMetadata extends EventDispatcher {
5445
5618
  */
5446
5619
  get hasLoaded(): boolean;
5447
5620
  /**
5448
- * Whether the metadata has valid time information.
5621
+ * Whether the data source is a time-series data source.
5449
5622
  * @readonly
5450
5623
  */
5451
- get hasValidTimes(): boolean;
5624
+ get isTimeSeries(): boolean;
5452
5625
  get validTimeRange(): TimeRange;
5453
5626
  getAllValidTimes(): Array<Date>;
5454
5627
  /**
@@ -5631,6 +5804,12 @@ export declare class State<T> extends EventDispatcher {
5631
5804
  };
5632
5805
  }
5633
5806
 
5807
+ /**
5808
+ * Legacy style value: a static value or a function (data) => value.
5809
+ * Supported for backwards compatibility.
5810
+ */
5811
+ export declare type StaticOrFunctionStyleValue<T> = T | ((data: StylableData) => T);
5812
+
5634
5813
  /**
5635
5814
  * Stroke style properties control how one or more polylines get rendered on a map. These properties also control
5636
5815
  * strokes around circles and other vector shapes.
@@ -5639,7 +5818,7 @@ export declare interface StrokeStyleSpec {
5639
5818
  /**
5640
5819
  * Color of the stroke.
5641
5820
  */
5642
- color: StyleValue<string | Color | StyleExpression>;
5821
+ color: StyleValue<string | Color>;
5643
5822
  /**
5644
5823
  * Opacity of the stroke. Opacity can also be specified by including an alpha channel in the `color` value.
5645
5824
  */
@@ -5743,6 +5922,8 @@ export declare interface StyledImageRenderer {
5743
5922
  dispose?: () => void;
5744
5923
  }
5745
5924
 
5925
+ export declare type StyleEvaulatorFunction<T> = (properties: Record<string, any>) => T;
5926
+
5746
5927
  export declare interface StyleExpression {
5747
5928
  property: string;
5748
5929
  type?: 'identity' | 'expression';
@@ -5773,6 +5954,8 @@ export declare const styles: {
5773
5954
  };
5774
5955
  prate: (string | number)[];
5775
5956
  precip_accum: (string | number)[];
5957
+ sleet_accum: (string | number)[];
5958
+ ice_accum: (string | number)[];
5776
5959
  radar: {
5777
5960
  rain: (string | number)[];
5778
5961
  mix: (string | number)[];
@@ -5790,97 +5973,36 @@ export declare const styles: {
5790
5973
  };
5791
5974
 
5792
5975
  /**
5793
- * Defines a style value that can be either a static value or a function that returns a value based on the data for
5794
- * data-driven styling.
5795
- */
5796
- export declare type StyleValue<T> = T | ((data: StylableData) => T);
5797
-
5798
- /**
5799
- * Controls how much subdivision happens for a given type of geometry at different zoom levels.
5976
+ * Style value accepted by paint specs. Can be:
5977
+ * - A constant (number, string, boolean, object, etc.)
5978
+ * - A function (data) => value
5979
+ * - An expression array (Mapbox-style, e.g. ['get', 'opacity'])
5980
+ * - A {@link ConstantStyleValue} or {@link DataDrivenStyleValue} instance (used as-is)
5981
+ *
5982
+ * Constants, functions, and expression arrays are converted to StyleValue instances in the PaintStyle constructor.
5800
5983
  */
5801
- export declare class SubdivisionGranularityExpression {
5802
- /**
5803
- * A tile of zoom level 0 will be subdivided to this granularity level.
5804
- * Each subsequent zoom level will have its granularity halved.
5805
- */
5806
- private readonly _baseZoomGranularity;
5807
- /**
5808
- * No tile will have granularity level smaller than this.
5809
- */
5810
- private readonly _minGranularity;
5811
- constructor(baseZoomGranularity: number, minGranularity: number);
5812
- getGranularityForZoomLevel(zoomLevel: number): number;
5813
- }
5814
-
5815
- export declare interface SubdivisionGranularityOptions {
5816
- /**
5817
- * Granularity settings used for fill and fill-extrusion layers (for fill, both polygons and their anti-aliasing outlines).
5818
- */
5819
- fill: {
5820
- base: number;
5821
- min: number;
5822
- };
5823
- /**
5824
- * Granularity used for the line layer.
5825
- */
5826
- line: {
5827
- base: number;
5828
- min: number;
5829
- };
5830
- /**
5831
- * Granularity used for geometry covering the entire tile: stencil masks, raster tiles, etc.
5832
- */
5833
- tile: {
5834
- base: number;
5835
- min: number;
5836
- };
5837
- /**
5838
- * Granularity used for stencil masks for tiles.
5839
- */
5840
- stencil: {
5841
- base: number;
5842
- min: number;
5843
- };
5844
- /**
5845
- * Controls the granularity of `pitch-alignment: map` circles and heatmap kernels.
5846
- * More granular circles will more closely follow the map's surface.
5847
- */
5848
- circle: CircleGranularity;
5849
- }
5984
+ export declare type StyleValue<T> = StaticOrFunctionStyleValue<T> | ExpressionArray | DataDrivenStyleValue<T> | ConstantStyleValue<T>;
5850
5985
 
5851
- /**
5852
- * An object describing how much subdivision should be applied to different types of geometry at different zoom levels.
5853
- */
5854
- export declare class SubdivisionGranularitySetting {
5855
- /**
5856
- * Granularity settings used for fill and fill-extrusion layers (for fill, both polygons and their anti-aliasing outlines).
5857
- */
5858
- readonly fill: SubdivisionGranularityExpression;
5859
- /**
5860
- * Granularity used for the line layer.
5861
- */
5862
- readonly line: SubdivisionGranularityExpression;
5986
+ declare abstract class StyleValue_2<T> {
5987
+ private constant;
5988
+ private expression;
5989
+ private fn;
5990
+ constructor(value: T | any[] | StyleEvaulatorFunction<T>);
5863
5991
  /**
5864
- * Granularity used for geometry covering the entire tile: raster tiles, etc.
5992
+ * Returns whether this value is an expression.
5865
5993
  */
5866
- readonly tile: SubdivisionGranularityExpression;
5994
+ isExpression(): boolean;
5867
5995
  /**
5868
- * Granularity used for stencil masks for tiles.
5996
+ * Resolves the final value based on input properties.
5997
+ * If it's a constant, returns it directly.
5869
5998
  */
5870
- readonly stencil: SubdivisionGranularityExpression;
5999
+ resolve(properties?: Record<string, any>): T;
5871
6000
  /**
5872
- * Controls the granularity of `pitch-alignment: map` circles and heatmap kernels.
5873
- * More granular circles will more closely follow the map's surface.
6001
+ * Returns the raw constant or expression for debugging or serialization.
5874
6002
  */
5875
- readonly circle: CircleGranularity;
5876
- constructor(options: SubdivisionGranularityOptions);
5877
- /**
5878
- * Granularity settings that disable subdivision altogether.
5879
- */
5880
- static readonly noSubdivision: SubdivisionGranularityOptions;
5881
- static readonly globeSubdivision: SubdivisionGranularityOptions;
6003
+ getRaw(): T | any[] | StyleEvaulatorFunction<T> | null;
5882
6004
  }
5883
-
6005
+
5884
6006
  /**
5885
6007
  * Supported color bands.
5886
6008
  */
@@ -6054,8 +6176,6 @@ export declare type TaskRunner<Task extends DownloadTask<any>> = (task: Task, co
6054
6176
  * @template Task - The download task type that extends DownloadTask
6055
6177
  */
6056
6178
  export declare interface TaskRunnerConfig<Task extends DownloadTask<any>> {
6057
- /** Function that performs the fetch operation. */
6058
- fetcher: Fetcher<Task>;
6059
6179
  /** Maximum number of retry attempts for failed tasks. */
6060
6180
  maxRetries: number;
6061
6181
  /** HTTP status code range [min, max] that triggers retry attempts. */
@@ -6070,10 +6190,9 @@ export declare interface TaskRunnerConfig<Task extends DownloadTask<any>> {
6070
6190
  */
6071
6191
  export declare interface TextStyleSpec {
6072
6192
  /**
6073
- * Text to render. This can be a static string or a property value that is based on a property name or an array of
6074
- * property names from a JSON object.
6193
+ * Text to render. This can be a static string or an expression that evaluates to a string.
6075
6194
  */
6076
- value: StyleValue<string | PropertyValue>;
6195
+ value: StyleValue<string>;
6077
6196
  /**
6078
6197
  * The size of the text in pixels.
6079
6198
  */
@@ -6152,6 +6271,11 @@ export declare class Tile<Data> implements Disposable {
6152
6271
  private _span;
6153
6272
  private _bounds;
6154
6273
  private _state;
6274
+ /**
6275
+ * Monotonically increasing identifier for the most recent request that started loading this tile.
6276
+ * Used by `TileSource` to guard against out-of-order async responses overwriting newer data.
6277
+ */
6278
+ requestId: number;
6155
6279
  private _data;
6156
6280
  /**
6157
6281
  * The tile coordinate of the tile as `x`, `y`, and `z`.
@@ -6234,6 +6358,13 @@ export declare class TileBounds {
6234
6358
  get center(): Point;
6235
6359
  get info(): Rect_2;
6236
6360
  constructor(left: number, right: number, top: number, bottom: number);
6361
+ /**
6362
+ * Expands the bounds by the specified offsets.
6363
+ * @param xOffset - The offset to expand the bounds horizontally.
6364
+ * @param yOffset - The offset to expand the bounds vertically.
6365
+ * @returns The expanded bounds.
6366
+ */
6367
+ expand(xOffset: number, yOffset: number): TileBounds;
6237
6368
  /**
6238
6369
  * Returns whether the bounds equals the specified bounds.
6239
6370
  * @param bounds -
@@ -6373,22 +6504,123 @@ export declare type TileCoordinateBounds = {
6373
6504
  nw: TileCoordinate;
6374
6505
  se: TileCoordinate;
6375
6506
  };
6376
-
6377
- export declare class TileDownloadTask extends DownloadTask<{
6378
- data: Blob;
6379
- headers: Headers;
6380
- }> {
6381
- readonly coord: TileCoord;
6382
- readonly intervals: Array<number>;
6383
- constructor(key: string, coord: TileCoord, intervals: Array<number>, url: string, options: Partial<TileRequestOptions>, priority?: DownloadPriority);
6384
- }
6385
-
6507
+
6386
6508
  export declare interface TileInfo {
6387
6509
  x: number;
6388
6510
  y: number;
6389
6511
  z: number;
6390
6512
  }
6391
6513
 
6514
+ /**
6515
+ * Represents a layer that renders data from a tile-based data source. This is the base class for all tile-based layers
6516
+ * and is not intended to be used directly.
6517
+ * @template Data Type of data stored in the layer's tiles.
6518
+ */
6519
+ declare abstract class TileLayer<Data> extends WebGLLayer<TileSource> {
6520
+ /**
6521
+ * Tile pyramid used to calculating and requesting tiles for the layer from the data source.
6522
+ */
6523
+ readonly pyramid: TilePyramid<Data>;
6524
+ readonly zoomOffset: number;
6525
+ private tileBounds;
6526
+ private dataQuality;
6527
+ private upgradeDataQuality;
6528
+ private lastHiddenTime;
6529
+ private tileLoadProgress;
6530
+ /**
6531
+ * Returns the layer's data render quality.
6532
+ * @see DataQuality
6533
+ */
6534
+ get quality(): DataQuality;
6535
+ /**
6536
+ * Sets the layer's data render quality.
6537
+ * @see DataQuality
6538
+ */
6539
+ set quality(value: DataQuality);
6540
+ /**
6541
+ * Creates an instance of TileLayer.
6542
+ * @param id - Unique identifier of the layer.
6543
+ * @param config - Config options for the layer.
6544
+ */
6545
+ constructor(id: string, { quality, ...config }: Partial<TileLayerConfig>);
6546
+ refresh(clear?: boolean): void;
6547
+ /**
6548
+ * Returns the layer's tile cache so renderers can use it via RenderFrameContext instead of accessing layer.source.tiles.
6549
+ */
6550
+ getTileCache(): AnyTileCache;
6551
+ /**
6552
+ * Returns the layer's tile dimensions for texture array setup.
6553
+ */
6554
+ getTileSize(): {
6555
+ width: number;
6556
+ height: number;
6557
+ };
6558
+ /**
6559
+ * Returns the data zoom level used for the specified map zoom level based on the configured `quality` level.
6560
+ * @param zoom - Map zoom level to get the data zoom level for.
6561
+ * @param reduceDataQuality - Whether to reduce the data quality by 1 level.
6562
+ * @returns Data zoom level.
6563
+ */
6564
+ getDataZoom(zoom?: number, reduceDataQuality?: boolean): number;
6565
+ preloadWorldTile(): void;
6566
+ /**
6567
+ * Returns the tile at the specified geographic coordinate.
6568
+ * @param coord - Geographic coordinate to get the tile for.
6569
+ * @param allowPartials - Whether to allow returning a tile that only partially contains the queried coordinate.
6570
+ * @returns Tile and position within the tile for the specified coordinate.
6571
+ */
6572
+ protected getTile(coord: Coordinate, zoom?: number, allowPartials?: boolean): {
6573
+ tile: Tile<Data>;
6574
+ position: Point;
6575
+ } | undefined;
6576
+ /**
6577
+ * Returns the visible tile coordinates based on the map's current viewport.
6578
+ * @returns Array of visible tile coordinates.
6579
+ */
6580
+ getVisibleTileCoords(): Array<TileCoord>;
6581
+ /**
6582
+ * Requests visible tiles from the tile pyramid.
6583
+ * @param reload - Whether to reload tiles that have already been requested.
6584
+ * @returns Promise that resolves when the tiles have been requested.
6585
+ */
6586
+ private requestVisibleTiles;
6587
+ protected requestTiles(coords: Array<TileCoord>, reload?: boolean): Promise<void>;
6588
+ protected shouldReloadTile(coord: TileCoord): boolean;
6589
+ onAdd(context: Context): void;
6590
+ onMove(): void;
6591
+ onVisible(): void;
6592
+ onHidden(): void;
6593
+ private onDataStale;
6594
+ private onDataChange;
6595
+ private onTileLoad;
6596
+ private onTileError;
6597
+ private onLoadProgress;
6598
+ private onLoadStart;
6599
+ private onLoadComplete;
6600
+ protected onTimeSeriesDataChange(): void;
6601
+ protected onMaskLayerChange(): void;
6602
+ protected onMaskStateChange(): void;
6603
+ }
6604
+
6605
+ /**
6606
+ * Configuration options for a tile-based layer.
6607
+ */
6608
+ export declare interface TileLayerConfig extends WebGLLayerConfig {
6609
+ /**
6610
+ * Quality to use when rendering data.
6611
+ */
6612
+ quality: DataQuality;
6613
+ /**
6614
+ * Range of values to use when rendering data.
6615
+ */
6616
+ dataRange: ValueRange;
6617
+ /**
6618
+ * Offset to apply to the map's zoom level when requesting data from the data source. This is useful to render data
6619
+ * at a different zoom level than the map's zoom level.
6620
+ */
6621
+ zoomOffset: number;
6622
+ }
6623
+
6392
6624
  export declare type TileQuadrant = 'tl' | 'tc' | 'tr' | 'ml' | 'mc' | 'mr' | 'bl' | 'bc' | 'br';
6393
6625
 
6394
6626
  /**
@@ -6427,10 +6659,6 @@ export declare type TileRequestOptions = {
6427
6659
  * Whether to reload the tile if it has already been loaded.
6428
6660
  */
6429
6661
  reload: boolean;
6430
- /**
6431
- * Whether to check if the tile is already pending before loading.
6432
- */
6433
- checkPending: boolean;
6434
6662
  /**
6435
6663
  * The time intervals to load for the tile.
6436
6664
  */
@@ -6441,10 +6669,42 @@ export declare type TileRequestOptions = {
6441
6669
  * `TileSource` is an abstract class that provides the primary implementation of a tile-based data source object that
6442
6670
  * loads tiles from a remote source. This class is not intended to be used directly, but rather extended by a concrete
6443
6671
  * implementation of a tile-based data source.
6672
+ *
6673
+ * @remarks
6674
+ * **Tile loading: two complementary mechanisms**
6675
+ *
6676
+ * Network fetches are orchestrated by {@link TileSource.downloadManager} (`DownloadManager`). `requestTile` may run
6677
+ * decode/parse work after bytes arrive. Understanding these two behaviors avoids duplicate work and stale tiles:
6678
+ *
6679
+ * 1. **Download deduplication** — For a given `TileDownloadTask` key (tile coordinate plus optional interval key from
6680
+ * {@link makeTileKey} / {@link makeTileArrayKey}), the manager ensures at most one in-flight or pending fetch. If
6681
+ * `requestTile` is called again while that task is still pending or in-flight, callers await the **same** promise
6682
+ * instead of starting a second HTTP request. This reduces redundant bandwidth and coordinates multiple callers
6683
+ * (e.g. layers or rapid map updates) that share the exact same request identity.
6684
+ *
6685
+ * 2. **Load generation guard (`tile.requestId` / `task.loadRequestId`)** — Deduping only merges identical
6686
+ * **keys**. It does **not** decide which result is "current" when the logical request for a tile slot changes:
6687
+ * different URL parameters (time, style, reload), a new fetch after a previous task finished, or a slow
6688
+ * {@link parseTile} finishing after a newer `requestTile` has already started. For non-interval loads, each **new**
6689
+ * enqueued download task gets a monotonically increasing id; callers that shared that task share the same id.
6690
+ * After `parseTile` resolves, the result is applied only if that id still matches `tile.requestId` (see
6691
+ * `requestTile` and `loadTile`). Stale completions are dropped so an older response cannot overwrite newer data for
6692
+ * the same tile instance.
6693
+ *
6694
+ * **Interval-based loads** (time-series tiles with multiple intervals on one tile) intentionally skip this per-tile
6695
+ * id guard so a single tile can accumulate multiple interval results; ordering for those paths is handled elsewhere
6696
+ * in the data model.
6697
+ *
6444
6698
  * @template Data The type of data stored in a tile.
6445
6699
  * @template Source The type of the source specification.
6446
6700
  */
6447
6701
  declare abstract class TileSource<Data = any, Source extends TileSourceSpecification = TileSourceSpecification> extends DataSource<Source> {
6702
+ /**
6703
+ * Monotonic counter used when assigning {@link TileDownloadTask.loadRequestId} for non-interval loads. Each new
6704
+ * enqueued download task gets the next id; waiters sharing the same task reuse that id. See class-level docs on
6705
+ * deduplication vs. load-generation guard.
6706
+ */
6707
+ private _tileLoadRequestId;
6448
6708
  /**
6449
6709
  * The minimum zoom level for the source. Defaults to `0`.
6450
6710
  */
@@ -6509,34 +6769,38 @@ constructor(id: string, spec: Partial<Source>);
6509
6769
  */
6510
6770
  getTileUrl(coord: TileCoord, params?: Record<string, any>): string;
6511
6771
  /**
6512
- * Returns whether or not the source has a tile for the given tile coordinate.
6513
- * @param coord - The tile coordinate.
6514
- * @param layerId -
6515
- * @returns Whether or not the source has a tile for the given tile coordinate.
6516
- */
6517
- hasTile(coord: TileCoord, layerId?: string): boolean;
6518
- /**
6519
- * Returns whether or not the source has tile data for the given tile coordinate. If the tile's state is `expired`,
6520
- * this method will return `false` even if the tile has data.
6772
+ * Checks if tile data exists for the given coordinate.
6773
+ * For time-series sources, pass `intervals` to require data for those intervals; otherwise
6774
+ * only the coord is checked and a single cached tile counts as "has data".
6521
6775
  * @param coord - The tile coordinate.
6522
- * @param layerId -
6523
- * @returns Whether or not the source has tile data for the given tile coordinate.
6524
- */
6525
- hasTileData(coord: TileCoord, layerId?: string): boolean;
6526
- /**
6527
- * Returns the data for the given tile coordinate.
6776
+ * @param layerId - Optional layer ID for per-layer data (unused but retained for API compatibility). If provided,
6777
+ * the tile data must have data for the given layer ID. This is only used for vector tile sources.
6778
+ * @param allowExpired - If true, allows expired tiles to be considered as having data.
6779
+ * @param intervals - Optional time intervals (e.g. from request options). When provided, the tile must have
6780
+ * data for all of these intervals (used for time-series / multi-interval requests). The base implementation
6781
+ * only checks for data for the given intervals if the tile data is a time series data object.
6782
+ * @returns Whether tile data exists (optionally including expired/stale and/or for the given intervals).
6783
+ */
6784
+ hasTileData(coord: TileCoord, layerId?: string, allowExpired?: boolean, intervals?: Array<Date>): boolean;
6785
+ /**
6786
+ * Returns whether there is already a pending or in-flight request for the given coordinate
6787
+ * (and optionally for the given intervals). Used to avoid duplicate requests when the
6788
+ * same tile+intervals are requested multiple times.
6528
6789
  * @param coord - The tile coordinate.
6529
- * @returns The data for the given tile coordinate.
6790
+ * @param intervals - Optional time intervals. When provided, only a task for the same coord and
6791
+ * these intervals is considered; when omitted, any task for this coord is considered.
6792
+ * @returns True if a matching request is pending or in-flight.
6530
6793
  */
6531
- getTileData(coord: TileCoord): Data;
6794
+ isPending(coord: TileCoord, intervals?: Array<Date>): boolean;
6532
6795
  getTileDataSize(data?: Data): Size;
6533
6796
  /**
6534
- * Returns whether or not the source should request a tile.
6797
+ * Returns whether the source should request a tile.
6535
6798
  * @param tile - The tile to check.
6536
- * @param reload - Whether or not the tile should be reloaded.
6537
- * @returns Whether or not the source should request a tile.
6799
+ * @param options - Optional request options (reload, intervals for time-series, etc.). Subclasses may use
6800
+ * this to request a tile when cached data does not satisfy the request (e.g. missing interval).
6801
+ * @returns Whether the source should request a tile.
6538
6802
  */
6539
- shouldRequestTile(tile: Tile<Data>, reload?: boolean): boolean;
6803
+ shouldRequestTile(tile: Tile<Data>, reload?: boolean, intervals?: Array<Date>): boolean;
6540
6804
  /**
6541
6805
  * Reloads all cached tiles.
6542
6806
  */
@@ -6547,17 +6811,12 @@ constructor(id: string, spec: Partial<Source>);
6547
6811
  * @param options - Additional options to use when requesting the tile.
6548
6812
  * @returns A promise that resolves with the tile data.
6549
6813
  */
6550
- requestTile(coord: TileCoord, options?: Partial<TileRequestOptions>): Promise<Data>;
6551
- /**
6552
- * Returns a tile instance for the given tile coordinate. If the tile does not exist, it will be created and added
6553
- * to the cache.
6554
- * @param coord - The tile coordinate.
6555
- * @returns The tile instance.
6556
- */
6557
- protected getOrCreateTile(coord: TileCoord): Tile<Data>;
6558
- protected loadTile(tile: Tile<Data>, options?: Partial<TileRequestOptions>): Promise<{
6559
- data: Blob;
6560
- headers: Headers;
6814
+ requestTile(coord: TileCoord, options?: Partial<TileRequestOptions>): Promise<Data | null>;
6815
+ protected loadTile(tile: Tile<Data>, options?: Partial<TileRequestOptions>, loadRequestCtx?: {
6816
+ loadRequestId: number;
6817
+ }): Promise<{
6818
+ data: Blob | null;
6819
+ headers: Headers | null;
6561
6820
  }>;
6562
6821
  getMetadata(options?: Partial<UrlRequestOptions>): Promise<unknown>;
6563
6822
  removeConsumer(consumer: DataSourceConsumer): void;
@@ -6566,8 +6825,14 @@ constructor(id: string, spec: Partial<Source>);
6566
6825
  * @param tile - The tile to abort.
6567
6826
  */
6568
6827
  protected abortTile(tile: Tile<Data>): void;
6569
-
6570
- /**
6828
+ /**
6829
+ * Aborts in-worker requests for a tile by coordinate (e.g. when tile is no longer visible).
6830
+ * Override in subclasses that run work in a worker (e.g. encoded operation layers).
6831
+ * @param coord - The tile coordinate to abort.
6832
+ */
6833
+ abortTileByCoord(_coord: TileCoord): void;
6834
+
6835
+ /**
6571
6836
  * Cancels all active tile requests.
6572
6837
  */
6573
6838
  cancelAllRequests(): void;
@@ -6710,6 +6975,7 @@ export declare class TimeAnimation extends Animation {
6710
6975
  private _endDate;
6711
6976
  private _endOffset;
6712
6977
  private _now;
6978
+ private _rangeChangeAnchorDate?;
6713
6979
  constructor({ start, end, alwaysStopAtStart, ...animationOpts }: Partial<TimeAnimationOptions>);
6714
6980
  /**
6715
6981
  * Sets the start date of the animation using an offset from a reference date.
@@ -6762,6 +7028,14 @@ export declare class TimeAnimation extends Animation {
6762
7028
  protected eventPayload(): Record<string, any>;
6763
7029
  protected advanceToStopPosition(): void;
6764
7030
  private _debouncedRangeChangeEvent;
7031
+ /**
7032
+ * Captures the current date as an anchor date for the range change event.
7033
+ */
7034
+ private _captureRangeChangeAnchorDate;
7035
+ /**
7036
+ * Restores the anchor date for the range change event.
7037
+ */
7038
+ private _restoreRangeChangeAnchorDate;
6765
7039
  }
6766
7040
 
6767
7041
  export declare type TimeAnimationInfo = {
@@ -6940,6 +7214,11 @@ export declare type TimeSeriesOperation = {
6940
7214
  * Bands to restrict the operation to. If not specified, the operation will be applied to all bands.
6941
7215
  */
6942
7216
  bands?: Array<ColorBand>;
7217
+ /**
7218
+ * The data range to remap the data to. If not specified, the data range will not be remapped and use provided data
7219
+ * range or the range based on the datasets being used by the operation.
7220
+ */
7221
+ remappedDataRange?: ValueRange;
6943
7222
  };
6944
7223
 
6945
7224
  /**
@@ -7095,11 +7374,12 @@ export declare const units: {
7095
7374
  readonly percent: "%";
7096
7375
  };
7097
7376
  };
7377
+ resolveMeasurementForUnits: (type: _units.ConversionMeasurement) => _units.Measurement;
7098
7378
  defaultUnits: Record<"metric" | "imperial", MapUnits>;
7099
- getDefaultUnit: (type: _units.Measurement, system: "custom" | "metric" | "imperial") => string;
7100
- getDefaultUnitsForSystem: (system: "custom" | "metric" | "imperial") => MapUnits;
7379
+ getDefaultUnit: (type: _units.ConversionMeasurement, system: "metric" | "imperial" | "custom") => string;
7380
+ getDefaultUnitsForSystem: (system: "metric" | "imperial" | "custom") => MapUnits;
7101
7381
  equalUnits: (units1: MapUnits, units2: MapUnits) => boolean;
7102
- getSystemForUnits: (units: MapUnits) => "custom" | "metric" | "imperial";
7382
+ getSystemForUnits: (units: MapUnits) => "metric" | "imperial" | "custom";
7103
7383
  FtoC: (f: number) => number;
7104
7384
  CtoF: (c: number) => number;
7105
7385
  mphToKph: (mph: number) => number;
@@ -7131,6 +7411,7 @@ export declare const units: {
7131
7411
  msToMphUnit: (ms: number) => number;
7132
7412
  dbzToMMRate: (dbz: number, perSecond?: boolean) => number;
7133
7413
  degToDir: (d: number) => string;
7414
+ getUnitPrecision: (unit: string) => number;
7134
7415
  convert: (type: string, value: number, from: string, to: string) => number;
7135
7416
  getMeasurementType: (str: string) => _units.Measurement;
7136
7417
  };
@@ -7140,6 +7421,8 @@ declare namespace _units {
7140
7421
  UnitSystem,
7141
7422
  Units,
7142
7423
  Measurement,
7424
+ ConversionMeasurement,
7425
+ resolveMeasurementForUnits,
7143
7426
  defaultUnits,
7144
7427
  getDefaultUnit,
7145
7428
  getDefaultUnitsForSystem,
@@ -7176,6 +7459,7 @@ declare namespace _units {
7176
7459
  msToMphUnit,
7177
7460
  dbzToMMRate,
7178
7461
  degToDir,
7462
+ getUnitPrecision,
7179
7463
  convert,
7180
7464
  getMeasurementType
7181
7465
  }
@@ -7233,6 +7517,9 @@ export declare const VectorSourceType: {
7233
7517
 
7234
7518
  export declare type VectorSourceType = ObjectValue<typeof VectorSourceType>;
7235
7519
 
7520
+ /** Static vector tile data or time-series container for animated vector tiles. */
7521
+ export declare type VectorTileData = VectorData | VectorTimeSeriesData;
7522
+
7236
7523
  /**
7237
7524
  * A {@link TileSource} for vector tile data.
7238
7525
  * Vector tiles are a compact representation of geographic data. They are typically used to render map data in a vector
@@ -7240,25 +7527,32 @@ export declare type VectorSourceType = ObjectValue<typeof VectorSourceType>;
7240
7527
  * Vector tiles are typically served as a compressed binary format, such as
7241
7528
  * Mapbox's [MVT](https://docs.mapbox.com/vector-tiles/reference/mapbox-vector-tile-spec/).
7242
7529
  */
7243
- export declare class VectorTileSource extends TileSource<VectorData, VectorSourceSpecification> {
7530
+ export declare class VectorTileSource extends TileSource<VectorTileData, VectorSourceSpecification> {
7244
7531
 
7532
+ /**
7533
+ * Tracks deferred tile refresh requests while a tile is still loading.
7534
+ * Map key: tile coord hash.
7535
+ * Map value: layer ids to refresh once parsing completes (`*` means refresh all consumers).
7536
+ */
7537
+ private readonly _pendingRefreshByTile;
7245
7538
  get type(): string;
7246
7539
 
7247
7540
  constructor(id: string, spec: Partial<VectorSourceSpecification>);
7248
- hasTile(coord: TileCoord, layerId?: string): boolean;
7249
- hasTileData(coord: TileCoord, layerId?: string): boolean;
7541
+ hasTileData(coord: TileCoord, layerId?: string, allowExpired?: boolean, _intervals?: Array<Date>): boolean;
7250
7542
  expireAllTiles(): void;
7251
- expireTile(tile: Tile<VectorData>): void;
7543
+ expireTile(tile: Tile<VectorTileData>): void;
7544
+ addConsumer(consumer: DataSourceConsumer): void;
7252
7545
  /**
7253
7546
  * Refreshes the data for all tiles in the source.
7547
+ * @param layerId - The layer ID to refresh. If not provided, all layers will be refreshed.
7254
7548
  */
7255
- refreshAllTileData(): void;
7549
+ refreshAllTileData(layerId?: string): void;
7256
7550
  /**
7257
- * Refreshes the data for a single tile in the source by re-parsing the existing data. This is useful when the
7258
- * filter expression has changed for a consuming layer.
7551
+ * Refreshes the data for a single tile in the source by re-parsing the existing data. This is useful when a new
7552
+ * consumer is added or the filter expression has changed for a consuming layer.
7259
7553
  * @param tile - The tile to refresh.
7260
7554
  */
7261
- refreshTileData(tile: Tile<VectorData>): Promise<void>;
7555
+ refreshTileData(tile: Tile<VectorTileData>, layerId?: string): Promise<void>;
7262
7556
 
7263
7557
  }
7264
7558
 
@@ -7375,6 +7669,14 @@ export declare type WeatherLayerOptions = {
7375
7669
  * The render style to use for rendering the layer's data.
7376
7670
  */
7377
7671
  type: LayerType;
7672
+ /**
7673
+ * The minimum zoom level for the layer.
7674
+ */
7675
+ minZoom?: number;
7676
+ /**
7677
+ * The maximum zoom level for the layer.
7678
+ */
7679
+ maxZoom?: number;
7378
7680
  /**
7379
7681
  * Whether the layer should be hidden by default. Default is `false`.
7380
7682
  */
@@ -7428,10 +7730,9 @@ export declare type WeatherLayerOptions = {
7428
7730
  */
7429
7731
  timing: Partial<Omit<LayerTiming, 'mode'>>;
7430
7732
  /**
7431
- * Filter expression to use for filtering features from the data source. This is only used for vector tile data
7432
- * sources whose tiles are in the Mapbox Vector Tile (MVT) format.
7733
+ * Filter expression for vector tile layers. Evaluated with StyleExpression.
7433
7734
  */
7434
- filter: ExpressionSpecification;
7735
+ filter: FilterExpression;
7435
7736
  /**
7436
7737
  * Paint style overrides for the layer.
7437
7738
  */
@@ -7477,6 +7778,12 @@ constructor(account: Account);
7477
7778
  * Returns the metadata for all available weather layers.
7478
7779
  */
7479
7780
  getLayerMetadata(): Promise<Array<WeatherLayerMetadata>>;
7781
+ /**
7782
+ * Returns a weather layer configuration for the specified Xweather Raster Maps layer code.
7783
+ * @param code - The raster layer code to get the configuration for.
7784
+ * @returns The weather layer configuration.
7785
+ */
7786
+ getRasterLayerConfig(code: string): WeatherLayerConfiguration;
7480
7787
  /**
7481
7788
  * Returns the weather layer configuration for the specified weather code. If the code represents a combined layer,
7482
7789
  * then an array of weather codes will be returned instead.
@@ -7510,6 +7817,14 @@ declare abstract class WebGLLayer<Source extends DataSource = DataSource> extend
7510
7817
  * The type of layer.
7511
7818
  */
7512
7819
  type: LayerType;
7820
+ /**
7821
+ * The minimum zoom level for the layer.
7822
+ */
7823
+ minZoom: number;
7824
+ /**
7825
+ * The maximum zoom level for the layer.
7826
+ */
7827
+ maxZoom: number;
7513
7828
  /**
7514
7829
  * The map controller that this layer is associated with.
7515
7830
  */
@@ -7563,7 +7878,14 @@ get mask(): LayerMask;
7563
7878
  * @readonly
7564
7879
  */
7565
7880
  get isDirty(): boolean;
7566
- constructor(id: string, { source, renderer }: Partial<WebGLLayerConfig>);
7881
+ /**
7882
+ * Optional measurement metadata associated with this layer's values.
7883
+ */
7884
+ measurement: {
7885
+ type: ConversionMeasurement;
7886
+ units: string;
7887
+ } | undefined;
7888
+ constructor(id: string, { source, renderer, measurement }: Partial<WebGLLayerConfig>);
7567
7889
  /**
7568
7890
  * Shows the layer if it is hidden.
7569
7891
  */
@@ -7592,9 +7914,11 @@ get mask(): LayerMask;
7592
7914
  * GeoJSON layer style will return the model properties associated with the feature at that location.
7593
7915
  * @param coord - Geographic coordinate to query for features.
7594
7916
  * @param zoom - Zoom level to query for features. If not provided, the map's current zoom level will be used.
7917
+ * @param allowPartials - Whether to use partial data (ancestor or descendant) if the exact tile is not loaded.
7918
+ * @param requestIfMissing - Whether to request the tile if it is missing.
7595
7919
  * @returns The features found at the specified coordinate and zoom level.
7596
7920
  */
7597
- queryFeatures(coord: Coordinate, zoom: number, allowPartials: boolean): FeatureQueryResult;
7921
+ queryFeatures(coord: Coordinate, zoom: number, allowPartials: boolean, requestIfMissing?: boolean): FeatureQueryResult;
7598
7922
  /**
7599
7923
  * Returns a Promise that will query the layer for all features at the specified coordinate and zoom level
7600
7924
  * (optional). If a value for `zoom` is not provided, then the map's current zoom level will be used.
@@ -7655,5 +7979,12 @@ export declare interface WebGLLayerConfig {
7655
7979
  * Animation instance that controls the animation of this layer if time-based.
7656
7980
  */
7657
7981
  animation: Animation;
7982
+ /**
7983
+ * Optional measurement metadata associated with this layer's values.
7984
+ */
7985
+ measurement: {
7986
+ type: ConversionMeasurement;
7987
+ units: string;
7988
+ };
7658
7989
  }
7659
7990