@tomtom-org/maps-sdk 0.45.7 → 0.45.9

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.
@@ -2597,6 +2597,17 @@ export declare type HasCount = {
2597
2597
  */
2598
2598
  export declare type HasLngLat = [number, number] | Position | Point | Feature<Point>;
2599
2599
 
2600
+ /**
2601
+ * Maps an `iconCategory` integer from the Incident Details API to a {@link TrafficIncidentCategory}.
2602
+ * Integer values that do not correspond to a known category are mapped to `'other'`.
2603
+ *
2604
+ * @param iconCategory - Integer category code from the API response
2605
+ * @returns The corresponding {@link TrafficIncidentCategory}
2606
+ *
2607
+ * @ignore
2608
+ */
2609
+ export declare const iconToTrafficIncidentCategory: (iconCategory: number) => TrafficIncidentCategory;
2610
+
2600
2611
  /**
2601
2612
  * Sections with important stretches of road information.
2602
2613
  *
@@ -4764,6 +4775,63 @@ export declare const toPointFeature: (coordinates: Position) => Feature<Point>;
4764
4775
  */
4765
4776
  export declare const toPointGeometry: (coordinates: Position) => Point;
4766
4777
 
4778
+ /**
4779
+ * A GeoJSON Feature representing a single traffic incident.
4780
+ *
4781
+ * The geometry is a `Point` for localised incidents or a `LineString`
4782
+ * for incidents that span a stretch of road.
4783
+ *
4784
+ * @group Traffic
4785
+ */
4786
+ export declare type TrafficIncident = Feature<Point | LineString, TrafficIncidentProperties>;
4787
+
4788
+ /**
4789
+ * Properties common to all traffic incident representations.
4790
+ *
4791
+ * @remarks
4792
+ * Shared between the Incident Details service response and map vector-tile features.
4793
+ *
4794
+ * @group Traffic
4795
+ */
4796
+ export declare type TrafficIncidentBaseProperties = {
4797
+ /**
4798
+ * Unique identifier of the incident.
4799
+ */
4800
+ id: string;
4801
+ /**
4802
+ * Primary category of the incident.
4803
+ */
4804
+ category: TrafficIncidentCategory;
4805
+ /**
4806
+ * Severity of the delay caused by this incident.
4807
+ */
4808
+ magnitudeOfDelay: DelayMagnitude;
4809
+ /**
4810
+ * Estimated delay caused by the incident in seconds.
4811
+ */
4812
+ delayInSeconds?: number;
4813
+ /**
4814
+ * Time when the incident started or is expected to start.
4815
+ */
4816
+ startTime?: Date;
4817
+ /**
4818
+ * Time when the incident ended or is expected to end.
4819
+ */
4820
+ endTime?: Date;
4821
+ /**
4822
+ * Confidence in the occurrence of the incident.
4823
+ */
4824
+ probabilityOfOccurrence?: TrafficIncidentProbability;
4825
+ /**
4826
+ * Number of user reports that contributed to this incident.
4827
+ */
4828
+ numberOfReports?: number;
4829
+ /**
4830
+ * Time of the most recent user report for this incident.
4831
+ */
4832
+ lastReportTime?: Date;
4833
+ };
4834
+
4767
4835
  /**
4768
4836
  * All possible traffic incident categories.
4769
4837
  * @group Traffic
@@ -4794,6 +4862,90 @@ export declare const trafficIncidentCategories: readonly ["accident", "animals-o
4794
4862
  */
4795
4863
  export declare type TrafficIncidentCategory = (typeof trafficIncidentCategories)[number];
4796
4864
 
4865
+ /**
4866
+ * Response from the Incident Details service.
4867
+ *
4868
+ * Extends the GeoJSON `FeatureCollection` standard, where each feature
4869
+ * is a {@link TrafficIncident}.
4870
+ *
4871
+ * @group Traffic
4872
+ */
4873
+ export declare type TrafficIncidentDetails = FeatureCollection<Point | LineString, TrafficIncidentProperties>;
4874
+
4875
+ /**
4876
+ * A single event contributing to a traffic incident.
4877
+ *
4878
+ * Incidents may have one or more events describing different aspects of the situation.
4879
+ *
4880
+ * @group Traffic
4881
+ */
4882
+ export declare type TrafficIncidentEvent = {
4883
+ /**
4884
+ * Human-readable description of the event.
4885
+ */
4886
+ description: string;
4887
+ /**
4888
+ * Numeric event code.
4889
+ */
4890
+ code: number;
4891
+ /**
4892
+ * Category of this specific event.
4893
+ */
4894
+ category: TrafficIncidentCategory;
4895
+ };
4896
+
4897
+ /**
4898
+ * Likelihood that an incident will actually occur.
4899
+ *
4900
+ * @remarks
4901
+ * - `certain`: The incident is confirmed and currently active
4902
+ * - `probable`: The incident is very likely to be occurring
4903
+ * - `risk_of`: There is a risk of this incident occurring
4904
+ * - `improbable`: The incident is unlikely to be occurring
4905
+ *
4906
+ * @group Traffic
4907
+ */
4908
+ export declare type TrafficIncidentProbability = 'certain' | 'probable' | 'risk_of' | 'improbable';
4909
+
4910
+ /**
4911
+ * Full properties of a traffic incident from the Incident Details service.
4912
+ *
4913
+ * Extends {@link TrafficIncidentBaseProperties} with fields available in the
4914
+ * Incident Details API response but not in map vector-tile features.
4915
+ *
4916
+ * @group Traffic
4917
+ */
4918
+ export declare type TrafficIncidentProperties = TrafficIncidentBaseProperties & {
4919
+ /**
4920
+ * One or more events describing the incident in detail.
4921
+ */
4922
+ events: TrafficIncidentEvent[];
4923
+ /**
4924
+ * Human-readable description of the start of the affected road.
4925
+ */
4926
+ from?: string;
4927
+ /**
4928
+ * Human-readable description of the end of the affected road.
4929
+ */
4930
+ to?: string;
4931
+ /**
4932
+ * Length of the affected road section in meters.
4933
+ */
4934
+ lengthInMeters?: number;
4935
+ /**
4936
+ * Road numbers (e.g. highway designations) affected by the incident.
4937
+ */
4938
+ roadNumbers?: string[];
4939
+ /**
4940
+ * Whether the incident is currently active or expected in the future.
4941
+ */
4942
+ timeValidity: TrafficIncidentTimeValidity;
4943
+ /**
4944
+ * TMC data for the incident, if available.
4945
+ */
4946
+ tmc?: TrafficIncidentTMC;
4947
+ };
4948
+
4797
4949
  /**
4798
4950
  * Traffic incident information based on TPEG2-TEC standard.
4799
4951
  *
@@ -4817,6 +4969,75 @@ export declare type TrafficIncidentTEC = {
4817
4969
  causes?: [CauseTEC, ...CauseTEC[]];
4818
4970
  };
4819
4971
 
4972
+ /**
4973
+ * Whether a traffic incident is currently active or anticipated in the future.
4974
+ *
4975
+ * @remarks
4976
+ * - `present`: The incident is currently active
4977
+ * - `future`: The incident is scheduled or predicted to occur in the future
4978
+ *
4979
+ * @group Traffic
4980
+ */
4981
+ export declare type TrafficIncidentTimeValidity = 'present' | 'future';
4982
+
4983
+ /**
4984
+ * Traffic Message Channel (TMC) data associated with a traffic incident.
4985
+ *
4986
+ * TMC is an international standard for encoding traffic and travel information
4987
+ * in FM radio broadcasts (RDS-TMC) and digital data streams.
4988
+ *
4989
+ * @group Traffic
4990
+ */
4991
+ export declare type TrafficIncidentTMC = {
4992
+ /**
4993
+ * ISO 3166-1 alpha-2 country code.
4994
+ */
4995
+ countryCode: string;
4996
+ /**
4997
+ * TMC table number.
4998
+ */
4999
+ tableNumber: string;
5000
+ /**
5001
+ * TMC table version.
5002
+ */
5003
+ tableVersion: string;
5004
+ /**
5005
+ * Direction of the incident along the TMC path.
5006
+ */
5007
+ direction: 'positive' | 'negative';
5008
+ /**
5009
+ * Ordered list of TMC location points describing the incident extent.
5010
+ */
5011
+ points: TrafficIncidentTMCPoint[];
5012
+ };
5013
+
5014
+ /**
5015
+ * A single TMC (Traffic Message Channel) location point.
5016
+ *
5017
+ * @group Traffic
5018
+ */
5019
+ export declare type TrafficIncidentTMCPoint = {
5020
+ /**
5021
+ * TMC location code.
5022
+ */
5023
+ location: number;
5024
+ /**
5025
+ * Offset from the TMC location in the direction of the incident.
5026
+ */
5027
+ offset?: number;
5028
+ };
5029
+
5030
+ /**
5031
+ * Maps a {@link TrafficIncidentCategory} string to the `iconCategory` integer used by the API.
5032
+ * `'other'` and any unrecognised values map to `0`.
5033
+ *
5034
+ * @param category - The string category
5035
+ * @returns The corresponding integer icon category code
5036
+ *
5037
+ * @ignore
5038
+ */
5039
+ export declare const trafficIncidentToIconCategory: (category: TrafficIncidentCategory) => number;
5040
+
4820
5041
  /**
4821
5042
  * Route section affected by a traffic incident.
4822
5043
  *
@@ -48,7 +48,9 @@ import { Source } from 'maplibre-gl';
48
48
  import { SourceSpecification } from 'maplibre-gl';
49
49
  import { StyleSpecification } from 'maplibre-gl';
50
50
  import { SymbolLayerSpecification } from 'maplibre-gl';
51
+ import { TrafficIncidentBaseProperties } from '@tomtom-org/maps-sdk/core';
51
52
  import { TrafficIncidentCategory } from '@tomtom-org/maps-sdk/core';
53
+ import { TrafficIncidentTimeValidity } from '@tomtom-org/maps-sdk/core';
52
54
  import { TrafficSectionProps } from '@tomtom-org/maps-sdk/core';
53
55
  import { Waypoint } from '@tomtom-org/maps-sdk/core';
54
56
  import { WaypointLike } from '@tomtom-org/maps-sdk/core';
@@ -3503,6 +3505,28 @@ export declare type GeometryLineLabelConfig = {
3503
3505
  * ```
3504
3506
  */
3505
3507
  symbolSpacing?: number;
3508
+ /**
3509
+ * Opacity of the border label text.
3510
+ *
3511
+ * @default 1
3512
+ *
3513
+ * @example
3514
+ * ```typescript
3515
+ * textOpacity: 0.8
3516
+ * ```
3517
+ */
3518
+ textOpacity?: DataDrivenPropertyValueSpecification<number>;
3519
+ /**
3520
+ * Offset of the border label from the line, in ems `[x, y]`.
3521
+ *
3522
+ * @default [0, 1]
3523
+ *
3524
+ * @example
3525
+ * ```typescript
3526
+ * textOffset: [0, 1] // Default: 1em above the line
3527
+ * ```
3528
+ */
3529
+ textOffset?: DataDrivenPropertyValueSpecification<[number, number]>;
3506
3530
  };
3507
3531
 
3508
3532
  /**
@@ -5965,13 +5989,6 @@ export declare const preparePlacesForDisplay: (placesInput: Place | Place[] | Pl
5965
5989
  */
5966
5990
  export declare const prepareReachableRangesForDisplay: (result: PolygonFeatures, theme?: GeometryTheme, label?: ReachableRangeLabelFn) => PolygonFeatures;
5967
5991
 
5968
- /**
5969
- * Likelihood of a traffic incident occurring.
5970
- *
5971
- * @group Traffic
5972
- */
5973
- export declare type ProbabilityOfOccurrence = 'certain' | 'probable' | 'risk_of' | 'improbable';
5974
-
5975
5992
  /**
5976
5993
  * Parameters to update the event state of a feature programmatically.
5977
5994
  *
@@ -6059,6 +6076,7 @@ export declare type PutEventStateOptions = ByIdOrIndex & {
6059
6076
  *
6060
6077
  * @param palette Color palette. Defaults to `'fadedRainbow'`.
6061
6078
  * @param theme Visual theme. Defaults to `'filled'`.
6079
+ * @param beforeLayerConfig Layer positioning. Defaults to `'lowestLabel'`.
6062
6080
  * @param label Custom label generator; when omitted, labels are derived from `budget` property.
6063
6081
  *
6064
6082
  * @example
@@ -6070,7 +6088,7 @@ export declare type PutEventStateOptions = ByIdOrIndex & {
6070
6088
  *
6071
6089
  * @group Geometries
6072
6090
  */
6073
- export declare const reachableRangeGeometryConfig: (palette?: ColorPaletteOptions, theme?: GeometryTheme, label?: ReachableRangeLabelFn) => GeometriesModuleConfig;
6091
+ export declare const reachableRangeGeometryConfig: (palette?: ColorPaletteOptions, theme?: GeometryTheme, beforeLayerConfig?: GeometryBeforeLayerConfig, label?: ReachableRangeLabelFn) => GeometriesModuleConfig;
6074
6092
 
6075
6093
  /** Custom label generator for reachable range features. */
6076
6094
  export declare type ReachableRangeLabelFn = (feature: PolygonFeature, index: number) => string;
@@ -7520,17 +7538,11 @@ export declare type SymbolLayerSpecWithoutSource = Omit<SymbolLayerSpecification
7520
7538
  * with auto-generated labels.
7521
7539
  *
7522
7540
  * @param palette Color palette for polygon fills. Defaults to `'fadedRainbow'`.
7541
+ * @param beforeLayerConfig Layer positioning. Defaults to `'lowestLabel'`.
7523
7542
  *
7524
7543
  * @group Geometries
7525
7544
  */
7526
- export declare const themedGeometryConfig: (palette?: ColorPaletteOptions) => GeometriesModuleConfig;
7527
-
7528
- /**
7529
- * Whether the incident is currently active or expected in the future.
7530
- *
7531
- * @group Traffic
7532
- */
7533
- export declare type TimeValidity = 'present' | 'future';
7545
+ export declare const themedGeometryConfig: (palette?: ColorPaletteOptions, beforeLayerConfig?: GeometryBeforeLayerConfig) => GeometriesModuleConfig;
7534
7546
 
7535
7547
  /**
7536
7548
  * @ignore
@@ -9102,27 +9114,11 @@ export declare type TrafficIncidentsModuleFeature = Omit<MapGeoJSONFeature, 'pro
9102
9114
  * @remarks
9103
9115
  * These properties include a unique identifier for the incident, a description of the incident, its category, the magnitude of any resulting delay, and information about the road where the incident is occurring (including road category and subcategory). Additionally, it indicates whether the incident is in a left-hand traffic region.
9104
9116
  */
9105
- properties: {
9106
- /**
9107
- * Unique identifier for the traffic incident, common across Traffic API services.
9108
- */
9109
- id: string;
9117
+ properties: TrafficIncidentBaseProperties & {
9110
9118
  /**
9111
9119
  * Description of the traffic incident, providing details about the nature of the incident.
9112
9120
  */
9113
9121
  description: string;
9114
- /**
9115
- * Category of the traffic incident, classifying the type of incident (e.g., accident, roadworks, congestion) based on predefined categories.
9116
- */
9117
- category: TrafficIncidentCategory;
9118
- /**
9119
- * Severity of the delay.
9120
- */
9121
- magnitudeOfDelay: DelayMagnitude;
9122
- /**
9123
- * The delay caused by the incident in seconds (except in road closures). It is calculated against free-flow travel time (the travel time when the traffic is minimal, e.g., night traffic).
9124
- */
9125
- delayInSeconds?: number;
9126
9122
  /**
9127
9123
  * Road hierarchy category type.
9128
9124
  */
@@ -9139,26 +9135,6 @@ export declare type TrafficIncidentsModuleFeature = Omit<MapGeoJSONFeature, 'pro
9139
9135
  * Indicates whether the incident covers different directional geometries (i.e. both directions of a two-way road).
9140
9136
  */
9141
9137
  partOfTwoWayRoad?: boolean;
9142
- /**
9143
- * The date and time when the incident started.
9144
- */
9145
- startTime?: Date;
9146
- /**
9147
- * The estimated date and time when the incident will end.
9148
- */
9149
- endTime?: Date;
9150
- /**
9151
- * Likelihood assessment of the incident occurring.
9152
- */
9153
- probabilityOfOccurrence?: ProbabilityOfOccurrence;
9154
- /**
9155
- * Number of user reports for the incident.
9156
- */
9157
- numberOfReports?: number;
9158
- /**
9159
- * The date and time of the most recent user report for the incident.
9160
- */
9161
- lastReportTime?: Date;
9162
9138
  /**
9163
9139
  * Average speed within the incident area, in km/h.
9164
9140
  */
@@ -9170,7 +9146,7 @@ export declare type TrafficIncidentsModuleFeature = Omit<MapGeoJSONFeature, 'pro
9170
9146
  /**
9171
9147
  * Whether the incident is currently active or expected in the future.
9172
9148
  */
9173
- timeValidity?: TimeValidity;
9149
+ timeValidity?: TrafficIncidentTimeValidity;
9174
9150
  /**
9175
9151
  * Positive integer ranking the importance of the road where the incident occurs.
9176
9152
  */