@tomtom-org/maps-sdk 1.0.0-rc.5 → 1.0.0-rc.6

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.
@@ -1,3 +1,40 @@
1
+ //#region src/types/apiErrorDetails.d.ts
2
+ /**
3
+ * The access a Private Preview API needs on the API key, and where to request it.
4
+ *
5
+ * @group Errors
6
+ */
7
+ type PrivatePreviewAccess = {
8
+ /**
9
+ * The API the key needs access to, as TomTom Sales names it, such as `'Calculate Reachable Range'`.
10
+ */
11
+ product: string;
12
+ /**
13
+ * Where to request that access.
14
+ */
15
+ requestAccessURL: string;
16
+ };
17
+ /**
18
+ * What a TomTom API said about a request it failed, as a service's `SDKServiceError` and the map's
19
+ * `TomTomMapError` both carry it.
20
+ *
21
+ * @group Errors
22
+ */
23
+ type APIErrorDetails = {
24
+ /**
25
+ * The API's own name for the error, from its `detailedError.code`, when its response carries one.
26
+ *
27
+ * On an `INSUFFICIENT_PERMISSIONS` it tells the causes apart: `'Forbidden'` when the API is not enabled for
28
+ * the key, `'InvalidReferer'` when the key's domain restriction refused the page.
29
+ */
30
+ readonly apiErrorCode?: string;
31
+ /**
32
+ * The access the API key lacks, on an `INSUFFICIENT_PERMISSIONS` from a Private Preview API, such as
33
+ * Calculate Reachable Range or the Landmarks 3D tiles, that named no other cause. The message names it too.
34
+ */
35
+ readonly privatePreviewAccess?: PrivatePreviewAccess;
36
+ };
37
+ //#endregion
1
38
  //#region ../node_modules/.pnpm/@types+geojson@7946.0.16/node_modules/@types/geojson/index.d.ts
2
39
  /**
3
40
  * The value values for the "type" property of GeoJSON Objects.
@@ -291,14 +328,6 @@ type AggregatedCells<S extends CellStatistic, G extends CellGrid> = [G] extends
291
328
  *
292
329
  * Use it for objects whose shape is not fixed, such as extensible properties or arbitrary user data.
293
330
  *
294
- * @example
295
- * ```typescript
296
- * function processCustomData(data: Anything) {
297
- * // Access properties dynamically
298
- * console.log(data['customField']);
299
- * }
300
- * ```
301
- *
302
331
  * @group Shared
303
332
  */
304
333
  type Anything = {
@@ -322,13 +351,13 @@ type Anything = {
322
351
  * @example
323
352
  * ```typescript
324
353
  * // Plain coordinate pair
325
- * const pos1: HasLngLat = [4.9041, 52.3676];
354
+ * const pair: HasLngLat = [4.9041, 52.3676];
326
355
  *
327
356
  * // GeoJSON Point geometry
328
- * const pos2: HasLngLat = { type: 'Point', coordinates: [4.9041, 52.3676] };
357
+ * const point: HasLngLat = { type: 'Point', coordinates: [4.9041, 52.3676] };
329
358
  *
330
359
  * // GeoJSON Feature<Point> — e.g. a Place from search results
331
- * const pos3: HasLngLat = searchResults.features[0];
360
+ * const feature: HasLngLat = searchResults.features[0];
332
361
  * ```
333
362
  *
334
363
  * @group Shared
@@ -410,6 +439,7 @@ type OptionalBBox = BBox | undefined;
410
439
  * [4.8, 52.3]
411
440
  * ]]
412
441
  * },
442
+ * bbox: [4.8, 52.3, 5.0, 52.4],
413
443
  * properties: {
414
444
  * name: 'Amsterdam',
415
445
  * population: 872680
@@ -443,11 +473,13 @@ type PolygonFeature<P = GeoJsonProperties> = Omit<Feature<Polygon | MultiPolygon
443
473
  * {
444
474
  * type: 'Feature',
445
475
  * geometry: { type: 'Polygon', coordinates: [...] },
476
+ * bbox: [4.88, 52.36, 4.92, 52.38],
446
477
  * properties: { name: 'District 1', area: 500000 }
447
478
  * },
448
479
  * {
449
480
  * type: 'Feature',
450
481
  * geometry: { type: 'Polygon', coordinates: [...] },
482
+ * bbox: [4.92, 52.36, 4.96, 52.38],
451
483
  * properties: { name: 'District 2', area: 750000 }
452
484
  * }
453
485
  * ]
@@ -456,16 +488,11 @@ type PolygonFeature<P = GeoJsonProperties> = Omit<Feature<Polygon | MultiPolygon
456
488
  *
457
489
  * @group Shared
458
490
  */
459
- type PolygonFeatures<P = GeoJsonProperties> = Omit<FeatureCollection<Polygon | MultiPolygon, P>, 'features' | 'bbox'> & {
491
+ type PolygonFeatures<P = GeoJsonProperties> = Omit<FeatureCollectionWithProperties<Polygon | MultiPolygon, P>, 'features' | 'properties'> & {
460
492
  /**
461
493
  * The polygon or multi-polygon features.
462
494
  */
463
495
  features: PolygonFeature<P>[];
464
- /**
465
- * The bounding box of all features in the collection, including any bounding boxes they have.
466
- * It is present only if the collection has features.
467
- */
468
- bbox?: BBox;
469
496
  };
470
497
  /**
471
498
  * A GeoJSON FeatureCollection with an optional `properties` field at the collection level.
@@ -532,7 +559,7 @@ export declare const geopoliticalViews: readonly ["Unified", "AE", "AR", "BN", "
532
559
  *
533
560
  * @example
534
561
  * ```typescript
535
- * // The map and every service, from India's perspective
562
+ * // The map and the services GeopoliticalViewAPI lists, from India's perspective
536
563
  * TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY', geopoliticalView: 'IN' });
537
564
  * ```
538
565
  *
@@ -573,7 +600,7 @@ export type GeopoliticalViewAPI = 'mapTiles' | 'search' | 'placeDetails' | 'reve
573
600
  * const position = getPosition(place, { useEntryPoint: 'main-when-available' });
574
601
  *
575
602
  * // Get center position ignoring entry points
576
- * const centerPos = getPosition(place, { useEntryPoint: 'ignore' });
603
+ * const center = getPosition(place, { useEntryPoint: 'ignore' });
577
604
  * ```
578
605
  *
579
606
  * @group Shared
@@ -586,21 +613,9 @@ type GetPositionEntryPointOption = 'main-when-available' | 'ignore';
586
613
  */
587
614
  type GetPositionOptions = {
588
615
  /**
589
- * Whether to use entry point positions when available.
590
- *
591
- * With `'main-when-available'`, you get an entry point's coordinates, as {@link GetPositionEntryPointOption}
592
- * describes. Use it for routing, to direct users to the correct entrance.
616
+ * Whether to use entry point positions when available, as {@link GetPositionEntryPointOption} describes.
593
617
  *
594
618
  * @default 'ignore'
595
- *
596
- * @example
597
- * ```typescript
598
- * // For routing to a specific entrance
599
- * { useEntryPoint: 'main-when-available' }
600
- *
601
- * // For displaying place center on map
602
- * { useEntryPoint: 'ignore' }
603
- * ```
604
619
  */
605
620
  useEntryPoint?: GetPositionEntryPointOption;
606
621
  };
@@ -625,13 +640,6 @@ type TomTomAPIHeaders = {
625
640
  *
626
641
  * They set the language of map labels, place names, addresses and other textual content.
627
642
  *
628
- * The array includes:
629
- * - Region-specific language variants (e.g., `en-US`, `en-GB`, `pt-BR`, `pt-PT`)
630
- * - Script-specific variants (e.g., `zh-Hans` for Simplified Chinese, `zh-Hant` for Traditional Chinese)
631
- * - Special codes like `ngt` (Neutral Ground Truth) for language-neutral content
632
- * - Latin script alternatives (e.g., `ngt-Latn`, `ko-Latn-KR`, `ru-Latn-RU`)
633
- * - Cyrillic script variants (e.g., `ru-Cyrl-RU`)
634
- *
635
643
  * Use it to check whether a user-provided language code is supported, to generate language
636
644
  * selection UI or to iterate over all language options.
637
645
  *
@@ -641,18 +649,11 @@ type TomTomAPIHeaders = {
641
649
  * @example
642
650
  * ```typescript
643
651
  * // Validate a language code
644
- * const userLanguage = 'en-US';
645
- * if (languages.includes(userLanguage)) {
652
+ * const userLanguage: string = 'en-US';
653
+ * const knownLanguages: readonly string[] = languages;
654
+ * if (knownLanguages.includes(userLanguage)) {
646
655
  * console.log('Language is supported');
647
656
  * }
648
- *
649
- * // Create a language selector
650
- * languages.forEach(lang => {
651
- * console.log(`Available language: ${lang}`);
652
- * });
653
- *
654
- * // Check total number of supported languages
655
- * console.log(`Total languages: ${languages.length}`);
656
657
  * ```
657
658
  *
658
659
  * @group Shared
@@ -665,27 +666,16 @@ export declare const languages: readonly ["ngt", "ngt-Latn", "ar", "eu-ES", "bg-
665
666
  * - Map labels and text on vector tiles.
666
667
  * - Place names, addresses and other textual content in service responses.
667
668
  *
668
- * `Language` lists every language the map labels carry. A service that lacks one answers in local names,
669
- * as the places services do for `hi-IN` and `ja-JP`. Text a service writes itself, such as route
670
- * instructions, POI category names and traffic incident descriptions, comes in the nearest language it has,
671
- * or in English.
672
- *
673
669
  * It covers locales with region-specific variants, such as `en-US` and `en-GB`. Special codes
674
670
  * such as `ngt` (Neutral Ground Truth) and `ngt-Latn` give language-neutral or Latin script alternatives.
675
671
  *
676
- * @see [Supported languages documentation](https://docs.tomtom.com/map-display-api/documentation/vector/content-v2#list-of-supported-languages)
677
- *
678
- * @example
679
- * ```typescript
680
- * // Use US English
681
- * const language: Language = 'en-US';
682
- *
683
- * // Use simplified Chinese
684
- * const language: Language = 'zh-Hans';
672
+ * @remarks
673
+ * `Language` lists every language the map labels carry. Where a service lacks one:
674
+ * - Names come in their local language, as the places services give them for `hi-IN` and `ja-JP`.
675
+ * - Text the service writes itself, such as route instructions, POI category names and traffic
676
+ * incident descriptions, comes in the nearest language it has, or in English.
685
677
  *
686
- * // Use neutral ground truth (no translation)
687
- * const language: Language = 'ngt';
688
- * ```
678
+ * @see [Supported languages documentation](https://docs.tomtom.com/map-display-api/documentation/vector/content-v2#list-of-supported-languages)
689
679
  *
690
680
  * @group Shared
691
681
  */
@@ -712,11 +702,6 @@ export declare const connectorTypes: readonly ["StandardHouseholdCountrySpecific
712
702
  * - `Tesla`: Tesla proprietary connector
713
703
  * - `GBT20234Part2/3`: Chinese GB/T standard
714
704
  *
715
- * @example
716
- * ```typescript
717
- * const connectorType: ConnectorType = 'IEC62196Type2CCS';
718
- * ```
719
- *
720
705
  * @group Place
721
706
  */
722
707
  export type ConnectorType = (typeof connectorTypes)[number];
@@ -733,11 +718,6 @@ export declare const currentTypes: readonly ["AC1", "AC3", "DC"];
733
718
  * - `AC3`: Alternating Current, three-phase (faster AC charging, up to 22 kW)
734
719
  * - `DC`: Direct Current (DC fast charging, 50-350+ kW)
735
720
  *
736
- * @example
737
- * ```typescript
738
- * const currentType: CurrentType = 'DC'; // DC fast charging
739
- * ```
740
- *
741
721
  * @group Place
742
722
  */
743
723
  export type CurrentType = (typeof currentTypes)[number];
@@ -839,7 +819,7 @@ export type ConnectorCount = HasConnector & HasCount;
839
819
  //#endregion
840
820
  //#region src/types/place/ev/chargingStation.d.ts
841
821
  /**
842
- * Possible capabilities for a charging point.
822
+ * Every {@link ChargingPointCapability}.
843
823
  * @group Place
844
824
  */
845
825
  export declare const chargingPointCapabilities: readonly ["ChargingProfileCapable", "ChargingPreferencesCapable", "ChipCardSupport", "ContactlessCardSupport", "CreditCardPayable", "DebitCardPayable", "PedTerminal", "RemoteStartStopCapable", "Reservable", "RfidReader", "StartSessionConnectorRequired", "TokenGroupCapable", "UnlockCapable", "PlugAndCharge", "Unknown"];
@@ -863,16 +843,6 @@ export declare const chargingPointCapabilities: readonly ["ChargingProfileCapabl
863
843
  * - `PlugAndCharge`: Supports ISO 15118 Plug & Charge (automatic authentication)
864
844
  * - `Unknown`: Capability not specified
865
845
  *
866
- * @example
867
- * ```typescript
868
- * // Check for specific capabilities
869
- * const capabilities: ChargingPointCapability[] = [
870
- * 'CreditCardPayable',
871
- * 'Reservable',
872
- * 'RemoteStartStopCapable'
873
- * ];
874
- * ```
875
- *
876
846
  * @group Place
877
847
  */
878
848
  export type ChargingPointCapability = (typeof chargingPointCapabilities)[number];
@@ -891,11 +861,6 @@ export declare const chargingPointRestrictions: readonly ["EvOnly", "Plugged", "
891
861
  * - `Customers`: For customers/guests only (e.g., hotel, shop)
892
862
  * - `Motorcycles`: Suitable only for electric motorcycles or scooters
893
863
  *
894
- * @example
895
- * ```typescript
896
- * const restrictions: ChargingPointRestriction[] = ['EvOnly', 'Customers'];
897
- * ```
898
- *
899
864
  * @group Place
900
865
  */
901
866
  export type ChargingPointRestriction = (typeof chargingPointRestrictions)[number];
@@ -998,14 +963,11 @@ export type ChargingStation = {
998
963
  */
999
964
  type ChargingPark = {
1000
965
  /**
1001
- * The connector counts, grouped by type and power level.
1002
- *
1003
- * They are static counts of how many connectors of each type the location has,
1004
- * without real-time availability status.
966
+ * How many connectors the location has, grouped by type and power level.
1005
967
  */
1006
968
  connectors: ConnectorCount[];
1007
969
  /**
1008
- * The charging stations and their charging points (EVSEs), without real-time status.
970
+ * The charging stations and their charging points (EVSEs).
1009
971
  *
1010
972
  * Present on places returned by the search services.
1011
973
  */
@@ -1045,10 +1007,7 @@ type PlaceDataSources = {
1045
1007
  */
1046
1008
  geometry?: GeometryDataSource;
1047
1009
  /**
1048
- * The data source for detailed POI information, which the Orbis places API doesn't return.
1049
- *
1050
- * @remarks
1051
- * To fetch a place's details, pass the place's own `id` to `getPlaceDetails`.
1010
+ * The data source for detailed POI information: see {@link PoiDetailsDataSource}.
1052
1011
  */
1053
1012
  poiDetails?: PoiDetailsDataSource;
1054
1013
  };
@@ -1078,7 +1037,7 @@ type GeometryDataSource = {
1078
1037
  * Data source reference for detailed POI information, which the Orbis places API doesn't return.
1079
1038
  *
1080
1039
  * @remarks
1081
- * To fetch a place's details, pass the place's own `id` to `getPlaceDetails`.
1040
+ * To fetch a place's details, pass the place's own `id` to `getPlaceDetails` as its `entityId`.
1082
1041
  *
1083
1042
  * @group Place
1084
1043
  */
@@ -1105,13 +1064,6 @@ type PoiDetailsDataSource = {
1105
1064
  *
1106
1065
  * @see [IANA Time Zone Database](https://www.iana.org/time-zones)
1107
1066
  *
1108
- * @example
1109
- * ```typescript
1110
- * const timezone: TimeZone = {
1111
- * ianaId: 'Europe/Amsterdam'
1112
- * };
1113
- * ```
1114
- *
1115
1067
  * @group Shared
1116
1068
  */
1117
1069
  type TimeZone = {
@@ -1123,10 +1075,12 @@ type TimeZone = {
1123
1075
  //#endregion
1124
1076
  //#region src/types/place/poi/category.d.ts
1125
1077
  /**
1078
+ * Every {@link POICategory}.
1126
1079
  * @group Place
1127
1080
  */
1128
1081
  export declare const poiCategories: readonly ["ABORIGINAL_LAND", "ADVENTURE_SPORTS_FACILITY", "ADVENTURE_VEHICLE_TRAIL", "ADVERTISING_COMPANY", "AFGHAN_RESTAURANT", "AFRICAN_RESTAURANT", "AGRICULTURAL_SUPPLIES", "AGRICULTURAL_TECHNOLOGY", "AGRICULTURE", "AIRFIELD", "AIRLINE_ACCESS", "AIRLINE_COMPANY", "AIRPORT", "AMBULANCE_UNIT", "AMERICAN_RESTAURANT", "AMPHITHEATER", "AMUSEMENT_PARK", "AMUSEMENT_PARK_GENERIC", "AMUSEMENT_PLACE", "ANIMAL_SERVICE", "ANIMAL_SHELTER", "ANTIQUE_ART_SHOP", "APARTMENT_RENTAL", "AQUATIC_ZOO", "ARABIAN_RESTAURANT", "ARBORETA_AND_BOTANICAL_GARDENS", "ARCH", "ARMENIAN_RESTAURANT", "ART_SCHOOL", "ASIAN_RESTAURANT", "ATHLETICS_TRACK", "ATM", "ATV_DEALER", "AUSTRALIAN_RESTAURANT", "AUSTRIAN_RESTAURANT", "AUTOMOBILE_COMPANY", "AUTOMOBILE_MANUFACTURING", "BAGS_LEATHERWEAR", "BAKERY", "BANDB_OR_GUEST_HOUSE", "BANK", "BANQUET_ROOMS", "BAR", "BARBECUE_RESTAURANT", "BASEBALL_PARK", "BASKETBALL_ARENA", "BASQUE_RESTAURANT", "BATTLEFIELD", "BAY", "BEACH", "BEACH_CLUB", "BEAUTY_SALON", "BEAUTY_SUPPLIES", "BELGIAN_RESTAURANT", "BETTING_STATION", "BISTRO", "BLOOD_BANK", "BOATING_EQUIPMENT_AND_ACCESSORIES", "BOAT_DEALER", "BOAT_LAUNCHING_RAMP", "BODYSHOP", "BOLIVIAN_RESTAURANT", "BOOK_SHOP", "BORDER_CONTROL", "BOWLING_CENTER", "BRAZILIAN_RESTAURANT", "BRIDGE", "BRITISH_RESTAURANT", "BUFFET_RESTAURANT", "BUILDING", "BULGARIAN_RESTAURANT", "BUNGALOW_RENTAL", "BURMESE_RESTAURANT", "BUSINESS_PARK", "BUSINESS_SERVICES", "BUS_CHARTER_COMPANY", "BUS_DEALER", "BUS_LINES", "BUS_STOP", "BUTCHER", "CABARET_THEATER", "CABINS_LODGES", "CABLE_AND_TELEPHONE_COMPANY", "CAFE", "CAFETERIA", "CAFE_PUB", "CALIFORNIAN_RESTAURANT", "CAMBODIAN_RESTAURANT", "CAMERAS_AND_PHOTOGRAPHY", "CAMPING_GROUND", "CANADIAN_RESTAURANT", "CANNABIS_SHOP", "CAPE", "CARAVAN_SITE", "CARIBBEAN_RESTAURANT", "CARPET_FLOOR_COVERINGS", "CAR_DEALER", "CAR_GLASS_REPLACEMENT_SHOP", "CAR_RENTAL", "CAR_REPAIR_AND_SERVICE", "CAR_WASH", "CAR_WASH_GENERIC", "CASINO_AND_GAMBLING", "CATERING_SERVICES", "CAVE", "CEMETERY", "CHALET_RENTAL", "CHARGING_LOCATION", "CHEMICAL_COMPANY", "CHICKEN_RESTAURANT", "CHILDCARE", "CHILDREN_S_CLOTHES", "CHILEAN_RESTAURANT", "CHINESE_RESTAURANT", "CHRISTMAS_OR_HOLIDAY_SHOP", "CHURCH", "CINEMA", "CLEANING_SERVICES", "CLOTHING_SHOP", "CLUB_AND_ASSOCIATION", "COCKTAIL_BAR", "COFFEE_SHOP", "COLLEGE_OR_UNIVERSITY", "COLLEGE_OR_UNIVERSITY_GENERIC", "COLOMBIAN_RESTAURANT", "COMEDY_CLUB", "COMMERCIAL_BUILDING", "COMMUNITY_CENTER", "COMPANY", "COMPUTER_AND_COMPUTER_SUPPLIES", "COMPUTER_AND_DATA_SERVICES", "CONCERT_HALL", "CONSTRUCTION_COMPANY", "CONSTRUCTION_MATERIAL_AND_EQUIPMENT", "CONSUMER_ELECTRONICS", "CONVENIENCE_STORE", "CORSICAN_RESTAURANT", "COTTAGE_RENTAL", "COURIER_DROP_BOX", "COURTHOUSE", "COVE", "CREOLE_RESTAURANT", "CREPERIE", "CRICKET_GROUND", "CUBAN_RESTAURANT", "CULTURAL_CENTER", "CURTAINS_TEXTILES", "CZECH_RESTAURANT", "C_DS_DVD_VIDEOS", "DAM", "DANCE_STUDIO_AND_SCHOOL", "DANISH_RESTAURANT", "DELICATESSEN", "DELIVERY_SERVICE", "DENTIST", "DEPARTMENT_STORE", "DINNER_THEATER", "DISCO_CLUB", "DIVERSIFIED_FINANCIALS", "DOCTOR", "DONGBEI_RESTAURANT", "DOUGHNUT_RESTAURANT", "DO_IT_YOURSELF_CENTERS", "DRIVE_IN_MOVIES", "DRIVE_THROUGH_BOTTLE_SHOP", "DRIVING_SCHOOL", "DRUG_STORE", "DRY_CLEANER", "DUNE", "DUTCH_RESTAURANT", "EGYPTIAN_RESTAURANT", "ELECTRICAL_APPLIANCES_SHOP", "ELECTRONICS_COMPANY", "EMBASSY", "EMERGENCY_MEDICAL_SERVICE", "EMERGENCY_ROOM", "ENGLISH_RESTAURANT", "ENTERTAINMENT", "EQUIPMENT_RENTAL", "ETHIOPIAN_RESTAURANT", "EXCHANGE", "EXHIBITION_CONVENTION_CENTER", "FACTORY_OUTLET", "FAIRGROUND", "FARM", "FARMERS_MARKET", "FAST_FOOD", "FERRY_TERMINAL", "FINNISH_RESTAURANT", "FIRE_STATION", "FISHING_AND_HUNTING_AREA", "FISHMONGER", "FITNESS_CLUB_AND_CENTER", "FLATS_OR_APARTMENT_COMPLEX", "FLORISTS", "FLYING_CLUB", "FONDUE_RESTAURANT", "FOOD_AND_DRINKS_SHOP", "FOOD_MARKET", "FOOTBALL_STADIUM", "FOOTWEAR_SHOE_REPAIRS", "FOREIGN_EXCHANGE", "FOREST_AREA", "FRENCH_RESTAURANT", "FUEL_STATION", "FUNERAL_SERVICE_AND_MORTUARIES", "FURNITURE_HOME_FURNISHINGS", "FUSION_RESTAURANT", "GARDEN_CENTERS_SERVICES", "GENERAL_HOSPITAL_AND_POLYCLINIC", "GENERAL_PRACTITIONER", "GERMAN_RESTAURANT", "GIFTS_CARDS_NOVELTIES_SOUVENIRS", "GLASSWARE_CERAMIC_SHOP", "GLASS_WINDOWS_STORE", "GOLD_EXCHANGE", "GOLF_COURSE", "GOVERNMENT_OFFICE", "GREEK_RESTAURANT", "GREENGROCER", "GRILL_RESTAURANT", "GROCERY_STORE", "GURUDWARA", "HAIRDRESSER", "HAMBURGER_RESTAURANT", "HARBOR", "HARDWARE_STORE", "HAWAIIAN_RESTAURANT", "HEALTHCARE_SERVICE", "HELIPORT_OR_HELIPAD", "HIGH_SCHOOL", "HIKING_TRAIL", "HILL", "HISTORICAL_PARK", "HISTORIC_SITE", "HOBBY_SHOP", "HOCKEY_CLUB", "HOLIDAY_RENTAL", "HOME_APPLIANCE_REPAIR", "HORSE_RACING_TRACK", "HORSE_RIDING", "HORSE_RIDING_TRAIL", "HORTICULTURE", "HOSPITAL", "HOSPITAL_FOR_WOMEN_AND_CHILDREN", "HOSPITAL_OF_CHINESE_MEDICINE", "HOSTEL", "HOTEL", "HOTEL_OR_MOTEL", "HOT_POT_RESTAURANT", "HOUSE_AND_GARDEN_FURNITURE_AND_FITTINGS", "HUNAN_RESTAURANT", "HUNGARIAN_RESTAURANT", "ICE_CREAM_PARLOR", "ICE_HOCKEY_ARENA", "ICE_RINK", "IMPORT_OR_EXPORT_AND_DISTRIBUTION", "INDIAN_RESTAURANT", "INDONESIAN_RESTAURANT", "INDUSTRIAL_BUILDING", "INFORMAL_MARKET", "INSURANCE_COMPANY", "INTERNATIONAL_RAILROAD_STATION", "INTERNATIONAL_RESTAURANT", "INTERNET_CAFE", "INVESTMENT_ADVISOR", "IRANIAN_RESTAURANT", "IRISH_RESTAURANT", "ISLAND", "ISRAELI_RESTAURANT", "ITALIAN_RESTAURANT", "JAMAICAN_RESTAURANT", "JAPANESE_RESTAURANT", "JAZZ_CLUB", "JEWELRY_CLOCKS_WATCHES", "JEWISH_RESTAURANT", "JUICE_BAR", "JUNIOR_COLLEGE_OR_COMMUNITY_COLLEGE", "KARAOKE_CLUB", "KITCHENS_BATHROOMS", "KOREAN_RESTAURANT", "KOSHER_RESTAURANT", "LANGUAGE_SCHOOL", "LATIN_AMERICAN_RESTAURANT", "LAUNDRY", "LEBANESE_RESTAURANT", "LEGAL_SERVICES", "LEISURE_CENTER", "LIGHTING_SHOPS", "LOCALE", "LOCAL_SPECIALITIES_SHOP", "LOTTERY_SHOP", "MALL", "MANUFACTURING_COMPANY", "MANUFACTURING_FACILITY", "MARINA", "MARINA_GENERIC", "MARKETPLACE", "MARSH", "MAUSOLEUM_OR_GRAVE", "MECHANICAL_ENGINEERING", "MEDIA_FACILITY", "MEDICAL_SUPPLIES_EQUIPMENT", "MEDICINAL_AND_RECREATIONAL_DISPENSARY", "MEDICINAL_MARIJUANA_DISPENSARY", "MEDITERRANEAN_RESTAURANT", "MEMORIAL", "MEN_S_CLOTHING", "MEXICAN_RESTAURANT", "MICROBREWERY", "MIDDLE_EASTERN_RESTAURANT", "MIDDLE_SCHOOL", "MILITARY_AIRPORT", "MINERAL_OR_HOT_SPRINGS", "MINING_COMPANY", "MOBILE_PHONE_SHOP", "MONGOLIAN_RESTAURANT", "MONUMENT", "MOROCCAN_RESTAURANT", "MOSQUE", "MOTEL", "MOTORCYCLE_DEALER", "MOTORCYCLE_REPAIR", "MOTORING_ORGANIZATION_OFFICE", "MOTOR_RACING_STADIUM", "MOUNTAIN_BIKE_TRAIL", "MOUNTAIN_PASS", "MOUNTAIN_PEAK", "MOVIE_THEATER", "MOVING_AND_STORAGE_COMPANY", "MULTI_PURPOSE_STADIUM", "MUSEUM", "MUSIC_CENTER", "MUSIC_INSTRUMENTS_STORE", "NAIL_SALON", "NATIONAL_RAILROAD_STATION", "NATURAL_FEATURE", "NATURAL_TOURIST_ATTRACTION", "NEPALESE_RESTAURANT", "NETBALL_STADIUM", "NEWSAGENTS_TOBACCONISTS", "NIGHTLIFE", "NON_GOVERNMENTAL_ORGANIZATION", "NORWEGIAN_RESTAURANT", "OASIS", "OBSERVATORY", "OFFICE_EQUIPMENT", "OIL_AND_NATURAL_GAS", "OPEN_CAR_PARKING_AREA", "OPEN_CAR_PARKING_AREA_GENERIC", "OPERA_HOUSE", "OPTICIAN", "ORGANIC_FOOD_RESTAURANT", "ORIENTAL_RESTAURANT", "PAGODA", "PAINTING_DECORATING", "PAKISTANI_RESTAURANT", "PAN", "PARK", "PARKING_GARAGE", "PARKWAY", "PARK_AND_RECREATION_AREA", "PASSENGER_TRANSPORT_TICKET_OFFICE", "PAWN_SHOP", "PEDESTRIAN_SUBWAY", "PERSONAL_CARE_FACILITY", "PERSONAL_SERVICE", "PERUVIAN_RESTAURANT", "PET_SUPPLIES", "PHARMACEUTICAL_COMPANY", "PHARMACY", "PHILIPPINE_RESTAURANT", "PHOTOCOPY_SHOP", "PHOTO_LAB_OR_DEVELOPMENT", "PICNIC_AREA", "PIZZERIA", "PLAIN_OR_FLAT", "PLANETARIUM", "PLATEAU", "POLICE_STATION", "POLISH_RESTAURANT", "PORTUGUESE_RESTAURANT", "PORT_WAREHOUSE_FACILITY", "POST_OFFICE", "PRE_SCHOOL", "PRIMARY_PRODUCER", "PRIMARY_RESOURCE_UTILITY", "PRIMARY_SCHOOL", "PRISON", "PRIVATE_AIRPORT", "PROTECTED_LAND", "PUB", "PUBLIC_AIRPORT", "PUBLIC_AMENITY", "PUBLIC_BATHROOM", "PUBLIC_CALL_BOX", "PUBLIC_LIBRARY", "PUBLIC_MARKET", "PUBLIC_TRANSPORT_STOP", "PUBLISHING_TECHNOLOGIES", "QUARRY", "RACE_TRACK", "RAILWAY_STATION", "RAPIDS", "REAL_ESTATE_AGENT", "REAL_ESTATE_COMPANY", "RECREATIONAL_CAMPING_GROUND", "RECREATIONAL_MARIJUANA_DISPENSARY", "RECREATIONAL_VEHICLE_DEALER", "RECREATION_AREA", "RECYCLING_SHOP", "REEF", "RELIGIOUS_SITE", "RENTAL_CAR_PARKING", "RESCUE_SERVICE", "RESEARCH_FACILITY", "RESERVOIR", "RESIDENTIAL_ACCOMMODATION", "RESIDENTIAL_ENTRANCE", "RESORT", "RESTAURANT", "RESTAURANT_AREA", "REST_AREA", "REST_CAMP", "RETAIL_OUTLET", "RETIREMENT_COMMUNITY", "RIDGE", "RIVER_CROSSING", "ROCKS", "ROCK_CLIMBING_TRAIL", "RUGBY_GROUND", "RUSSIAN_RESTAURANT", "SALAD_BAR", "SANDWICH_RESTAURANT", "SAUNA_SOLARIUM_MASSAGE", "SCANDINAVIAN_RESTAURANT", "SCHOOL", "SCHOOL_BUS_COMPANY", "SCHOOL_GENERIC", "SEAFOOD", "SECURED_ENTRANCE", "SECURITY_PRODUCTS", "SENIOR_HIGH_SCHOOL", "SERVICE_COMPANY", "SHANDONG_RESTAURANT", "SHOPPING_SERVICE", "SHOP_OR_STORE", "SICHUAN_RESTAURANT", "SKI_RESORT", "SNACKS_RESTAURANT", "SOCCER_STADIUM", "SOFTWARE_COMPANY", "SOUL_FOOD", "SOUP_RESTAURANT", "SPANISH_RESTAURANT", "SPECIALIST", "SPECIALTY_CLOTHING_SHOP", "SPECIALTY_FOODS", "SPECIAL_HOSPITAL", "SPORTS_CENTER", "SPORTS_CENTER_GENERIC", "SPORTS_EQUIPMENT_AND_CLOTHING", "SQUASH_COURT", "STADIUM", "STATION_ACCESS", "STATUE", "STEAK_HOUSE", "STOCK_EXCHANGE", "STREETCAR_STOP", "SUBWAY_ENTRANCE", "SUBWAY_STATION", "SUPERMARKET", "SUSHI_RESTAURANT", "SWEDISH_RESTAURANT", "SWIMMING_POOL", "SWISS_RESTAURANT", "SYNAGOG", "SYRIAN_RESTAURANT", "TAILOR_SHOP", "TAIWANESE_RESTAURANT", "TAKEOUT_FOOD", "TAPAS_RESTAURANT", "TAXI_LIMOUSINE_AND_SHUTTLE_SERVICE", "TAXI_STAND", "TAX_SERVICES", "TEA_HOUSE", "TELECOMMUNICATIONS", "TEMPLE", "TENNIS_COURT", "TEPPANYAKI_RESTAURANT", "THAI_RESTAURANT", "THEATER", "THEATER_GENERIC", "THEMATIC_SPORT_CENTER", "TIBETAN_RESTAURANT", "TIRE_SERVICE", "TOLL_GATE", "TOURIST_ATTRACTION", "TOURIST_INFORMATION", "TOWER", "TOYS_GAMES_SHOP", "TRAFFIC_CONTROL_DEPARTMENT", "TRAFFIC_CONTROL_DEPARTMENT_GENERIC", "TRAIL_SYSTEM", "TRANSPORT_ACCESS", "TRANSPORT_AUTHORITY_VEHICLE_REGISTRATION", "TRANSPORT_COMPANY", "TRAVEL_AGENT", "TRUCK_DEALER", "TRUCK_REPAIR_AND_SERVICE", "TRUCK_STOP", "TUNISIAN_RESTAURANT", "TUNNEL", "TURKISH_RESTAURANT", "URBAN_STATION", "VALLEY", "VAN_DEALER", "VARIETY_STORE", "VEGETARIAN_RESTAURANT", "VEHICLE_DEALER", "VEHICLE_REPAIR", "VENEZUELAN_RESTAURANT", "VETERINARY", "VIDEO_RENTAL_SHOP", "VIETNAMESE_RESTAURANT", "VIEWPOINT", "VILLA_RENTAL", "VOCATIONAL_SCHOOL", "WATER_HOLE", "WATER_SPORT", "WEDDING_SERVICES", "WEIGH_STATION", "WEIGH_STATION_GENERIC", "WELFARE_ORGANIZATION", "WELL", "WESTERN_RESTAURANT", "WHOLESALE_CLUB", "WILDERNESS_AREA", "WILDLIFE_PARK", "WINERY", "WINE_SPIRITS", "WOMEN_S_CLOTHING", "YACHT_BASIN", "ZOO", "ZOOS_ARBORETA_BOTANICAL_GARDEN"];
1129
1082
  /**
1083
+ * The SDK's code for a category of point of interest, such as `'RESTAURANT'`.
1130
1084
  * @group Place
1131
1085
  */
1132
1086
  export type POICategory = (typeof poiCategories)[number];
@@ -1327,7 +1281,7 @@ type POI = {
1327
1281
  /**
1328
1282
  * The standardized category identifiers of the POI.
1329
1283
  *
1330
- * They are machine-readable names from the {@link POICategory} enum, such as `'ITALIAN_RESTAURANT'`,
1284
+ * They are machine-readable {@link POICategory} codes, such as `'ITALIAN_RESTAURANT'`,
1331
1285
  * `'FUEL_STATION'` or `'HOTEL'`, parsed from the numeric category IDs the API returns.
1332
1286
  * Use them for filtering, programmatic category matching or mapping to icons.
1333
1287
  */
@@ -1380,7 +1334,7 @@ type RelatedPOI = {
1380
1334
  /**
1381
1335
  * The unique identifier of the related POI.
1382
1336
  *
1383
- * Pass it to the Place by ID service to fetch detailed information
1337
+ * Pass it to `getPlaceDetails` as its `entityId` to fetch detailed information
1384
1338
  * about the related location.
1385
1339
  */
1386
1340
  id: string;
@@ -1407,11 +1361,6 @@ export declare const geographyTypes: readonly ["Country", "CountrySubdivision",
1407
1361
  * - `Neighbourhood`: Named neighborhood or area within a city
1408
1362
  * - `PostalCodeArea`: Area defined by postal/ZIP code
1409
1363
  *
1410
- * @example
1411
- * ```typescript
1412
- * const geographyType: GeographyType = 'Municipality'; // City level
1413
- * ```
1414
- *
1415
1364
  * @group Place
1416
1365
  */
1417
1366
  export type GeographyType = (typeof geographyTypes)[number];
@@ -1442,11 +1391,10 @@ export type MapcodeType = 'Local' | 'International' | 'Alternative';
1442
1391
  * code: '4J.P2'
1443
1392
  * };
1444
1393
  *
1445
- * // International mapcode (no territory needed)
1446
- * const intlMapcode: Mapcode = {
1394
+ * // International mapcode (no territory or code)
1395
+ * const internationalMapcode: Mapcode = {
1447
1396
  * type: 'International',
1448
- * fullMapcode: 'VHXGB.4J9W',
1449
- * code: 'VHXGB.4J9W'
1397
+ * fullMapcode: 'VHXGB.4J9W'
1450
1398
  * };
1451
1399
  * ```
1452
1400
  *
@@ -1463,7 +1411,7 @@ export type Mapcode = {
1463
1411
  /**
1464
1412
  * The complete mapcode, including the territory if applicable.
1465
1413
  *
1466
- * Its format, always unambiguous, is "TERRITORY CODE" for local and "CODE" for international mapcodes.
1414
+ * Its format, always unambiguous, is "TERRITORY CODE" for local and alternative mapcodes, and "CODE" for international ones.
1467
1415
  */
1468
1416
  fullMapcode: string;
1469
1417
  /**
@@ -1561,11 +1509,6 @@ export declare const placeTypes: readonly ["POI", "Street", "Geography", "Point
1561
1509
  * - `Address Range`: Range of addresses along a street segment
1562
1510
  * - `Cross Street`: Intersection of two streets
1563
1511
  *
1564
- * @example
1565
- * ```typescript
1566
- * const placeType: PlaceType = 'POI';
1567
- * ```
1568
- *
1569
1512
  * @group Place
1570
1513
  */
1571
1514
  export type PlaceType = (typeof placeTypes)[number];
@@ -1710,14 +1653,11 @@ export type CommonPlaceProps = {
1710
1653
  chargingPark?: ChargingPark;
1711
1654
  /**
1712
1655
  * References to additional data sources, with IDs for fetching more detailed information
1713
- * from other services (geometry, availability, POI details).
1656
+ * from other services (geometry).
1714
1657
  */
1715
1658
  dataSources?: PlaceDataSources;
1716
1659
  /**
1717
1660
  * The physical entry points (entrances) of the place.
1718
- *
1719
- * Navigation can use them to direct users to the correct entrance. Reverse geocoding
1720
- * returns them unclassified, so their `type` is absent.
1721
1661
  */
1722
1662
  entryPoints?: EntryPoint[];
1723
1663
  /**
@@ -1840,7 +1780,7 @@ export type Place<P extends CommonPlaceProps = CommonPlaceProps> = Omit<Feature<
1840
1780
  export type Places<P extends CommonPlaceProps = CommonPlaceProps, FeatureCollectionProps = unknown> = Omit<FeatureCollectionWithProperties<Point, P, FeatureCollectionProps>, 'features' | 'bbox'> & {
1841
1781
  /**
1842
1782
  * The bounding box of all the places, including their own bounding boxes.
1843
- * It is present only if there are places.
1783
+ * It is present only when the places span an area.
1844
1784
  */
1845
1785
  bbox?: BBox;
1846
1786
  /**
@@ -1872,7 +1812,7 @@ export type Places<P extends CommonPlaceProps = CommonPlaceProps, FeatureCollect
1872
1812
  * const fuels: Fuel[] = ['Petrol', 'Diesel', 'LPG'];
1873
1813
  *
1874
1814
  * // Hydrogen fuel cell station
1875
- * const fuels: Fuel[] = ['Hydrogen'];
1815
+ * const hydrogenOnly: Fuel[] = ['Hydrogen'];
1876
1816
  * ```
1877
1817
  *
1878
1818
  * @group Place
@@ -1893,12 +1833,6 @@ export declare const budgetTypes: readonly ["timeMinutes", "distanceKM"];
1893
1833
  * - `timeMinutes`: Travel time in minutes (isochrone), as in "Where can I reach in 30 minutes?"
1894
1834
  * - `distanceKM`: Travel distance in kilometers (isodistance), as in "What's within 10 km?"
1895
1835
  *
1896
- * @example
1897
- * ```typescript
1898
- * const timeType: BudgetType = 'timeMinutes';
1899
- * const distanceType: BudgetType = 'distanceKM';
1900
- * ```
1901
- *
1902
1836
  * @group Reachable Range
1903
1837
  */
1904
1838
  export type BudgetType = (typeof budgetTypes)[number];
@@ -1939,12 +1873,6 @@ export type ReachableRangeBudget = {
1939
1873
  *
1940
1874
  * @remarks
1941
1875
  * Typical values are 5-60 minutes for time and 5-100 km for distance.
1942
- *
1943
- * @example
1944
- * ```typescript
1945
- * value: 30 // 30 minutes or km depending on type
1946
- * value: 15.5 // Decimal values supported
1947
- * ```
1948
1876
  */
1949
1877
  value: number;
1950
1878
  };
@@ -1983,9 +1911,10 @@ export type DelayMagnitude = 'unknown' | 'minor' | 'moderate' | 'major' | 'indef
1983
1911
  *
1984
1912
  * @remarks
1985
1913
  * A strict subset of {@link fullTrafficIncidentCategories}, so every value here is
1986
- * also a valid response category. The two omitted values, `'animals-on-road'` and
1987
- * `'narrow-lanes'`, have no Incident Details category and appear only on traffic
1988
- * vector-tile features.
1914
+ * also a valid response category.
1915
+ *
1916
+ * The two omitted values, `'animals-on-road'` and `'narrow-lanes'`, have no Incident
1917
+ * Details category.
1989
1918
  *
1990
1919
  * @see https://docs.tomtom.com/traffic-api/documentation/tomtom-orbis-maps/v2/traffic-incidents/incident-details
1991
1920
  * @group Traffic
@@ -1995,12 +1924,9 @@ export declare const trafficIncidentRequestCategories: readonly ["accident", "br
1995
1924
  * All possible traffic incident categories.
1996
1925
  *
1997
1926
  * @remarks
1998
- * It combines {@link trafficIncidentRequestCategories}, which you can both send as
1999
- * filters and receive in responses, with the tile-only categories `'animals-on-road'`
2000
- * and `'narrow-lanes'`. Those two appear on vector-tile features but never in an
2001
- * Incident Details response or filter. Use this list for categories you receive, and
2002
- * {@link trafficIncidentRequestCategories} for categories you send to the Incident
2003
- * Details API as a `categoryFilter` input.
1927
+ * It adds to {@link trafficIncidentRequestCategories} the two categories with no Incident Details
1928
+ * category, which that list leaves out. Use this list for categories you receive, and that one for categories you send
1929
+ * to the Incident Details API as a `categoryFilter` input.
2004
1930
  *
2005
1931
  * @group Traffic
2006
1932
  */
@@ -2136,8 +2062,7 @@ export type TrafficIncidentBaseProperties = {
2136
2062
  /**
2137
2063
  * Full properties of a traffic incident from the Incident Details service.
2138
2064
  *
2139
- * Extends {@link TrafficIncidentBaseProperties} with fields available in the
2140
- * Incident Details API response but not in map vector-tile features.
2065
+ * Extends {@link TrafficIncidentBaseProperties} with fields of the Incident Details API response.
2141
2066
  *
2142
2067
  * @group Traffic
2143
2068
  */
@@ -2184,1609 +2109,1560 @@ export type TrafficIncident = Feature<Point | LineString, TrafficIncidentPropert
2184
2109
  *
2185
2110
  * @group Traffic
2186
2111
  */
2187
- export type TrafficIncidentDetails = FeatureCollection<Point | LineString, TrafficIncidentProperties>;
2112
+ export type TrafficIncidentDetails = FeatureCollection<TrafficIncident['geometry'], TrafficIncident['properties']>;
2188
2113
  //#endregion
2189
- //#region src/types/route/guidance.d.ts
2190
- /**
2191
- * Whether traffic drives on the left or right at the point of the maneuver.
2192
- * @group Route
2193
- */
2194
- type DrivingSide = 'LEFT' | 'RIGHT';
2195
- /**
2196
- * A property of a road.
2197
- * - `URBAN`: An urban road.
2198
- * - `MOTORWAY`: A motorway.
2199
- * - `CONTROLLED_ACCESS`: A controlled access road, with regulated traffic flow and regulated entries and exits.
2200
- * @group Route
2201
- */
2202
- type RoadInformationProperty = 'URBAN' | 'MOTORWAY' | 'CONTROLLED_ACCESS';
2203
- /**
2204
- * A landmark that instructions can refer to.
2205
- * @group Route
2206
- */
2207
- type Landmark = 'END_OF_ROAD' | 'AT_TRAFFIC_LIGHT' | 'ON_TO_BRIDGE' | 'ON_BRIDGE' | 'AFTER_BRIDGE' | 'INTO_TUNNEL' | 'INSIDE_TUNNEL' | 'AFTER_TUNNEL';
2208
- /**
2209
- * The maneuver, for example arrive or turn right.
2210
- * @see https://docs.tomtom.com/routing-api/documentation/routing/calculate-route#maneuver-codes
2211
- * @group Route
2212
- */
2213
- type Maneuver = 'DEPART' | 'WAYPOINT_LEFT' | 'WAYPOINT_RIGHT' | 'WAYPOINT_REACHED' | 'WAYPOINT_AHEAD' | 'ARRIVE' | 'ARRIVE_LEFT' | 'ARRIVE_RIGHT' | 'ARRIVE_AHEAD' | 'STRAIGHT' | 'KEEP_LEFT' | 'KEEP_RIGHT' | 'SLIGHT_RIGHT' | 'TURN_RIGHT' | 'SHARP_RIGHT' | 'SLIGHT_LEFT' | 'TURN_LEFT' | 'SHARP_LEFT' | 'MAKE_UTURN' | 'ROUNDABOUT_STRAIGHT' | 'ROUNDABOUT_SHARP_RIGHT' | 'ROUNDABOUT_RIGHT' | 'ROUNDABOUT_SLIGHT_RIGHT' | 'ROUNDABOUT_SLIGHT_LEFT' | 'ROUNDABOUT_LEFT' | 'ROUNDABOUT_SHARP_LEFT' | 'ROUNDABOUT_BACK' | 'EXIT_ROUNDABOUT' | 'EXIT_MOTORWAY_LEFT' | 'EXIT_MOTORWAY_RIGHT' | 'SWITCH_MOTORWAY_LEFT' | 'SWITCH_MOTORWAY_RIGHT' | 'ENTER_CARPOOL_LANE_LEFT' | 'ENTER_CARPOOL_LANE_RIGHT' | 'EXIT_CARPOOL_LANE_LEFT' | 'EXIT_CARPOOL_LANE_RIGHT' | 'MERGE_LEFT_LANE' | 'MERGE_RIGHT_LANE' | 'TAKE_SHIP_FERRY' | 'TAKE_CAR_TRAIN' | 'LEAVE_SHIP_FERRY' | 'LEAVE_CAR_TRAIN' | 'CROSS_BORDER' | 'TOLLGATE';
2214
- /**
2215
- * The side from which the road connects to the route.
2216
- * @group Route
2217
- */
2218
- type SideRoadSide = 'LEFT' | 'RIGHT' | 'LEFT_AND_RIGHT';
2219
- /**
2220
- * A direction relative to the vehicle's approach, used by {@link ManeuverView} to describe the
2221
- * junction geometry at a maneuver.
2222
- *
2223
- * These are relative directions, not angles in degrees. The API reports the road layout as a
2224
- * small vocabulary of bearings.
2225
- * @group Route
2226
- */
2227
- type ManeuverAngle = 'STRAIGHT' | 'SLIGHT_RIGHT' | 'RIGHT' | 'SHARP_RIGHT' | 'SLIGHT_LEFT' | 'LEFT' | 'SHARP_LEFT' | 'BACK';
2228
- /**
2229
- * The kind of roundabout a roundabout maneuver takes place on.
2230
- * @group Route
2231
- */
2232
- type RoundaboutType = 'REGULAR' | 'SMALL';
2233
- /**
2234
- * A toll payment option.
2235
- * @group Route
2236
- */
2237
- type TollPaymentType = 'CASH_COINS_AND_BILLS' | 'CASH_BILLS_ONLY' | 'CASH_COINS_ONLY' | 'CASH_EXACT_CHANGE' | 'CREDIT_CARD' | 'DEBIT_CARD' | 'TRAVEL_CARD' | 'ETC' | 'ETC_TRANSPONDER' | 'ETC_VIDEO_CAMERA' | 'SUBSCRIPTION';
2114
+ //#region src/types/route/summary.d.ts
2238
2115
  /**
2239
- * A point on the route path, with its metadata.
2116
+ * The summary of a route or route leg, with departure and arrival times, lengths and durations.
2240
2117
  * @group Route
2241
2118
  */
2242
- type RoutePathPoint = {
2119
+ type SummaryBase = {
2243
2120
  /**
2244
- * The position of this point on the route.
2121
+ * The estimated arrival time at the end of the route or leg.
2122
+ *
2123
+ * It is the departure time plus the travel time, accounting for traffic conditions.
2245
2124
  */
2246
- point: Position;
2125
+ arrivalTime: Date;
2247
2126
  /**
2248
- * The distance in meters from the start of the route to this point.
2127
+ * The departure time from the beginning of the route or leg, based on the one the routing
2128
+ * request specified.
2129
+ */
2130
+ departureTime: Date;
2131
+ /**
2132
+ * Total length of the route or leg in meters.
2249
2133
  */
2250
- distanceInMeters: number;
2134
+ lengthInMeters: number;
2251
2135
  /**
2252
- * The time in seconds from the start of the route to this point.
2136
+ * The estimated travel time of the route or leg in seconds.
2137
+ *
2138
+ * @remarks
2139
+ * It includes delays due to real-time traffic. For the free-flow travel time without traffic
2140
+ * delays, use `noTrafficTravelTimeInSeconds`.
2253
2141
  */
2254
2142
  travelTimeInSeconds: number;
2255
- };
2256
- /**
2257
- * The name of a street, road number, exit, intersection, tollgate or country in a guidance
2258
- * instruction.
2259
- * @group Route
2260
- */
2261
- type InstructionText = {
2262
2143
  /**
2263
- * The name as a text string.
2144
+ * The delay in seconds of the traffic events along `trafficLengthInMeters`.
2145
+ *
2146
+ * @remarks
2147
+ * It is present only when the routing service sends it, and it is not the gap to free-flow
2148
+ * conditions.
2149
+ *
2150
+ * For the gap to free-flow, request the travel times with `computeTravelTimeFor: 'all'` and use
2151
+ * `Math.max(0, liveTrafficIncidentsTravelTimeInSeconds - noTrafficTravelTimeInSeconds)`. The live
2152
+ * travel time can fall below the free-flow one, so keep the floor at 0.
2264
2153
  */
2265
- text: string;
2266
- };
2267
- /**
2268
- * A single road shield reference.
2269
- * @group Route
2270
- */
2271
- type RoadShieldReference = {
2154
+ trafficDelayInSeconds?: number;
2272
2155
  /**
2273
- * A unique identifier for the road shield.
2156
+ * The length in meters of the route that traffic events delay, which is the portion with
2157
+ * congestion or incidents.
2158
+ *
2159
+ * @remarks
2160
+ * It is present only when the routing service sends it.
2274
2161
  */
2275
- reference: string;
2162
+ trafficLengthInMeters?: number;
2276
2163
  /**
2277
- * The text to show on the road shield.
2164
+ * The estimated travel time in seconds in free-flow conditions, as if there were no traffic
2165
+ * delays (no congestion).
2166
+ *
2167
+ * It is present only if you request it with the `computeTravelTimeFor` parameter.
2278
2168
  */
2279
- shieldContent?: string;
2169
+ noTrafficTravelTimeInSeconds?: number;
2280
2170
  /**
2281
- * The possible affixes to show in addition to the `shieldContent`.
2171
+ * The estimated travel time in seconds from time-dependent historic traffic data.
2172
+ *
2173
+ * It is the expected travel time from typical traffic patterns at the requested departure
2174
+ * time, such as rush hour or off-peak. It is present only if you request it with the
2175
+ * `computeTravelTimeFor` parameter.
2282
2176
  */
2283
- affixes?: string[];
2284
- };
2285
- /**
2286
- * A road shield, with extra information.
2287
- * @group Route
2288
- */
2289
- type RoadShield = {
2177
+ historicTrafficTravelTimeInSeconds?: number;
2290
2178
  /**
2291
- * The road number. Most road numbers have a 'letter' prefix, which is also returned.
2179
+ * The estimated travel time in seconds from real-time traffic speed data, based on current
2180
+ * live traffic conditions and incidents.
2181
+ *
2182
+ * It is present only if you request it with the `computeTravelTimeFor` parameter.
2292
2183
  */
2293
- roadNumber: InstructionText;
2184
+ liveTrafficIncidentsTravelTimeInSeconds?: number;
2294
2185
  /**
2295
- * What the client needs to build an image of the road shield with the TomTom RoadShield API.
2296
- * It is present if a road shield image is available for this road.
2186
+ * The distance in meters from the origin point to the first point where this route forks off from the reference route.
2187
+ *
2188
+ * @remarks
2189
+ * If the route is identical to the reference route, it is the length of the route. Every
2190
+ * alternative route summary has it, but the reference route's doesn't.
2297
2191
  */
2298
- roadShieldReference?: RoadShieldReference;
2192
+ deviationDistanceInMeters?: number;
2299
2193
  /**
2300
- * The state code of the state the shield is in (second part of an ISO 3166-2 identifier).
2301
- * It is present if state codes are available for the shield's country.
2194
+ * The travel time in seconds from the origin point to the first point where this route forks off from the reference route.
2195
+ *
2196
+ * @remarks
2197
+ * If the route is identical to the reference route, it is the estimated travel time of the
2198
+ * route. Every alternative route summary has it, but the reference route's doesn't.
2302
2199
  */
2303
- stateCode?: string;
2200
+ deviationTimeInSeconds?: number;
2304
2201
  /**
2305
- * The country code (ISO 3166-1 alpha-3) of the country the shield is in.
2202
+ * The coordinates of the first point where this route forks off from the reference route.
2203
+ *
2204
+ * @remarks
2205
+ * If the route is identical to the reference route, it is the last point on the route.
2206
+ * Every alternative route summary has it, but the reference route's doesn't.
2306
2207
  */
2307
- countryCode: string;
2208
+ deviationPoint?: Position;
2308
2209
  };
2309
2210
  /**
2310
- * Road information, including properties, street name and road shields.
2211
+ * The summary of an entire route, with all journey statistics from origin to destination,
2212
+ * including the stops along the way.
2213
+ *
2311
2214
  * @group Route
2312
2215
  */
2313
- type RoadInformation = {
2314
- /**
2315
- * The properties of the road, possibly several combined.
2316
- */
2317
- properties: RoadInformationProperty[];
2318
- /**
2319
- * The street name of the road, if available.
2320
- */
2321
- streetName?: InstructionText;
2322
- /**
2323
- * The road shields of this road.
2324
- * The list can be empty if none are available.
2325
- */
2326
- roadShields?: RoadShield[];
2327
- /**
2328
- * The code (ISO 3166-1 alpha-3) of the country this road is in.
2329
- */
2330
- countryCode?: string;
2331
- };
2216
+ type RouteSummary = SummaryBase;
2332
2217
  /**
2333
- * Signpost information.
2218
+ * The summary of a single route leg, the portion of the route between two consecutive waypoints.
2219
+ *
2220
+ * @remarks
2221
+ * - An A→B route has 1 leg
2222
+ * - An A→B→C route has 2 legs (A→B, B→C)
2223
+ *
2334
2224
  * @group Route
2335
2225
  */
2336
- type Signpost = {
2337
- /**
2338
- * The exit name of the controlled access road, if this signpost has one.
2339
- */
2340
- exitName?: InstructionText;
2341
- /**
2342
- * The exit number of the controlled access road, if this signpost has one.
2343
- * The string can encode multiple exit numbers, such as "E10/E12".
2344
- */
2345
- exitNumber?: InstructionText;
2226
+ type LegSummary = SummaryBase & {
2346
2227
  /**
2347
- * The toward name from the signpost.
2228
+ * The time in seconds the vehicle stands still at the stop this leg arrives at.
2229
+ *
2230
+ * @remarks
2231
+ * It is the wait a {@link WaypointProps.pauseDurationSeconds} asked for, as the service actually
2232
+ * planned it rather than an echo of the request. That is the gap between this leg's `arrivalTime`
2233
+ * and the next leg's `departureTime`.
2234
+ *
2235
+ * - It is absent when the vehicle does not stop at the end of this leg.
2236
+ * - It is absent on the last leg, which has no following departure. The routing service does not
2237
+ * accept a wait at the destination anyway.
2238
+ * - This leg's own `travelTimeInSeconds` is driving only and *excludes* the stop, while the
2239
+ * route's total *includes* every stop. So driving time is the sum of the legs, and the time
2240
+ * spent standing still is the difference.
2241
+ *
2242
+ * @example
2243
+ * ```typescript
2244
+ * // A waypoint with pauseDurationSeconds: 1800
2245
+ * stopTimeInSeconds: 1800
2246
+ * ```
2348
2247
  */
2349
- towardName: InstructionText;
2248
+ stopTimeInSeconds?: number;
2350
2249
  };
2250
+ //#endregion
2251
+ //#region src/types/route/route.d.ts
2351
2252
  /**
2352
- * Side road information.
2253
+ * All the road and route features that route calculation can avoid.
2254
+ *
2255
+ * Use it to derive the {@link Avoidable} type or to validate user input against the supported
2256
+ * avoidance options.
2257
+ *
2258
+ * @remarks
2259
+ * This readonly tuple is the source of truth for valid avoidance types. The {@link Avoidable}
2260
+ * type derives from it, for type safety.
2261
+ *
2262
+ * @example
2263
+ * ```typescript
2264
+ * // Check if a string is a valid avoidance type
2265
+ * const userInput: string = 'tollRoads';
2266
+ * const knownAvoidables: readonly string[] = avoidableTypes;
2267
+ * if (knownAvoidables.includes(userInput)) {
2268
+ * // userInput is valid
2269
+ * }
2270
+ * ```
2271
+ *
2353
2272
  * @group Route
2354
2273
  */
2355
- type SideRoad = {
2356
- /**
2357
- * The side from which the road connects to the route.
2358
- */
2359
- side: SideRoadSide;
2274
+ export declare const avoidableTypes: readonly ["tollRoads", "motorways", "ferries", "unpavedRoads", "carpools", "alreadyUsedRoads", "borderCrossings", "tunnels", "carTrains", "lowEmissionZones"];
2275
+ /**
2276
+ * A route feature that the routing engine tries to avoid when calculating routes.
2277
+ *
2278
+ * Use it to customize routes for vehicle capabilities, user preferences or regulatory
2279
+ * requirements. Note that avoidance is not guaranteed if no alternative route exists.
2280
+ *
2281
+ * @remarks
2282
+ * The avoidance options:
2283
+ * - `tollRoads`: Avoids roads requiring toll payments
2284
+ * - `motorways`: Avoids high-speed limited-access highways
2285
+ * - `ferries`: Avoids water crossings requiring ferry transport
2286
+ * - `unpavedRoads`: Avoids unpaved/dirt roads (recommended for standard vehicles)
2287
+ * - `carpools`: Avoids carpool/HOV (High Occupancy Vehicle) lanes
2288
+ * - `alreadyUsedRoads`: Prevents using the same road segment multiple times
2289
+ * - `borderCrossings`: Avoids crossing international borders
2290
+ * - `tunnels`: Avoids underground tunnels
2291
+ * - `carTrains`: Avoids car train transport segments
2292
+ * - `lowEmissionZones`: Avoids zones with vehicle emission restrictions
2293
+ *
2294
+ * @example
2295
+ * ```typescript
2296
+ * // Avoid tolls and motorways for a scenic route
2297
+ * const scenicAvoid: Avoidable[] = ['tollRoads', 'motorways'];
2298
+ *
2299
+ * // Avoid unpaved roads for a standard car
2300
+ * const carAvoid: Avoidable[] = ['unpavedRoads'];
2301
+ * ```
2302
+ *
2303
+ * @group Route
2304
+ */
2305
+ export type Avoidable = (typeof avoidableTypes)[number];
2306
+ /**
2307
+ * The primary mode of transportation for route calculation.
2308
+ *
2309
+ * It determines the road type preferences, speed calculations and routing rules of the
2310
+ * calculated route. Currently, only `'car'` is supported.
2311
+ *
2312
+ * @remarks
2313
+ * Future versions may support additional modes such as truck, taxi, bus, bicycle and pedestrian.
2314
+ *
2315
+ * @group Route
2316
+ */
2317
+ export type TravelMode = 'car';
2318
+ /**
2319
+ * The cumulative distance and time at a position along the route.
2320
+ *
2321
+ * Both fields are optional because a progress entry may omit either value. Interpolation
2322
+ * utilities return the resolved, always-present equivalent, {@link RouteProgressAtPoint}.
2323
+ *
2324
+ * @group Route
2325
+ */
2326
+ export type RouteProgress = {
2360
2327
  /**
2361
- * The offset on the route, in meters, of the side road from the maneuver point (`maneuverPoint`).
2362
- * The offset is absolute, so it is a positive integer even though the side road is before the maneuver on the route.
2328
+ * Cumulative travel time in seconds from the route start.
2363
2329
  */
2364
- offsetFromManeuverInMeters: number;
2330
+ travelTimeInSeconds?: number;
2365
2331
  /**
2366
- * Whether the side road can actually be driven into.
2367
- *
2368
- * A non-drivable side road still matters for a junction diagram, because the driver can see it,
2369
- * but the driver cannot take it by mistake.
2332
+ * Cumulative distance in meters from the route start.
2370
2333
  */
2371
- isDrivable?: boolean;
2334
+ distanceInMeters?: number;
2372
2335
  };
2373
2336
  /**
2374
- * The layout of the junction at a maneuver, with the way the route goes and the other ways that
2375
- * lead off it.
2337
+ * The progress at a specific coordinate on the route path.
2376
2338
  *
2377
- * Use it to draw a junction diagram of the route's own direction plus the roads it passes up.
2339
+ * It adds to {@link RouteProgress} a `pointIndex` that identifies the coordinate's entry in
2340
+ * the route's coordinate array.
2341
+ *
2342
+ * @remarks
2343
+ * The `progress` array of a route always has entries for the first and last points. You can
2344
+ * linearly interpolate the progress of intermediate points between entries.
2378
2345
  *
2379
2346
  * @example
2380
2347
  * ```typescript
2381
- * // A right turn at a T-junction where the other arm continues straight
2382
- * const view: ManeuverView = { onRouteAngle: 'RIGHT', offRouteAngles: ['STRAIGHT'] };
2348
+ * const points: RouteProgressPoint[] = [
2349
+ * { pointIndex: 0, travelTimeInSeconds: 0, distanceInMeters: 0 },
2350
+ * { pointIndex: 50, travelTimeInSeconds: 120, distanceInMeters: 2500 },
2351
+ * { pointIndex: 100, travelTimeInSeconds: 300, distanceInMeters: 5000 }
2352
+ * ];
2383
2353
  * ```
2384
2354
  *
2385
2355
  * @group Route
2386
2356
  */
2387
- type ManeuverView = {
2388
- /**
2389
- * The direction the route takes through the junction.
2390
- */
2391
- onRouteAngle?: ManeuverAngle;
2357
+ export type RouteProgressPoint = RouteProgress & {
2392
2358
  /**
2393
- * The directions of the other roads at the junction, which the route does not take.
2394
- *
2395
- * Empty when the junction has no other arms.
2359
+ * Zero-based index of this point in the route's coordinate array.
2396
2360
  */
2397
- offRouteAngles: ManeuverAngle[];
2361
+ pointIndex: number;
2398
2362
  };
2399
2363
  /**
2400
- * The attributes of a maneuver, such as "Turn right", "Keep left", "Take the ferry", "Take the motorway" or "Arrive".
2364
+ * A distance and a time along the route, both known.
2365
+ *
2401
2366
  * @group Route
2402
2367
  */
2403
- type Instruction = {
2404
- /**
2405
- * The index of the point on the route path where the maneuver takes place.
2406
- * `maneuverPoint` is expected to equal the path point at this index.
2407
- */
2408
- pathPointIndex: number;
2409
- /**
2410
- * The location of the maneuver.
2411
- */
2412
- maneuverPoint: Position;
2368
+ export type RouteProgressAtPoint = Required<RouteProgress>;
2369
+ /**
2370
+ * The progress over a segment between two arbitrary points on the route path.
2371
+ *
2372
+ * @group Route
2373
+ */
2374
+ export type RouteSegmentProgress = {
2375
+ /** Progress at the start point. */
2376
+ start: RouteProgressAtPoint;
2377
+ /** Progress at the end point. */
2378
+ end: RouteProgressAtPoint;
2379
+ /** The distance and time the segment covers, as end minus start. */
2380
+ delta: RouteProgressAtPoint;
2381
+ };
2382
+ /**
2383
+ * Geographic coordinate and cumulative progress values at a specific point along a route.
2384
+ *
2385
+ * @group Utils
2386
+ */
2387
+ export type RouteCoordinateAtProgress = RouteProgressAtPoint & {
2388
+ /** Geographic position as a GeoJSON `[longitude, latitude]` coordinate. */
2389
+ position: Position;
2390
+ };
2391
+ /**
2392
+ * A discriminated union that identifies a position along a route.
2393
+ * Provide exactly one of the three variants.
2394
+ *
2395
+ * @group Utils
2396
+ */
2397
+ export type RouteProgressQuery = {
2398
+ traveledTimeInSeconds: number;
2399
+ } | {
2400
+ traveledDistanceInMeters: number;
2401
+ } | {
2402
+ clockTime: Date;
2403
+ };
2404
+ /**
2405
+ * All the information of a calculated route, including its summary statistics, sections,
2406
+ * guidance instructions and progress data.
2407
+ *
2408
+ * @group Route
2409
+ */
2410
+ export type RouteProps = {
2413
2411
  /**
2414
- * The distance from the start of the route to the point of the instruction.
2412
+ * The summary statistics of the entire route, with departure and arrival times, total length
2413
+ * and duration.
2415
2414
  */
2416
- routeOffsetInMeters: number;
2415
+ summary: RouteSummary;
2417
2416
  /**
2418
- * A code identifying the maneuver, such as "Turn right".
2417
+ * The route sections, which are portions of the route with distinct properties such as:
2418
+ * - Countries traversed
2419
+ * - Traffic incidents
2420
+ * - Route legs (segments between waypoints)
2421
+ * - Special road types (tunnels, ferries, toll roads)
2419
2422
  */
2420
- maneuver: Maneuver;
2423
+ sections: SectionsProps;
2421
2424
  /**
2422
- * The ready-made, human-readable instruction text, e.g. "Turn right onto Damrak".
2425
+ * The turn-by-turn navigation instructions, with maneuvers, road names and instruction text.
2423
2426
  *
2424
- * The routing service generates and localises it in the request's language, so you need no
2425
- * translation table of your own. It is absent when the routing service sends none.
2427
+ * They are present only when guidance was requested and is available.
2426
2428
  */
2427
- message?: string;
2429
+ guidance?: Guidance;
2428
2430
  /**
2429
- * The sequence of all the points the maneuver occupies on the map, as a maneuver can occupy more than one.
2430
- * A maneuver that occupies a single point has a single item, with a point value equal to `maneuverPoint`.
2431
+ * The distance and time progress at key points along the route.
2432
+ *
2433
+ * It is present when extended route representations are requested, which is the default for route
2434
+ * calculations. Use it to display progress information or calculate intermediate times.
2431
2435
  */
2432
- routePath: RoutePathPoint[];
2436
+ progress?: RouteProgressPoint[];
2433
2437
  /**
2434
- * Information about the road in the link before the maneuver.
2438
+ * The index of this route among the alternatives.
2439
+ *
2440
+ * The first route (index 0) is typically the recommended or best route, and the rest are alternatives.
2435
2441
  */
2436
- previousRoadInfo: RoadInformation;
2437
- /**
2438
- * Information about the road the route heads to, past the maneuver.
2439
- * It comes from the road past the maneuver, or from the signpost at the maneuver if there is one.
2440
- */
2441
- nextRoadInfo: RoadInformation;
2442
- /**
2443
- * The information on the signpost that shows the direction on the route, if this maneuver has
2444
- * a signpost.
2445
- */
2446
- signpost?: Signpost;
2447
- /**
2448
- * The name of the intersection at which the maneuver must be performed, if available.
2449
- */
2450
- intersectionName?: InstructionText;
2451
- /**
2452
- * Whether traffic drives on the left or right at the point of the maneuver.
2453
- */
2454
- drivingSide?: DrivingSide;
2455
- /**
2456
- * The landmark of the instruction, if it has one.
2457
- */
2458
- landmark?: Landmark;
2459
- /**
2460
- * The distance on the route, in meters, between two consecutive traffic lights when the maneuver takes place at the second.
2461
- * It is present only if the landmark is AT_TRAFFIC_LIGHT.
2462
- */
2463
- trafficLightOffsetInMeters?: number;
2464
- /**
2465
- * The roads right before the maneuver that connect to the route but are not part of it, in ascending order of offset on route.
2466
- * The driver can take them by accident when following the instruction, without considering the route's dynamic restrictions such as time or vehicle profile dependent ones.
2467
- * A dual-carriageway road might be one or several side roads, depending on how the driver might perceive it.
2468
- * Use them for a richer graphical presentation of the maneuver, showing the connected roads just before it.
2469
- * The list is empty if no road crosses the route before the maneuver. It is present if there are side roads within a reasonable distance before the maneuver.
2470
- */
2471
- sideRoads?: SideRoad[];
2472
- /**
2473
- * The base URL of the Road Shields service, for fetching the road shield atlas and metadata resources.
2474
- * The resources currently available are sprite.png and sprite.json.
2475
- * We recommend caching the sprite atlas (sprite.png) and metadata (sprite.json), since they change infrequently and are large compared to a typical road shield description.
2476
- */
2477
- roadShieldAtlasReference?: string;
2478
- /**
2479
- * The road shield references to show for the instruction.
2480
- */
2481
- roadShieldReferences?: RoadShieldReference[];
2482
- /**
2483
- * The road shield references to show for the signpost.
2484
- */
2485
- signpostRoadShieldReferences?: RoadShieldReference[];
2486
- /**
2487
- * Whether this maneuver is obligatory, for example at a T-junction where one option is drivable and the other is not.
2488
- * It is present if the maneuver is a turn maneuver, meaning it is one of:
2489
- * - SLIGHT_RIGHT
2490
- * - TURN_RIGHT
2491
- * - SHARP_RIGHT
2492
- * - SLIGHT_LEFT
2493
- * - TURN_LEFT
2494
- * - SHARP_LEFT
2495
- * - MAKE_UTURN
2496
- */
2497
- isManeuverObligatory?: boolean;
2498
- /**
2499
- * The total change of angle in degrees from the entry to the exit of the maneuver, in the range [-180,180). For example, -90 means "forks off to the left in a perpendicular angle".
2500
- * At complex junctions, the angle is relative to the entry road.
2501
- * It is present if the maneuver is a turn or roundabout maneuver, meaning it is one of:
2502
- * - STRAIGHT
2503
- * - SLIGHT_RIGHT
2504
- * - TURN_RIGHT
2505
- * - SHARP_RIGHT
2506
- * - SLIGHT_LEFT
2507
- * - TURN_LEFT
2508
- * - SHARP_LEFT
2509
- * - MAKE_UTURN
2510
- * - ROUNDABOUT_STRAIGHT
2511
- * - ROUNDABOUT_SLIGHT_RIGHT
2512
- * - ROUNDABOUT_RIGHT
2513
- * - ROUNDABOUT_SHARP_RIGHT
2514
- * - ROUNDABOUT_SLIGHT_LEFT
2515
- * - ROUNDABOUT_LEFT
2516
- * - ROUNDABOUT_SHARP_LEFT
2517
- * - ROUNDABOUT_BACK
2518
- */
2519
- changeOfAngleInDegrees?: number;
2520
- /**
2521
- * The offset on the route, in meters, of an ambiguous exit from the maneuver point (`maneuverPoint`).
2522
- * It is present if this maneuver is an exit and another exit within a reasonable distance before it may cause ambiguity.
2523
- * The client might then need to resolve the ambiguity and compose an instruction such as "Take the 2nd exit".
2524
- * The offset is absolute, so it is a positive integer even though the ambiguous exit is before the maneuver on the route.
2525
- * It applies to maneuvers that are one of:
2526
- * - EXIT_ROUNDABOUT
2527
- * - EXIT_MOTORWAY_LEFT
2528
- * - EXIT_MOTORWAY_RIGHT
2529
- * - SWITCH_MOTORWAY_LEFT
2530
- * - SWITCH_MOTORWAY_RIGHT
2531
- */
2532
- offsetOfAmbiguousExitFromManeuverInMeters?: number;
2533
- /**
2534
- * The ordinal number of the exit to take at a roundabout, as in "take the first/second exit".
2535
- * It is present if the maneuver is a roundabout maneuver, meaning it is one of:
2536
- * - ROUNDABOUT_STRAIGHT
2537
- * - ROUNDABOUT_SLIGHT_RIGHT
2538
- * - ROUNDABOUT_RIGHT
2539
- * - ROUNDABOUT_SHARP_RIGHT
2540
- * - ROUNDABOUT_SLIGHT_LEFT
2541
- * - ROUNDABOUT_LEFT
2542
- * - ROUNDABOUT_SHARP_LEFT
2543
- * - ROUNDABOUT_BACK
2544
- */
2545
- roundaboutExitNumber?: number;
2546
- /**
2547
- * The kind of roundabout this maneuver takes place on.
2548
- * Roundabout maneuvers have it.
2549
- */
2550
- roundaboutType?: RoundaboutType;
2551
- /**
2552
- * The layout of the junction at this maneuver, with the route's own direction and the directions
2553
- * of the roads it does not take.
2554
- */
2555
- maneuverView?: ManeuverView;
2556
- /**
2557
- * The name of the tollgate, if available.
2558
- * It is present if the maneuver is TOLLGATE.
2559
- */
2560
- tollgateName?: InstructionText;
2561
- /**
2562
- * The one or more toll payment options available at this tollgate.
2563
- * It is present if the maneuver is TOLLGATE.
2564
- */
2565
- tollPaymentTypes?: TollPaymentType[];
2442
+ index: number;
2443
+ };
2444
+ /**
2445
+ * A calculated route, as a GeoJSON Feature.
2446
+ *
2447
+ * Its geometry is a LineString of the route path coordinates, and its properties hold all
2448
+ * route information (summary, sections, guidance).
2449
+ *
2450
+ * @typeParam P - Type of the route properties (defaults to RouteProps)
2451
+ *
2452
+ * @example
2453
+ * ```typescript
2454
+ * const route: Route = {
2455
+ * type: 'Feature',
2456
+ * id: 'route-123',
2457
+ * geometry: {
2458
+ * type: 'LineString',
2459
+ * coordinates: [[4.9, 52.3], [4.91, 52.31], ...]
2460
+ * },
2461
+ * properties: {
2462
+ * summary: { lengthInMeters: 5000, travelTimeInSeconds: 300, ... },
2463
+ * sections: { ... },
2464
+ * index: 0
2465
+ * },
2466
+ * bbox: [4.9, 52.3, 4.91, 52.31]
2467
+ * };
2468
+ * ```
2469
+ *
2470
+ * @group Route
2471
+ */
2472
+ export type Route<P extends RouteProps = RouteProps> = Omit<Feature<LineString, P>, 'id' | 'bbox'> & {
2566
2473
  /**
2567
- * The name of the country the border crossing occurs from.
2568
- * It is present if the maneuver is or leads to a border crossing, meaning it is one of:
2569
- * - CROSS_BORDER
2570
- * - TAKE_SHIP_FERRY
2571
- * - TAKE_CAR_TRAIN
2572
- * - LEAVE_SHIP_FERRY
2573
- * - LEAVE_CAR_TRAIN
2474
+ * The unique identifier of this route, randomly generated to tell route alternatives apart.
2574
2475
  */
2575
- countryCrossingFromName?: InstructionText;
2476
+ id: string;
2576
2477
  /**
2577
- * The code (ISO 3166-1 alpha-3) of the country the border crossing occurs from.
2578
- * It is present if the maneuver is a border crossing, meaning it is one of:
2579
- * - CROSS_BORDER
2580
- * - TAKE_SHIP_FERRY
2581
- * - TAKE_CAR_TRAIN
2582
- * - LEAVE_SHIP_FERRY
2583
- * - LEAVE_CAR_TRAIN
2478
+ * The bounding box of the entire route, or at least of its waypoints.
2584
2479
  */
2585
- countryCrossingFromCode?: string;
2480
+ bbox: BBox;
2481
+ };
2482
+ /**
2483
+ * A GeoJSON FeatureCollection of one or more calculated routes.
2484
+ *
2485
+ * It typically holds the main route (index 0) and optional alternative routes. `calculateRoute`
2486
+ * sets no collection properties.
2487
+ *
2488
+ * @typeParam P - Type of individual route properties (defaults to RouteProps)
2489
+ * @typeParam FeatureCollectionProps - Type of collection-level properties
2490
+ *
2491
+ * @example
2492
+ * ```typescript
2493
+ * const routes: Routes = {
2494
+ * type: 'FeatureCollection',
2495
+ * features: [
2496
+ * { type: 'Feature', geometry: {...}, properties: { index: 0, ... } }, // Main route
2497
+ * { type: 'Feature', geometry: {...}, properties: { index: 1, ... } } // Alternative
2498
+ * ]
2499
+ * };
2500
+ * ```
2501
+ *
2502
+ * @group Route
2503
+ */
2504
+ export type Routes<P extends RouteProps = RouteProps, FeatureCollectionProps = unknown> = Omit<FeatureCollectionWithProperties<LineString, P, FeatureCollectionProps>, 'features' | 'bbox'> & {
2586
2505
  /**
2587
- * The name of the country the border crossing occurs to.
2588
- * It is present if the maneuver is or leads to a border crossing, meaning it is one of:
2589
- * - CROSS_BORDER
2590
- * - TAKE_SHIP_FERRY
2591
- * - TAKE_CAR_TRAIN
2592
- * - LEAVE_SHIP_FERRY
2593
- * - LEAVE_CAR_TRAIN
2506
+ * The route features.
2594
2507
  */
2595
- countryCrossingToName?: InstructionText;
2508
+ features: Route<P>[];
2596
2509
  /**
2597
- * The code (ISO 3166-1 alpha-3) of the country the border crossing occurs to.
2598
- * It is present if the maneuver is a border crossing, meaning it is one of:
2599
- * - CROSS_BORDER
2600
- * - TAKE_SHIP_FERRY
2601
- * - TAKE_CAR_TRAIN
2602
- * - LEAVE_SHIP_FERRY
2603
- * - LEAVE_CAR_TRAIN
2510
+ * The bounding box of all the routes, or at least of their waypoints. It is defined only if there are routes.
2604
2511
  */
2605
- countryCrossingToCode?: string;
2512
+ bbox?: BBox;
2606
2513
  };
2514
+ //#endregion
2515
+ //#region src/types/route/guidance.d.ts
2607
2516
  /**
2608
- * The guidance elements of a route, present only when guidance was requested and is available.
2517
+ * Whether traffic drives on the left or right at the point of the maneuver.
2609
2518
  * @group Route
2610
2519
  */
2611
- type Guidance = {
2520
+ type DrivingSide = 'LEFT' | 'RIGHT';
2521
+ /**
2522
+ * A property of a road.
2523
+ * - `URBAN`: An urban road.
2524
+ * - `MOTORWAY`: A motorway.
2525
+ * - `CONTROLLED_ACCESS`: A controlled access road, with regulated traffic flow and regulated entries and exits.
2526
+ * @group Route
2527
+ */
2528
+ type RoadInformationProperty = 'URBAN' | 'MOTORWAY' | 'CONTROLLED_ACCESS';
2529
+ /**
2530
+ * A landmark that instructions can refer to.
2531
+ * @group Route
2532
+ */
2533
+ type Landmark = 'END_OF_ROAD' | 'AT_TRAFFIC_LIGHT' | 'ON_TO_BRIDGE' | 'ON_BRIDGE' | 'AFTER_BRIDGE' | 'INTO_TUNNEL' | 'INSIDE_TUNNEL' | 'AFTER_TUNNEL';
2534
+ /**
2535
+ * The maneuver, for example arrive or turn right.
2536
+ * @see https://docs.tomtom.com/routing-api/documentation/routing/calculate-route#maneuver-codes
2537
+ * @group Route
2538
+ */
2539
+ type Maneuver = 'DEPART' | 'WAYPOINT_LEFT' | 'WAYPOINT_RIGHT' | 'WAYPOINT_REACHED' | 'WAYPOINT_AHEAD' | 'ARRIVE' | 'ARRIVE_LEFT' | 'ARRIVE_RIGHT' | 'ARRIVE_AHEAD' | 'STRAIGHT' | 'KEEP_LEFT' | 'KEEP_RIGHT' | 'SLIGHT_RIGHT' | 'TURN_RIGHT' | 'SHARP_RIGHT' | 'SLIGHT_LEFT' | 'TURN_LEFT' | 'SHARP_LEFT' | 'MAKE_UTURN' | 'ROUNDABOUT_STRAIGHT' | 'ROUNDABOUT_SHARP_RIGHT' | 'ROUNDABOUT_RIGHT' | 'ROUNDABOUT_SLIGHT_RIGHT' | 'ROUNDABOUT_SLIGHT_LEFT' | 'ROUNDABOUT_LEFT' | 'ROUNDABOUT_SHARP_LEFT' | 'ROUNDABOUT_BACK' | 'EXIT_ROUNDABOUT' | 'EXIT_MOTORWAY_LEFT' | 'EXIT_MOTORWAY_RIGHT' | 'SWITCH_MOTORWAY_LEFT' | 'SWITCH_MOTORWAY_RIGHT' | 'ENTER_CARPOOL_LANE_LEFT' | 'ENTER_CARPOOL_LANE_RIGHT' | 'EXIT_CARPOOL_LANE_LEFT' | 'EXIT_CARPOOL_LANE_RIGHT' | 'MERGE_LEFT_LANE' | 'MERGE_RIGHT_LANE' | 'TAKE_SHIP_FERRY' | 'TAKE_CAR_TRAIN' | 'LEAVE_SHIP_FERRY' | 'LEAVE_CAR_TRAIN' | 'CROSS_BORDER' | 'TOLLGATE';
2540
+ /**
2541
+ * The side from which the road connects to the route.
2542
+ * @group Route
2543
+ */
2544
+ type SideRoadSide = 'LEFT' | 'RIGHT' | 'LEFT_AND_RIGHT';
2545
+ /**
2546
+ * A direction relative to the vehicle's approach, used by {@link ManeuverView} to describe the
2547
+ * junction geometry at a maneuver.
2548
+ *
2549
+ * These are relative directions, not angles in degrees. The API reports the road layout as a
2550
+ * small vocabulary of bearings.
2551
+ * @group Route
2552
+ */
2553
+ type ManeuverAngle = 'STRAIGHT' | 'SLIGHT_RIGHT' | 'RIGHT' | 'SHARP_RIGHT' | 'SLIGHT_LEFT' | 'LEFT' | 'SHARP_LEFT' | 'BACK';
2554
+ /**
2555
+ * The kind of roundabout a roundabout maneuver takes place on.
2556
+ * @group Route
2557
+ */
2558
+ type RoundaboutType = 'REGULAR' | 'SMALL';
2559
+ /**
2560
+ * A toll payment option.
2561
+ * @group Route
2562
+ */
2563
+ type TollPaymentType = 'CASH_COINS_AND_BILLS' | 'CASH_BILLS_ONLY' | 'CASH_COINS_ONLY' | 'CASH_EXACT_CHANGE' | 'CREDIT_CARD' | 'DEBIT_CARD' | 'TRAVEL_CARD' | 'ETC' | 'ETC_TRANSPONDER' | 'ETC_VIDEO_CAMERA' | 'SUBSCRIPTION';
2564
+ /**
2565
+ * A point on the route path, with its metadata.
2566
+ * @group Route
2567
+ */
2568
+ type RoutePathPoint = RouteProgressAtPoint & {
2612
2569
  /**
2613
- * Main ordered list of instructions to follow.
2570
+ * The position of this point on the route.
2614
2571
  */
2615
- instructions: Instruction[];
2572
+ point: Position;
2616
2573
  };
2617
- //#endregion
2618
- //#region src/types/route/summary.d.ts
2619
2574
  /**
2620
- * The summary of a route or route leg, with departure and arrival times, lengths and durations.
2575
+ * The name of a street, road number, exit, intersection, tollgate or country in a guidance
2576
+ * instruction.
2621
2577
  * @group Route
2622
2578
  */
2623
- type SummaryBase = {
2624
- /**
2625
- * The estimated arrival time at the end of the route or leg.
2626
- *
2627
- * It is the departure time plus the travel time, accounting for traffic conditions.
2628
- */
2629
- arrivalTime: Date;
2630
- /**
2631
- * The departure time from the beginning of the route or leg, based on the one the routing
2632
- * request specified.
2633
- */
2634
- departureTime: Date;
2635
- /**
2636
- * Total length of the route or leg in meters.
2637
- */
2638
- lengthInMeters: number;
2639
- /**
2640
- * The estimated travel time of the route or leg in seconds.
2641
- *
2642
- * @remarks
2643
- * It includes delays due to real-time traffic. For the free-flow travel time without traffic
2644
- * delays, use `noTrafficTravelTimeInSeconds`.
2645
- */
2646
- travelTimeInSeconds: number;
2579
+ type InstructionText = {
2647
2580
  /**
2648
- * The delay in seconds of the traffic events along `trafficLengthInMeters`.
2649
- *
2650
- * @remarks
2651
- * It is present only when the routing service sends it, and it is not the gap to free-flow
2652
- * conditions. For the gap to free-flow, request the travel times with `computeTravelTimeFor: 'all'`
2653
- * and use `Math.max(0, liveTrafficIncidentsTravelTimeInSeconds - noTrafficTravelTimeInSeconds)`.
2654
- * The live travel time can fall below the free-flow one, so keep the floor at 0.
2581
+ * The name as a text string.
2655
2582
  */
2656
- trafficDelayInSeconds?: number;
2583
+ text: string;
2584
+ };
2585
+ /**
2586
+ * A single road shield reference.
2587
+ * @group Route
2588
+ */
2589
+ type RoadShieldReference = {
2657
2590
  /**
2658
- * The length in meters of the route that traffic events delay, which is the portion with
2659
- * congestion or incidents.
2660
- *
2661
- * @remarks
2662
- * It is present only when the routing service sends it.
2591
+ * A unique identifier for the road shield.
2663
2592
  */
2664
- trafficLengthInMeters?: number;
2593
+ reference: string;
2665
2594
  /**
2666
- * The estimated travel time in seconds in free-flow conditions, as if there were no traffic
2667
- * delays (no congestion).
2668
- *
2669
- * It is present only if you request it with the `computeTravelTimeFor` parameter.
2595
+ * The text to show on the road shield.
2670
2596
  */
2671
- noTrafficTravelTimeInSeconds?: number;
2597
+ shieldContent?: string;
2672
2598
  /**
2673
- * The estimated travel time in seconds from time-dependent historic traffic data.
2674
- *
2675
- * It is the expected travel time from typical traffic patterns at the requested departure
2676
- * time, such as rush hour or off-peak. It is present only if you request it with the
2677
- * `computeTravelTimeFor` parameter.
2599
+ * The possible affixes to show in addition to the `shieldContent`.
2678
2600
  */
2679
- historicTrafficTravelTimeInSeconds?: number;
2601
+ affixes?: string[];
2602
+ };
2603
+ /**
2604
+ * A road shield, with extra information.
2605
+ * @group Route
2606
+ */
2607
+ type RoadShield = {
2680
2608
  /**
2681
- * The estimated travel time in seconds from real-time traffic speed data, based on current
2682
- * live traffic conditions and incidents.
2683
- *
2684
- * It is present only if you request it with the `computeTravelTimeFor` parameter.
2609
+ * The road number. Most road numbers have a 'letter' prefix, which is also returned.
2685
2610
  */
2686
- liveTrafficIncidentsTravelTimeInSeconds?: number;
2611
+ roadNumber: InstructionText;
2687
2612
  /**
2688
- * The distance in meters from the origin point to the first point where this route forks off from the reference route.
2689
- *
2690
- * @remarks
2691
- * If the route is identical to the reference route, it is the length of the route. Every
2692
- * alternative route summary has it, but the reference route's doesn't.
2613
+ * What the client needs to build an image of the road shield with the TomTom RoadShield API.
2614
+ * It is present if a road shield image is available for this road.
2693
2615
  */
2694
- deviationDistanceInMeters?: number;
2616
+ roadShieldReference?: RoadShieldReference;
2695
2617
  /**
2696
- * The travel time in seconds from the origin point to the first point where this route forks off from the reference route.
2697
- *
2698
- * @remarks
2699
- * If the route is identical to the reference route, it is the estimated travel time of the
2700
- * route. Every alternative route summary has it, but the reference route's doesn't.
2618
+ * The state code of the state the shield is in (second part of an ISO 3166-2 identifier).
2619
+ * It is present if state codes are available for the shield's country.
2701
2620
  */
2702
- deviationTimeInSeconds?: number;
2621
+ stateCode?: string;
2703
2622
  /**
2704
- * The coordinates of the first point where this route forks off from the reference route.
2705
- *
2706
- * @remarks
2707
- * If the route is identical to the reference route, it is the last point on the route.
2708
- * Every alternative route summary has it, but the reference route's doesn't.
2623
+ * The country code (ISO 3166-1 alpha-3) of the country the shield is in.
2709
2624
  */
2710
- deviationPoint?: Position;
2625
+ countryCode: string;
2711
2626
  };
2712
2627
  /**
2713
- * The summary of an entire route, with all journey statistics from origin to destination,
2714
- * including the stops along the way.
2715
- *
2716
- * @group Route
2717
- */
2718
- type RouteSummary = SummaryBase;
2719
- /**
2720
- * The summary of a single route leg, the portion of the route between two consecutive waypoints.
2721
- *
2722
- * @remarks
2723
- * - An A→B route has 1 leg
2724
- * - An A→B→C route has 2 legs (A→B, B→C)
2725
- *
2628
+ * Road information, including properties, street name and road shields.
2726
2629
  * @group Route
2727
- */
2728
- type LegSummary = SummaryBase & {
2729
- /**
2730
- * The time in seconds the vehicle stands still at the stop this leg arrives at.
2731
- *
2732
- * @remarks
2733
- * It is the wait a {@link WaypointProps.pauseDurationSeconds} asked for, as the service actually
2734
- * planned it rather than an echo of the request. That is the gap between this leg's `arrivalTime`
2735
- * and the next leg's `departureTime`.
2736
- *
2737
- * - It is absent when the vehicle does not stop at the end of this leg.
2738
- * - It is absent on the last leg, which has no following departure. The routing service does not
2739
- * accept a wait at the destination anyway.
2740
- * - This leg's own `travelTimeInSeconds` is driving only and *excludes* the stop, while the
2741
- * route's total *includes* every stop. So driving time is the sum of the legs, and the time
2742
- * spent standing still is the difference.
2743
- *
2744
- * @example
2745
- * ```typescript
2746
- * // A waypoint with pauseDurationSeconds: 1800
2747
- * stopTimeInSeconds: 1800
2748
- * ```
2630
+ */
2631
+ type RoadInformation = {
2632
+ /**
2633
+ * The properties of the road, possibly several combined.
2749
2634
  */
2750
- stopTimeInSeconds?: number;
2635
+ properties: RoadInformationProperty[];
2636
+ /**
2637
+ * The street name of the road, if available.
2638
+ */
2639
+ streetName?: InstructionText;
2640
+ /**
2641
+ * The road shields of this road, absent when it has none.
2642
+ */
2643
+ roadShields?: RoadShield[];
2644
+ /**
2645
+ * The code (ISO 3166-1 alpha-3) of the country this road is in.
2646
+ */
2647
+ countryCode?: string;
2751
2648
  };
2752
- //#endregion
2753
- //#region src/types/route/sections.d.ts
2754
2649
  /**
2755
- * The base properties of all route sections.
2756
- *
2757
- * Sections divide a route into portions with specific characteristics or attributes.
2758
- * Every section type adds its own specialized properties to this base.
2759
- *
2650
+ * Signpost information.
2760
2651
  * @group Route
2761
2652
  */
2762
- export type SectionProps = {
2653
+ type Signpost = {
2763
2654
  /**
2764
- * The unique identifier of this section, randomly generated to tell sections apart.
2655
+ * The exit name of the controlled access road, if this signpost has one.
2765
2656
  */
2766
- id: string;
2657
+ exitName?: InstructionText;
2767
2658
  /**
2768
- * The zero-based index of the route coordinate where this section begins, in the route's
2769
- * LineString coordinates array.
2659
+ * The exit number of the controlled access road, if this signpost has one.
2660
+ * The string can encode multiple exit numbers, such as "E10/E12".
2770
2661
  */
2771
- startPointIndex: number;
2662
+ exitNumber?: InstructionText;
2772
2663
  /**
2773
- * The zero-based index of the route coordinate where this section ends (inclusive), in the
2774
- * route's LineString coordinates array.
2664
+ * The toward name from the signpost.
2775
2665
  */
2776
- endPointIndex: number;
2666
+ towardName: InstructionText;
2777
2667
  };
2778
2668
  /**
2779
- * A stretch of a route by point index, as a section spans it.
2780
- *
2669
+ * Side road information.
2781
2670
  * @group Route
2782
2671
  */
2783
- export type RouteSpan = Pick<SectionProps, 'startPointIndex' | 'endPointIndex'>;
2672
+ type SideRoad = {
2673
+ /**
2674
+ * The side from which the road connects to the route.
2675
+ */
2676
+ side: SideRoadSide;
2677
+ /**
2678
+ * The offset on the route, in meters, of the side road from the maneuver point (`maneuverPoint`).
2679
+ * The offset is absolute, so it is a positive integer even though the side road is before the maneuver on the route.
2680
+ */
2681
+ offsetFromManeuverInMeters: number;
2682
+ /**
2683
+ * Whether the side road can actually be driven into.
2684
+ *
2685
+ * A non-drivable side road still matters for a junction diagram, because the driver can see it,
2686
+ * but the driver cannot take it by mistake.
2687
+ */
2688
+ isDrivable?: boolean;
2689
+ };
2784
2690
  /**
2785
- * A route section through a country.
2691
+ * The layout of the junction at a maneuver, with the way the route goes and the other ways that
2692
+ * lead off it.
2786
2693
  *
2787
- * Use it to identify which countries the route traverses, for:
2788
- * - Border crossing planning
2789
- * - International routing costs
2790
- * - Regulatory requirements
2694
+ * Use it to draw a junction diagram of the route's own direction plus the roads it passes up.
2791
2695
  *
2792
2696
  * @example
2793
2697
  * ```typescript
2794
- * const countrySection: CountrySectionProps = {
2795
- * id: 'country-section-1',
2796
- * startPointIndex: 0,
2797
- * endPointIndex: 150,
2798
- * countryCodeISO2: 'NL', // Netherlands
2799
- * countryCodeISO3: 'NLD',
2800
- * };
2698
+ * // A right turn at a T-junction where the other arm continues straight
2699
+ * const view: ManeuverView = { onRouteAngle: 'RIGHT', offRouteAngles: ['STRAIGHT'] };
2801
2700
  * ```
2802
2701
  *
2803
2702
  * @group Route
2804
2703
  */
2805
- export type CountrySectionProps = SectionProps & {
2704
+ type ManeuverView = {
2806
2705
  /**
2807
- * The two-letter ISO 3166-1 alpha-2 country code, such as 'US', 'GB', 'NL', 'DE' or 'FR'.
2808
- *
2809
- * @see [ISO 3166-1 alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
2706
+ * The direction the route takes through the junction.
2810
2707
  */
2811
- countryCodeISO2: string;
2708
+ onRouteAngle?: ManeuverAngle;
2812
2709
  /**
2813
- * The three-letter ISO 3166-1 alpha-3 country code, such as 'USA', 'GBR', 'NLD', 'DEU' or 'FRA'.
2710
+ * The directions of the other roads at the junction, which the route does not take.
2814
2711
  *
2815
- * @see [ISO 3166-1 alpha-3 codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)
2712
+ * Empty when the junction has no other arms.
2816
2713
  */
2817
- countryCodeISO3: string;
2714
+ offRouteAngles: ManeuverAngle[];
2818
2715
  };
2819
2716
  /**
2820
- * A section on an important road stretch.
2821
- *
2822
- * Its street names, road numbers or both let the driver identify the course of the route and distinguish it from other potential routes.
2823
- *
2717
+ * The attributes of a maneuver, such as "Turn right", "Keep left", "Take the ferry", "Take the motorway" or "Arrive".
2824
2718
  * @group Route
2825
2719
  */
2826
- export type ImportantRoadStretchProps = SectionProps & {
2720
+ type Instruction = {
2827
2721
  /**
2828
- * The importance as an integer, starting from 0, where a lower value means higher importance. Use it to:
2829
- * * Tell which stretch is the most important, for example to display fewer stretches.
2830
- * * Group the sections that belong to the same stretch, since one stretch may have gaps for various reasons.
2722
+ * The index of the point on the route path where the maneuver takes place.
2723
+ * `maneuverPoint` is expected to equal the path point at this index.
2831
2724
  */
2832
- index: number;
2725
+ pathPointIndex: number;
2833
2726
  /**
2834
- * The street name of the important road stretch.
2727
+ * The location of the maneuver.
2835
2728
  */
2836
- streetName?: string;
2729
+ maneuverPoint: Position;
2837
2730
  /**
2838
- * A set of road numbers that identify the important road stretch.
2731
+ * The distance from the start of the route to the point of the instruction.
2732
+ */
2733
+ routeOffsetInMeters: number;
2734
+ /**
2735
+ * A code identifying the maneuver, such as "Turn right".
2736
+ */
2737
+ maneuver: Maneuver;
2738
+ /**
2739
+ * The ready-made, human-readable instruction text, e.g. "Turn right onto Damrak".
2839
2740
  *
2840
- * @remarks
2841
- * The road numbers are sorted in descending order of display priority.
2741
+ * The routing service generates and localises it in the request's language, so you need no
2742
+ * translation table of your own. It is absent when the routing service sends none.
2842
2743
  */
2843
- roadNumbers?: string[];
2844
- };
2845
- /**
2846
- * A traffic incident cause, based on the TPEG2-TEC standard.
2847
- *
2848
- * TPEG (Transport Protocol Experts Group) codes give a standardized
2849
- * classification of traffic incident causes.
2850
- *
2851
- * @see [TPEG2-TEC Standard](https://www.iso.org/standard/59231.html)
2852
- *
2853
- * @group Route
2854
- */
2855
- export type CauseTEC = {
2744
+ message?: string;
2856
2745
  /**
2857
- * The TPEG2-TEC main cause code, the primary classification of what caused the incident.
2746
+ * The sequence of all the points the maneuver occupies on the map, as a maneuver can occupy more than one.
2747
+ * A maneuver that occupies a single point has a single item, with a point value equal to `maneuverPoint`.
2858
2748
  */
2859
- mainCauseCode: number;
2749
+ routePath: RoutePathPoint[];
2860
2750
  /**
2861
- * The TPEG2-TEC sub-cause code, a more specific classification under the main cause.
2751
+ * Information about the road in the link before the maneuver.
2862
2752
  */
2863
- subCauseCode?: number;
2864
- };
2865
- /**
2866
- * The TPEG2-TEC standardized classification of a traffic incident's effects on traffic flow and its causes.
2867
- *
2868
- * @group Route
2869
- */
2870
- export type TrafficIncidentTEC = {
2753
+ previousRoadInfo: RoadInformation;
2871
2754
  /**
2872
- * The TPEG2-TEC effect code, which says how the incident affects traffic flow.
2755
+ * Information about the road the route heads to, past the maneuver.
2756
+ * It comes from the road past the maneuver, or from the signpost at the maneuver if there is one.
2873
2757
  */
2874
- effectCode?: number;
2758
+ nextRoadInfo: RoadInformation;
2875
2759
  /**
2876
- * The causes of this traffic incident, at least one.
2760
+ * The information on the signpost that shows the direction on the route, if this maneuver has
2761
+ * a signpost.
2762
+ */
2763
+ signpost?: Signpost;
2764
+ /**
2765
+ * The name of the intersection at which the maneuver must be performed, if available.
2766
+ */
2767
+ intersectionName?: InstructionText;
2768
+ /**
2769
+ * Whether traffic drives on the left or right at the point of the maneuver.
2770
+ */
2771
+ drivingSide?: DrivingSide;
2772
+ /**
2773
+ * The landmark of the instruction, if it has one.
2774
+ */
2775
+ landmark?: Landmark;
2776
+ /**
2777
+ * The distance on the route, in meters, between two consecutive traffic lights when the maneuver takes place at the second.
2778
+ * It is present only if the landmark is AT_TRAFFIC_LIGHT.
2779
+ */
2780
+ trafficLightOffsetInMeters?: number;
2781
+ /**
2782
+ * The roads right before the maneuver that connect to the route but are not part of it, in ascending order of offset on route.
2877
2783
  *
2878
- * Multiple causes may contribute to a single traffic incident.
2784
+ * - The driver can take them by accident when following the instruction, whatever the route's time or vehicle restrictions.
2785
+ * - A dual-carriageway road might be one or several side roads, depending on how the driver might perceive it.
2786
+ * - Use them for a richer graphical presentation of the maneuver, showing the connected roads just before it.
2787
+ * - The list is empty if no road crosses the route before the maneuver.
2879
2788
  */
2880
- causes?: [CauseTEC, ...CauseTEC[]];
2881
- };
2882
- /**
2883
- * A route section affected by a traffic incident.
2884
- *
2885
- * It is a portion of the route with traffic delays due to congestion, accidents,
2886
- * construction or other incidents.
2887
- *
2888
- * @example
2889
- * ```typescript
2890
- * const trafficSection: TrafficSectionProps = {
2891
- * id: 'traffic-1',
2892
- * startPointIndex: 50,
2893
- * endPointIndex: 75,
2894
- * categories: ['jam'],
2895
- * magnitudeOfDelay: 'moderate',
2896
- * delayInSeconds: 420, // 7 minutes
2897
- * effectiveSpeedInKmh: 25,
2898
- * tec: { effectCode: 1, causes: [{ mainCauseCode: 101 }] }
2899
- * };
2900
- * ```
2901
- *
2902
- * @group Route
2903
- */
2904
- export type TrafficSectionProps = SectionProps & {
2789
+ sideRoads?: SideRoad[];
2905
2790
  /**
2906
- * The categories of the incident, based on its `tec` cause codes, or on its icon category when it has none.
2791
+ * The base URL of the Road Shields service, for fetching the road shield atlas and metadata resources.
2792
+ * The resources currently available are sprite.png and sprite.json.
2793
+ * We recommend caching the sprite atlas (sprite.png) and metadata (sprite.json), since they change infrequently and are large compared to a typical road shield description.
2794
+ */
2795
+ roadShieldAtlasReference?: string;
2796
+ /**
2797
+ * The road shield references to show for the instruction.
2798
+ */
2799
+ roadShieldReferences?: RoadShieldReference[];
2800
+ /**
2801
+ * The road shield references to show for the signpost.
2802
+ */
2803
+ signpostRoadShieldReferences?: RoadShieldReference[];
2804
+ /**
2805
+ * Whether this maneuver is obligatory, for example at a T-junction where one option is drivable and the other is not.
2806
+ * It is present if the maneuver is a turn maneuver, meaning it is one of:
2807
+ * - SLIGHT_RIGHT
2808
+ * - TURN_RIGHT
2809
+ * - SHARP_RIGHT
2810
+ * - SLIGHT_LEFT
2811
+ * - TURN_LEFT
2812
+ * - SHARP_LEFT
2813
+ * - MAKE_UTURN
2814
+ */
2815
+ isManeuverObligatory?: boolean;
2816
+ /**
2817
+ * The total change of angle in degrees from the entry to the exit of the maneuver, in the range [-180,180). For example, -90 means "forks off to the left in a perpendicular angle".
2818
+ * At complex junctions, the angle is relative to the entry road.
2819
+ * It is present if the maneuver is a turn or roundabout maneuver, meaning it is one of:
2820
+ * - STRAIGHT
2821
+ * - SLIGHT_RIGHT
2822
+ * - TURN_RIGHT
2823
+ * - SHARP_RIGHT
2824
+ * - SLIGHT_LEFT
2825
+ * - TURN_LEFT
2826
+ * - SHARP_LEFT
2827
+ * - MAKE_UTURN
2828
+ * - ROUNDABOUT_STRAIGHT
2829
+ * - ROUNDABOUT_SLIGHT_RIGHT
2830
+ * - ROUNDABOUT_RIGHT
2831
+ * - ROUNDABOUT_SHARP_RIGHT
2832
+ * - ROUNDABOUT_SLIGHT_LEFT
2833
+ * - ROUNDABOUT_LEFT
2834
+ * - ROUNDABOUT_SHARP_LEFT
2835
+ * - ROUNDABOUT_BACK
2907
2836
  */
2908
- categories: TrafficIncidentCategory[];
2837
+ changeOfAngleInDegrees?: number;
2909
2838
  /**
2910
- * The severity of the delay this incident causes.
2839
+ * The offset on the route, in meters, of an ambiguous exit from the maneuver point (`maneuverPoint`).
2840
+ * It is present if this maneuver is an exit and another exit within a reasonable distance before it may cause ambiguity.
2841
+ * The client might then need to resolve the ambiguity and compose an instruction such as "Take the 2nd exit".
2842
+ *
2843
+ * The offset is absolute, so it is a positive integer even though the ambiguous exit is before the maneuver on the route.
2844
+ * It applies to maneuvers that are one of:
2845
+ * - EXIT_ROUNDABOUT
2846
+ * - EXIT_MOTORWAY_LEFT
2847
+ * - EXIT_MOTORWAY_RIGHT
2848
+ * - SWITCH_MOTORWAY_LEFT
2849
+ * - SWITCH_MOTORWAY_RIGHT
2911
2850
  */
2912
- magnitudeOfDelay: DelayMagnitude;
2851
+ offsetOfAmbiguousExitFromManeuverInMeters?: number;
2913
2852
  /**
2914
- * The internationally standardized TPEG2-TEC codes that classify the incident, when the service has them.
2853
+ * The ordinal number of the exit to take at a roundabout, as in "take the first/second exit".
2854
+ * It is present if the maneuver is one of the `ROUNDABOUT_*` ones {@link Instruction.changeOfAngleInDegrees} lists.
2915
2855
  */
2916
- tec?: TrafficIncidentTEC;
2856
+ roundaboutExitNumber?: number;
2917
2857
  /**
2918
- * The actual average speed through this incident in km/h, when speed information is available.
2919
- *
2920
- * A lower speed means worse congestion.
2858
+ * The kind of roundabout this maneuver takes place on.
2859
+ * Roundabout maneuvers have it.
2921
2860
  */
2922
- effectiveSpeedInKmh?: number;
2861
+ roundaboutType?: RoundaboutType;
2923
2862
  /**
2924
- * The extra time in seconds this incident causes compared to free-flow conditions.
2925
- *
2926
- * It is present when the delay can be calculated.
2863
+ * The layout of the junction at this maneuver, with the route's own direction and the directions
2864
+ * of the roads it does not take.
2927
2865
  */
2928
- delayInSeconds?: number;
2866
+ maneuverView?: ManeuverView;
2929
2867
  /**
2930
- * The routing service's identifier of the traffic incident behind this section.
2931
- *
2932
- * @remarks
2933
- * It is the tail of the incident's `id` in `trafficIncidentDetails`, not that id, so passing it as
2934
- * `ids` finds nothing. To get the whole record, query `trafficIncidentDetails` with the section's
2935
- * {@link getSectionBBox} and keep the incident whose `id.endsWith(eventId)`.
2868
+ * The name of the tollgate, if available.
2869
+ * It is present if the maneuver is TOLLGATE.
2936
2870
  */
2937
- eventId?: string;
2938
- };
2939
- /**
2940
- * A stretch of a route that no other route it is compared with drives, from the vertex where it
2941
- * leaves them to the one where it rejoins them.
2942
- *
2943
- * @remarks
2944
- * A segment of the route, from one coordinate to the next, counts as shared when another route
2945
- * drives the same segment in either direction. A route crossing this one at a junction doesn't
2946
- * split it.
2947
- *
2948
- * @group Route
2949
- */
2950
- export type DistinctSectionProps = SectionProps & {
2951
- /** The length of the section, along the route. */
2952
- lengthInMeters: number;
2953
- };
2954
- /**
2955
- * A curve of a route: a stretch where the road keeps turning the same way.
2956
- *
2957
- * @remarks
2958
- * The SDK finds curves in the route's geometry, with {@link getCurveSections}. A small radius with a
2959
- * large heading change makes a hard curve: a hairpin turns some 180° on a radius of 10 to 20 metres.
2960
- *
2961
- * @example
2962
- * ```typescript
2963
- * const hairpin: CurveSectionProps = {
2964
- * id: 'curve-1',
2965
- * startPointIndex: 120,
2966
- * endPointIndex: 131,
2967
- * headingChangeInDegrees: -172, // a left hairpin
2968
- * radiusInMeters: 14,
2969
- * lengthInMeters: 70,
2970
- * curvinessScore: 84, // each of the 42 metres of its arc counts twice
2971
- * severity: 0.94,
2972
- * };
2973
- * ```
2974
- *
2975
- * @group Route
2976
- */
2977
- export type CurveSectionProps = SectionProps & {
2871
+ tollgateName?: InstructionText;
2978
2872
  /**
2979
- * How far the heading turns along the curve: positive to the right, negative to the left. It can
2980
- * pass 180° on a hairpin or a roundabout.
2873
+ * The one or more toll payment options available at this tollgate.
2874
+ * It is present if the maneuver is TOLLGATE.
2981
2875
  */
2982
- headingChangeInDegrees: number;
2876
+ tollPaymentTypes?: TollPaymentType[];
2983
2877
  /**
2984
- * The radius of the circle the curve follows where it turns tightest, over the shortest part of
2985
- * it that turns four fifths of its heading change: a curve can ease in on a wide bend first.
2878
+ * The name of the country the border crossing occurs from.
2879
+ * It is present if the maneuver is or leads to a border crossing, meaning it is one of:
2880
+ * - CROSS_BORDER
2881
+ * - TAKE_SHIP_FERRY
2882
+ * - TAKE_CAR_TRAIN
2883
+ * - LEAVE_SHIP_FERRY
2884
+ * - LEAVE_CAR_TRAIN
2986
2885
  */
2987
- radiusInMeters: number;
2988
- /** The length of the curve, along the route, from where it starts turning to where it straightens. */
2989
- lengthInMeters: number;
2886
+ countryCrossingFromName?: InstructionText;
2990
2887
  /**
2991
- * How much the curve has to offer a rider, as roadcurvature.com scores roads: the length of its
2992
- * arc, `radiusInMeters` times the heading change in radians, with each metre counted:
2993
- * - 2 times below a radius of 30 m, 1.6 times below 60 m, 1.3 times below 100 m and 1 time below 175 m.
2994
- * - Not at all on a curve wider than 175 m, which scores 0.
2888
+ * The code (ISO 3166-1 alpha-3) of the country the border crossing occurs from.
2889
+ * It is present on the maneuvers {@link Instruction.countryCrossingFromName} lists.
2995
2890
  */
2996
- curvinessScore: number;
2891
+ countryCrossingFromCode?: string;
2997
2892
  /**
2998
- * How hard the curve is to drive, from 0 to 1: how much a driver slows down for it, from the
2999
- * speed limit on the road leading into it.
3000
- *
3001
- * @remarks
3002
- * - It grows as the radius shrinks. A shallow curve counts as wider than its radius, since a
3003
- * driver can straighten it out across the lane, but a hairpin can't be straightened.
3004
- * - A turn at a junction, with a turn, U-turn or roundabout `maneuver`, scores as one the driver
3005
- * slows right down for, however wide its corner is drawn.
3006
- * - It reads the route's `speedLimit` sections, so ask for them along with the curves. Where the
3007
- * route has no limit for the road, it takes a typical limit outside towns.
3008
- * - A curve a driver takes at the limit scores 0. The tighter the curve is for the road, the
3009
- * nearer 1 it scores.
2893
+ * The name of the country the border crossing occurs to.
2894
+ * It is present on the maneuvers {@link Instruction.countryCrossingFromName} lists.
3010
2895
  */
3011
- severity: number;
2896
+ countryCrossingToName?: InstructionText;
3012
2897
  /**
3013
- * The maneuver of the guidance instruction on the curve, such as `TURN_LEFT` or
3014
- * `ROUNDABOUT_RIGHT`. It tells a turn at a junction from a bend of the road, so it is absent:
3015
- * - On a curve no instruction falls on, or whose only instructions mark no junction: a departure,
3016
- * an arrival, a waypoint, a border or a tollgate.
3017
- * - Where the instruction keeps to the road, as "Turn left to stay on the SS38" where a side road
3018
- * leaves a hairpin, or has no other way to take, as "Follow the road to the left". A roundabout
3019
- * and a U-turn always name theirs.
3020
- * - On every curve of a route calculated without `guidance`.
2898
+ * The code (ISO 3166-1 alpha-3) of the country the border crossing occurs to.
2899
+ * It is present on the maneuvers {@link Instruction.countryCrossingFromName} lists.
3021
2900
  */
3022
- maneuver?: Maneuver;
2901
+ countryCrossingToCode?: string;
3023
2902
  };
3024
2903
  /**
3025
- * A curvy stretch of a route: curves that follow one another closely, such as a mountain pass.
3026
- *
3027
- * @remarks
3028
- * The SDK groups the route's curves into stretches, with {@link getCurvyStretchSections}. To list
3029
- * the curves of a stretch, pass it as `within` to {@link getSectionsWithin}.
3030
- *
3031
- * A curve at a maneuver ends a stretch, since a run of turns at junctions makes no winding road.
3032
- * That takes a route with guidance: without it, turns at junctions between short roads can make one.
3033
- *
2904
+ * The guidance elements of a route, present only when guidance was requested and is available.
3034
2905
  * @group Route
3035
2906
  */
3036
- export type CurvyStretchSectionProps = SectionProps & {
3037
- /** How many curves the stretch holds. Over `lengthInMeters`, it says how winding the stretch is. */
3038
- curveCount: number;
3039
- /** How many of its curves are hairpins, as {@link isHairpin} tells them. */
3040
- hairpinCount: number;
3041
- /** The length of the stretch, along the route. */
3042
- lengthInMeters: number;
3043
- /** The radius of the stretch's tightest curve. */
3044
- minRadiusInMeters: number;
2907
+ type Guidance = {
3045
2908
  /**
3046
- * The `curvinessScore` of its curves, added up: the higher, the more a rider gets out of it.
3047
- * Roadcurvature.com, which scores roads the same way, calls those over 1000 very twisty.
2909
+ * Main ordered list of instructions to follow.
3048
2910
  */
3049
- curvinessScore: number;
2911
+ instructions: Instruction[];
3050
2912
  };
2913
+ //#endregion
2914
+ //#region src/types/route/sections.d.ts
3051
2915
  /**
3052
- * A route section for a leg, the portion of route between two consecutive waypoints.
3053
- *
3054
- * It is a top-level section that covers the entire journey segment.
3055
- *
3056
- * @remarks
3057
- * For example:
3058
- * - A→B route: 1 leg (A to B)
3059
- * - A→B→C route: 2 legs (A to B, then B to C)
3060
- * - A path location (route reconstruction): one leg per leg the path was planned with
2916
+ * The base properties of all route sections.
3061
2917
  *
3062
- * @example
3063
- * ```typescript
3064
- * const leg: LegSectionProps = {
3065
- * id: 'leg-1',
3066
- * summary: {
3067
- * departureTime: new Date(),
3068
- * arrivalTime: new Date(),
3069
- * lengthInMeters: 50000,
3070
- * travelTimeInSeconds: 3600,
3071
- * // ... other summary fields
3072
- * },
3073
- * startPointIndex: 0,
3074
- * endPointIndex: 250
3075
- * };
3076
- * ```
2918
+ * Sections divide a route into portions with specific characteristics or attributes.
2919
+ * Every section type adds its own specialized properties to this base.
3077
2920
  *
3078
2921
  * @group Route
3079
2922
  */
3080
- export type LegSectionProps = Omit<SectionProps, 'startPointIndex' | 'endPointIndex'> & {
3081
- /**
3082
- * The index in the route coordinates where this leg starts, present only if the route
3083
- * polyline geometry is available.
3084
- */
3085
- startPointIndex?: number;
2923
+ export type SectionProps = {
3086
2924
  /**
3087
- * The index in the route coordinates where this leg ends, present only if the route
3088
- * polyline geometry is available.
2925
+ * The unique identifier of this section, randomly generated to tell sections apart.
3089
2926
  */
3090
- endPointIndex?: number;
2927
+ id: string;
3091
2928
  /**
3092
- * The index of the waypoint this leg ends at, in the `locations` the route was requested with.
3093
- *
3094
- * @remarks
3095
- * A leg does not always end at the location with the same index. A path location expands into
3096
- * legs of its own, so `legs[i]` is not reliably the leg arriving at `locations[i + 1]`. This
3097
- * index maps a leg back to the stop the caller passed.
3098
- *
3099
- * It is absent on the final leg, and on legs that end somewhere the caller did not ask for.
3100
- *
3101
- * @example
3102
- * ```typescript
3103
- * // Which of the stops I passed does this leg arrive at?
3104
- * const index = leg.originalWaypointIndex;
3105
- * const stop = index === undefined ? undefined : locations[index];
3106
- * ```
2929
+ * The zero-based index of the route coordinate where this section begins, in the route's
2930
+ * LineString coordinates array.
3107
2931
  */
3108
- originalWaypointIndex?: number;
2932
+ startPointIndex: number;
3109
2933
  /**
3110
- * The summary statistics of this leg of the journey, with its departure and arrival times,
3111
- * distances and durations.
2934
+ * The zero-based index of the route coordinate where this section ends (inclusive), in the
2935
+ * route's LineString coordinates array.
3112
2936
  */
3113
- summary: LegSummary;
2937
+ endPointIndex: number;
3114
2938
  };
3115
2939
  /**
3116
- * A direction a lane can lead to, as lane guidance reports it.
2940
+ * A stretch of a route by point index, as a section spans it.
3117
2941
  *
3118
2942
  * @group Route
3119
2943
  */
3120
- export type PossibleLaneDirection = 'STRAIGHT' | 'SLIGHT_RIGHT' | 'RIGHT' | 'SHARP_RIGHT' | 'RIGHT_U_TURN' | 'SLIGHT_LEFT' | 'LEFT' | 'SHARP_LEFT' | 'LEFT_U_TURN';
2944
+ export type RouteSpan = Pick<SectionProps, 'startPointIndex' | 'endPointIndex'>;
3121
2945
  /**
3122
- * The possible directions of a lane and the one to follow, for lane-level navigation guidance.
2946
+ * A route section through a country.
2947
+ *
2948
+ * Use it to identify which countries the route traverses, for:
2949
+ * - Border crossing planning
2950
+ * - International routing costs
2951
+ * - Regulatory requirements
3123
2952
  *
3124
2953
  * @example
3125
2954
  * ```typescript
3126
- * // Left lane allows left turn or straight
3127
- * const laneDirection: LaneDirection = {
3128
- * directions: ['LEFT', 'STRAIGHT'],
3129
- * follow: 'LEFT' // Follow the left turn
2955
+ * const countrySection: CountrySectionProps = {
2956
+ * id: 'country-section-1',
2957
+ * startPointIndex: 0,
2958
+ * endPointIndex: 150,
2959
+ * countryCodeISO2: 'NL', // Netherlands
2960
+ * countryCodeISO3: 'NLD',
3130
2961
  * };
3131
2962
  * ```
3132
2963
  *
3133
2964
  * @group Route
3134
2965
  */
3135
- export type LaneDirection = {
2966
+ export type CountrySectionProps = SectionProps & {
3136
2967
  /**
3137
- * All possible directions this lane leads to.
2968
+ * The two-letter ISO 3166-1 alpha-2 country code, such as 'US', 'GB', 'NL', 'DE' or 'FR'.
3138
2969
  *
3139
- * A lane may allow several, such as straight and turn.
2970
+ * @see [ISO 3166-1 alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
3140
2971
  */
3141
- directions: PossibleLaneDirection[];
2972
+ countryCodeISO2: string;
3142
2973
  /**
3143
- * The direction to follow in this lane for the route, present when guidance indicates it.
2974
+ * The three-letter ISO 3166-1 alpha-3 country code, such as 'USA', 'GBR', 'NLD', 'DEU' or 'FRA'.
2975
+ *
2976
+ * @see [ISO 3166-1 alpha-3 codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3)
3144
2977
  */
3145
- follow?: PossibleLaneDirection;
2978
+ countryCodeISO3: string;
3146
2979
  };
3147
2980
  /**
3148
- * All the possible lane separators.
3149
- * @group Route
3150
- */
3151
- export type PossibleLaneSeparator = 'UNKNOWN' | 'NO_MARKING' | 'LONG_DASHED' | 'DOUBLE_SOLID' | 'SINGLE_SOLID' | 'SOLID_DASHED' | 'DASHED_SOLID' | 'SHORT_DASHED' | 'SHADED_AREA_MARKING' | 'DASHED_BLOCKS' | 'DOUBLE_DASHED' | 'CROSSING_ALERT' | 'PHYSICAL_DIVIDER' | 'PHYSICAL_DIVIDER_LESS_THAN_3M' | 'PHYSICAL_DIVIDER_GUARDRAIL' | 'CURB';
3152
- /**
3153
- * A section with a lane configuration.
2981
+ * A section on an important road stretch.
2982
+ *
2983
+ * Its street names, road numbers or both let the driver identify the course of the route and distinguish it from other potential routes.
2984
+ *
3154
2985
  * @group Route
3155
2986
  */
3156
- export type LaneSectionProps = SectionProps & {
2987
+ export type ImportantRoadStretchProps = SectionProps & {
3157
2988
  /**
3158
- * The lane directions for this lane section.
2989
+ * The importance as an integer, starting from 0, where a lower value means higher importance. Use it to:
2990
+ * * Tell which stretch is the most important, for example to display fewer stretches.
2991
+ * * Group the sections that belong to the same stretch, since one stretch may have gaps for various reasons.
3159
2992
  */
3160
- lanes: LaneDirection[];
2993
+ index: number;
3161
2994
  /**
3162
- * The lane separators for this lane section.
2995
+ * The street name of the important road stretch.
3163
2996
  */
3164
- laneSeparators: PossibleLaneSeparator[];
2997
+ streetName?: string;
3165
2998
  /**
3166
- * The properties of the lane section, possibly several combined.
3167
- * The possible values are:
3168
- * - `IS_MANEUVER`: The lane section contains a maneuver point, meaning a guidance instruction has a
3169
- * `maneuverPoint` in this section. The section then describes the lane configuration for that instruction.
2999
+ * A set of road numbers that identify the important road stretch.
3170
3000
  *
3171
- * The API may add more values in the future.
3001
+ * @remarks
3002
+ * The road numbers are sorted in descending order of display priority.
3172
3003
  */
3173
- properties?: string[];
3004
+ roadNumbers?: string[];
3174
3005
  };
3175
3006
  /**
3176
- * A section with a speed limit.
3007
+ * A traffic incident cause, based on the TPEG2-TEC standard.
3008
+ *
3009
+ * TPEG (Transport Protocol Experts Group) codes give a standardized
3010
+ * classification of traffic incident causes.
3011
+ *
3012
+ * @see [TPEG2-TEC Standard](https://www.iso.org/standard/59231.html)
3013
+ *
3177
3014
  * @group Route
3178
3015
  */
3179
- export type SpeedLimitSectionProps = SectionProps & {
3016
+ export type CauseTEC = {
3180
3017
  /**
3181
- * The speed limit in km/h for this section.
3018
+ * The TPEG2-TEC main cause code, the primary classification of what caused the incident.
3182
3019
  */
3183
- maxSpeedLimitInKmh: number;
3184
- };
3185
- /**
3186
- * A section with a road shield.
3187
- * @group Route
3188
- */
3189
- export type RoadShieldSectionProps = SectionProps & {
3020
+ mainCauseCode: number;
3190
3021
  /**
3191
- * The road shield code for this section.
3022
+ * The TPEG2-TEC sub-cause code, a more specific classification under the main cause.
3192
3023
  */
3193
- roadShieldReferences: RoadShieldReference[];
3024
+ subCauseCode?: number;
3194
3025
  };
3195
3026
  /**
3196
- * The sections of a route, the parts of it with specific characteristics, such as stretches on a
3197
- * ferry or motorway or with traffic incidents.
3198
- * With sections, you can show users where these lie on a planned route.
3027
+ * The TPEG2-TEC standardized classification of a traffic incident's effects on traffic flow and its causes.
3028
+ *
3199
3029
  * @group Route
3200
3030
  */
3201
- export type SectionsProps = {
3202
- /** Stretches reserved for carpool (high-occupancy) vehicles. */
3203
- carpool?: SectionProps[];
3204
- /** Stretches travelled on a car train, where the vehicle is carried by rail. */
3205
- carTrain?: SectionProps[];
3206
- /** One section per country the route passes through, each naming that country. */
3207
- country?: CountrySectionProps[];
3208
- /**
3209
- * The curves of the route, in order along it.
3210
- *
3211
- * @remarks
3212
- * The SDK finds them in the route's geometry, with {@link getCurveSections} and the thresholds of
3213
- * the `curveDetection` of `calculateRoute`, when its `sectionTypes` names `curve`.
3214
- * {@link withCurveSections} finds them again with others.
3215
- */
3216
- curve?: CurveSectionProps[];
3217
- /**
3218
- * The stretches where curves follow one another closely, in order along the route.
3219
- *
3220
- * @remarks
3221
- * The SDK groups the route's curves into them, with {@link getCurvyStretchSections} and the
3222
- * thresholds of the `curveDetection` of `calculateRoute`, when its `sectionTypes` names `curvyStretch`.
3223
- */
3224
- curvyStretch?: CurvyStretchSectionProps[];
3225
- /**
3226
- * The stretches no other route of the same response drives, in order along the route.
3227
- *
3228
- * @remarks
3229
- * The SDK computes them, with {@link getDistinctSections}, whenever a response has two or more
3230
- * routes. They are present on every route then, and empty on a route that shares every road
3231
- * with the others.
3232
- */
3233
- distinct?: DistinctSectionProps[];
3234
- /** Stretches travelled by ferry. */
3235
- ferry?: SectionProps[];
3236
- /** Stretches whose street name or road numbers identify the course of the route. */
3237
- importantRoadStretch?: ImportantRoadStretchProps[];
3238
- /**
3239
- * The lane configuration sections. They are present only when `guidance` was requested and, if
3240
- * `sectionTypes` was a list, only if it included `lanes`.
3241
- */
3242
- lanes?: LaneSectionProps[];
3243
- /** One section per leg of the route, always present because every route has at least one leg. */
3244
- leg: LegSectionProps[];
3245
- /** Stretches inside a low-emission zone, which a vehicle may need to qualify to enter. */
3246
- lowEmissionZone?: SectionProps[];
3247
- /** Stretches on a motorway. */
3248
- motorway?: SectionProps[];
3249
- /** Stretches travelled on foot. */
3250
- pedestrian?: SectionProps[];
3251
- /** Stretches carrying road shields, for rendering route numbers along the route. */
3252
- roadShields?: RoadShieldSectionProps[];
3253
- /** Stretches with a known maximum speed limit. */
3254
- speedLimit?: SpeedLimitSectionProps[];
3031
+ export type TrafficIncidentTEC = {
3255
3032
  /**
3256
- * Stretches where a per-use road toll is charged, on a ticket or barrier motorway or at a
3257
- * free-flow tolling point.
3258
- *
3259
- * @remarks
3260
- * It is a subset of {@link SectionsProps.tollRoad | `tollRoad`}, so every stretch reported here is
3261
- * also reported there. Use `toll` for "will this route cost a toll to drive", and `tollRoad` for
3262
- * "does this route cost anything at all to drive". `tollRoad` also covers vignette-only
3263
- * motorways and urban charge zones, which carry no per-use toll.
3264
- *
3265
- * By default, it is included, since leaving `sectionTypes` unset requests it. A `sectionTypes`
3266
- * list has to name `'toll'` to keep it.
3033
+ * The TPEG2-TEC effect code, which says how the incident affects traffic flow.
3267
3034
  */
3268
- toll?: SectionProps[];
3035
+ effectCode?: number;
3269
3036
  /**
3270
- * Stretches that cost money to drive by any charging scheme, meaning per-use tolls, motorways
3271
- * that need a vignette and urban road-charge zones.
3272
- *
3273
- * @remarks
3274
- * It is a superset of {@link SectionsProps.toll | `toll`}. On a ticket motorway, the two report the
3275
- * same stretches. A vignette-only motorway or a city charge zone appears here and not in
3276
- * `toll`.
3037
+ * The causes of this traffic incident, at least one.
3277
3038
  *
3278
- * By default, it is included, since leaving `sectionTypes` unset requests it. A `sectionTypes`
3279
- * list has to name `'tollRoad'` to keep it.
3280
- */
3281
- tollRoad?: SectionProps[];
3282
- /**
3283
- * Stretches needing a vignette, one section per country requiring one.
3039
+ * Multiple causes may contribute to a single traffic incident.
3284
3040
  */
3285
- tollVignette?: CountrySectionProps[];
3286
- /** Stretches affected by a traffic incident, with its delay and cause. */
3287
- traffic?: TrafficSectionProps[];
3288
- /** Stretches inside a tunnel. */
3289
- tunnel?: SectionProps[];
3290
- /** Stretches on an unpaved road. */
3291
- unpaved?: SectionProps[];
3292
- /** Stretches on urban roads. */
3293
- urban?: SectionProps[];
3294
- /** Stretches the requested vehicle is not permitted to use. */
3295
- vehicleRestricted?: SectionProps[];
3041
+ causes?: [CauseTEC, ...CauseTEC[]];
3296
3042
  };
3297
3043
  /**
3298
- * The name of one route section type, which is a key of {@link SectionsProps}.
3299
- * @group Route
3300
- */
3301
- export type SectionType = keyof SectionsProps;
3302
- /**
3303
- * The section types a route calculation returns when its request names none: every type the
3304
- * routing API returns, and `lanes` with guidance.
3044
+ * A route section affected by a traffic incident.
3305
3045
  *
3306
- * @remarks
3307
- * A `sectionTypes` list replaces the default rather than adding to it. Spread this one to add to
3308
- * it, such as the curves, which the SDK finds only when a list names them.
3046
+ * It is a portion of the route with traffic delays due to congestion, accidents,
3047
+ * construction or other incidents.
3309
3048
  *
3310
3049
  * @example
3311
3050
  * ```typescript
3312
- * const routes = await calculateRoute({ locations, sectionTypes: [...defaultSectionTypes, 'curve', 'curvyStretch'] });
3051
+ * const trafficSection: TrafficSectionProps = {
3052
+ * id: 'traffic-1',
3053
+ * startPointIndex: 50,
3054
+ * endPointIndex: 75,
3055
+ * categories: ['jam'],
3056
+ * magnitudeOfDelay: 'moderate',
3057
+ * delayInSeconds: 420, // 7 minutes
3058
+ * effectiveSpeedInKmh: 25,
3059
+ * tec: { effectCode: 1, causes: [{ mainCauseCode: 1 }] }
3060
+ * };
3313
3061
  * ```
3314
3062
  *
3315
3063
  * @group Route
3316
3064
  */
3317
- export declare const defaultSectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "lanes"];
3318
- /**
3319
- * The section types a route calculation request can ask to include in the response.
3320
- * @group Route
3321
- */
3322
- export declare const inputSectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "curve", "curvyStretch"];
3323
- /**
3324
- * The section types, including guidance-related ones, a route calculation request can ask to include in the response.
3325
- * @group Route
3326
- */
3327
- export declare const inputSectionTypesWithGuidance: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "curve", "curvyStretch", "lanes"];
3328
- /**
3329
- * Every section type a route can carry: the requestable ones, plus `leg` and `distinct`, which no request names.
3330
- * @group Route
3331
- */
3332
- export declare const sectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "curve", "curvyStretch", "lanes", "leg", "distinct"];
3333
- //#endregion
3334
- //#region src/types/route/analysis.d.ts
3335
- /**
3336
- * The threshold a distinct section has to reach to be kept.
3337
- *
3338
- * @group Utils
3339
- */
3340
- type DistinctSectionsOptions = {
3341
- /** Leaves out the sections shorter than this. */
3342
- minLengthInMeters?: number;
3343
- };
3344
- /**
3345
- * The thresholds a stretch of road has to reach to count as a curve.
3346
- *
3347
- * @remarks
3348
- * The defaults keep the bends a passenger feels: from a country road's 40° bend on a radius of 250
3349
- * metres to a hairpin. Lower `maxRadiusInMeters` to keep only hard curves, such as to warn someone
3350
- * prone to motion sickness, or raise it to count sweeping bends too.
3351
- *
3352
- * @group Utils
3353
- */
3354
- type CurveSectionsOptions = {
3065
+ export type TrafficSectionProps = SectionProps & {
3355
3066
  /**
3356
- * Leaves out the curves turning less than this, either way.
3357
- * @default 40
3067
+ * The categories of the incident, based on its `tec` cause codes, or on its icon category when it has none.
3358
3068
  */
3359
- minHeadingChangeInDegrees?: number;
3069
+ categories: TrafficIncidentCategory[];
3360
3070
  /**
3361
- * Leaves out the curves wider than this.
3362
- * @default 250
3071
+ * The severity of the delay this incident causes.
3363
3072
  */
3364
- maxRadiusInMeters?: number;
3073
+ magnitudeOfDelay: DelayMagnitude;
3365
3074
  /**
3366
- * How far the road may run straight within a curve. A longer straight ends it, so two bends
3367
- * apart are two curves.
3368
- *
3369
- * It defaults to 40, or to 15% of a `maxRadiusInMeters` over 267, since a wide curve turns little
3370
- * over 40 metres.
3075
+ * The internationally standardized TPEG2-TEC codes that classify the incident, when the service has them.
3371
3076
  */
3372
- maxStraightInMeters?: number;
3373
- };
3374
- /**
3375
- * How close curves have to follow one another to make a curvy stretch.
3376
- *
3377
- * @group Utils
3378
- */
3379
- type CurvyStretchSectionsOptions = {
3077
+ tec?: TrafficIncidentTEC;
3380
3078
  /**
3381
- * The curves to group, in order along the route. Defaults to the route's `sections.curve`, or to
3382
- * {@link getCurveSections} with its defaults when the route has none.
3079
+ * The actual average speed through this incident in km/h, when speed information is available.
3080
+ *
3081
+ * A lower speed means worse congestion.
3383
3082
  */
3384
- curves?: readonly CurveSectionProps[];
3083
+ effectiveSpeedInKmh?: number;
3385
3084
  /**
3386
- * The longest gap between two curves of one stretch.
3387
- * @default 500
3085
+ * The extra time in seconds this incident causes compared to free-flow conditions.
3086
+ *
3087
+ * It is present when the delay can be calculated.
3388
3088
  */
3389
- maxGapInMeters?: number;
3089
+ delayInSeconds?: number;
3390
3090
  /**
3391
- * Leaves out the stretches with fewer curves than this.
3392
- * @default 3
3091
+ * The routing service's identifier of the traffic incident behind this section.
3092
+ *
3093
+ * @remarks
3094
+ * It is the tail of the incident's `id` in `trafficIncidentDetails`, not that id, so passing it as
3095
+ * `ids` finds nothing. To get the whole record, query `trafficIncidentDetails` with the section's
3096
+ * {@link getSectionBBox} and keep the incident whose `id.endsWith(eventId)`.
3393
3097
  */
3394
- minCurveCount?: number;
3098
+ eventId?: string;
3395
3099
  };
3396
3100
  /**
3397
- * The thresholds a route's curves and curvy stretches are found with.
3101
+ * A stretch of a route that no other route it is compared with drives, from the vertex where it
3102
+ * leaves them to the one where it rejoins them.
3398
3103
  *
3399
3104
  * @remarks
3400
- * `calculateRoute` takes it as `curveDetection`, and {@link withCurveSections} to find them again
3401
- * on a route you already have.
3105
+ * A segment of the route, from one coordinate to the next, counts as shared when another route
3106
+ * drives the same segment in either direction. A route crossing this one at a junction doesn't
3107
+ * split it.
3108
+ *
3109
+ * @group Route
3110
+ */
3111
+ export type DistinctSectionProps = SectionProps & {
3112
+ /** The length of the section, along the route. */
3113
+ lengthInMeters: number;
3114
+ };
3115
+ /**
3116
+ * A curve of a route: a stretch where the road keeps turning the same way.
3117
+ *
3118
+ * @remarks
3119
+ * The SDK finds curves in the route's geometry, with {@link getCurveSections}. A small radius with a
3120
+ * large heading change makes a hard curve, up to a hairpin as {@link isHairpin} tells them.
3402
3121
  *
3403
3122
  * @example
3404
3123
  * ```typescript
3405
- * // Only the hard curves, and the stretches of five or more of them
3406
- * const curveDetection: CurveDetectionOptions = {
3407
- * curve: { maxRadiusInMeters: 100 },
3408
- * curvyStretch: { minCurveCount: 5 },
3124
+ * const hairpin: CurveSectionProps = {
3125
+ * id: 'curve-1',
3126
+ * startPointIndex: 120,
3127
+ * endPointIndex: 131,
3128
+ * headingChangeInDegrees: -172, // a left hairpin
3129
+ * radiusInMeters: 14,
3130
+ * lengthInMeters: 70,
3131
+ * curvinessScore: 84, // each of the 42 metres of its arc counts twice
3132
+ * severity: 0.94,
3409
3133
  * };
3410
3134
  * ```
3411
3135
  *
3412
- * @group Utils
3413
- */
3414
- type CurveDetectionOptions = {
3415
- /** The thresholds a stretch of road has to reach to count as a curve. */
3416
- curve?: CurveSectionsOptions;
3417
- /** How close the curves found have to follow one another to make a curvy stretch. */
3418
- curvyStretch?: Omit<CurvyStretchSectionsOptions, 'curves'>;
3419
- };
3420
- /**
3421
- * A route's sections of one type within the spans asked about.
3422
- *
3423
- * @group Utils
3136
+ * @group Route
3424
3137
  */
3425
- type SectionsWithinOfType<T extends SectionType> = {
3426
- /** The sections reaching into the spans, whole, in their order on the route. */
3427
- sections: NonNullable<SectionsProps[T]>;
3138
+ export type CurveSectionProps = SectionProps & {
3428
3139
  /**
3429
- * Each section's share within the spans, from 0 to 1, in the order of `sections`. Use it to count
3430
- * only that part of what a section carries, such as a traffic section's delay.
3140
+ * How far the heading turns along the curve: positive to the right, negative to the left. It can
3141
+ * pass 180° on a hairpin or a roundabout.
3431
3142
  */
3432
- shares: number[];
3433
- /** How far they run within the spans, together. */
3143
+ headingChangeInDegrees: number;
3144
+ /**
3145
+ * The radius of the circle the curve follows where it turns tightest, over the shortest part of
3146
+ * it that turns four fifths of its heading change: a curve can ease in on a wide bend first.
3147
+ */
3148
+ radiusInMeters: number;
3149
+ /** The length of the curve, along the route, from where it starts turning to where it straightens. */
3434
3150
  lengthInMeters: number;
3435
- };
3436
- /**
3437
- * A route's sections within the spans asked about, by type: only the types it has there.
3438
- *
3439
- * @group Utils
3440
- */
3441
- type SectionsWithin = { [T in SectionType]?: SectionsWithinOfType<T>; };
3442
- /**
3443
- * Where to look along a route for its sections, and of which types.
3444
- *
3445
- * @group Utils
3446
- */
3447
- type SectionsWithinOptions = {
3448
- /** Only counts the sections within these spans of the route, which must not overlap. Defaults to the whole route. */
3449
- within?: readonly RouteSpan[];
3450
- /** The section types to look for. Defaults to every type. */
3451
- types?: readonly SectionType[];
3452
- };
3453
- /**
3454
- * How a route differs from a reference route: the stretches each drives alone, and their sections.
3455
- *
3456
- * @group Utils
3457
- */
3458
- type RouteComparison = {
3459
- /** The stretches only the route drives, of the two. */
3460
- distinct: DistinctSectionProps[];
3461
- /** The stretches only the reference drives, of the two. */
3462
- referenceDistinct: DistinctSectionProps[];
3463
- /** The route's sections on the stretches only it drives: what it takes on. */
3464
- adds: SectionsWithin;
3465
- /** The reference's sections on the stretches only it drives: what the route stays clear of. */
3466
- avoids: SectionsWithin;
3467
- };
3468
- /**
3469
- * Which sections to weigh when comparing two routes.
3470
- *
3471
- * @group Utils
3472
- */
3473
- type CompareRoutesOptions = {
3474
3151
  /**
3475
- * The section types to weigh. Defaults to every type `calculateRoute` can return, `curve` and
3476
- * `curvyStretch` included when the routes carry them, leaving out `leg` and `distinct`.
3152
+ * How much the curve has to offer a rider, as roadcurvature.com scores roads: the length of its
3153
+ * arc, `radiusInMeters` times the heading change in radians, with each metre counted:
3154
+ * - 2 times below a radius of 30 m, 1.6 times below 60 m, 1.3 times below 100 m and 1 time below 175 m.
3155
+ * - Not at all on a curve wider than 175 m, which scores 0.
3477
3156
  */
3478
- types?: readonly SectionType[];
3157
+ curvinessScore: number;
3158
+ /**
3159
+ * How hard the curve is to drive, from 0 to 1: how much a driver slows down for it, from the
3160
+ * speed limit on the road leading into it.
3161
+ *
3162
+ * @remarks
3163
+ * - It grows as the radius shrinks. A shallow curve counts as wider than its radius, since a
3164
+ * driver can straighten it out across the lane, but a hairpin can't be straightened.
3165
+ * - A turn at a junction, with a turn, U-turn or roundabout `maneuver`, scores as one the driver
3166
+ * slows right down for, however wide its corner is drawn.
3167
+ * - It reads the route's `speedLimit` sections, so ask for them along with the curves. Where the
3168
+ * route has no limit for the road, it takes a typical limit outside towns.
3169
+ * - A curve a driver takes at the limit scores 0. The tighter the curve is for the road, the
3170
+ * nearer 1 it scores.
3171
+ */
3172
+ severity: number;
3173
+ /**
3174
+ * The maneuver of the guidance instruction on the curve, such as `TURN_LEFT` or
3175
+ * `ROUNDABOUT_RIGHT`. It tells a turn at a junction from a bend of the road, so it is absent:
3176
+ * - On a curve no instruction falls on, or whose only instructions mark no junction: a departure,
3177
+ * an arrival, a waypoint, a border or a tollgate.
3178
+ * - Where the instruction keeps to the road, as "Turn left to stay on the SS38" where a side road
3179
+ * leaves a hairpin, or has no other way to take, as "Follow the road to the left". A roundabout
3180
+ * and a U-turn always name theirs.
3181
+ * - On every curve of a route calculated without `guidance`.
3182
+ */
3183
+ maneuver?: Maneuver;
3479
3184
  };
3480
3185
  /**
3481
- * A road a route takes, as its important road stretches name it.
3186
+ * A curvy stretch of a route: curves that follow one another closely, such as a mountain pass.
3482
3187
  *
3483
3188
  * @remarks
3484
- * Its `index` is that of its most important stretch: the lower, the more important. Its `streetName`
3485
- * is the first one its stretches carry.
3189
+ * The SDK groups the route's curves into stretches, with {@link getCurvyStretchSections}. To list
3190
+ * the curves of a stretch, pass it as `within` to {@link getSectionsWithin}.
3486
3191
  *
3487
- * @group Utils
3192
+ * A curve at a maneuver ends a stretch, since a run of turns at junctions makes no winding road.
3193
+ * That takes a route with guidance: without it, turns at junctions between short roads can make one.
3194
+ *
3195
+ * @group Route
3488
3196
  */
3489
- type ImportantRoad = Pick<ImportantRoadStretchProps, 'index' | 'streetName'> & {
3490
- /** What a driver calls it: its first road number, else its street name. Absent when it has neither. */
3491
- name?: string;
3197
+ export type CurvyStretchSectionProps = SectionProps & {
3198
+ /** How many curves the stretch holds. Over `lengthInMeters`, it says how winding the stretch is. */
3199
+ curveCount: number;
3200
+ /** How many of its curves are hairpins, as {@link isHairpin} tells them. */
3201
+ hairpinCount: number;
3202
+ /** The length of the stretch, along the route. */
3203
+ lengthInMeters: number;
3204
+ /** The radius of the stretch's tightest curve. */
3205
+ minRadiusInMeters: number;
3492
3206
  /**
3493
- * Its road numbers, those of its stretches in turn, each sorted in descending order of display
3494
- * priority. Empty when it has none.
3207
+ * The `curvinessScore` of its curves, added up: the higher, the more a rider gets out of it.
3208
+ * Roadcurvature.com, which scores roads the same way, calls those over 1000 very twisty.
3495
3209
  */
3496
- roadNumbers: string[];
3497
- /** How far the route follows it, counting only the parts within the sections asked about. */
3498
- lengthInMeters: number;
3499
- /** The route's important road stretch sections on it, in order along the route. */
3500
- sections: ImportantRoadStretchProps[];
3501
- };
3502
- /**
3503
- * Where to look for important roads along a route, and how much of each to require.
3504
- *
3505
- * @group Utils
3506
- */
3507
- type ImportantRoadsOptions = Pick<SectionsWithinOptions, 'within'> & {
3508
- /** Leaves out the roads the route follows for less than this within the spans. */
3509
- minLengthInMeters?: number;
3210
+ curvinessScore: number;
3510
3211
  };
3511
- //#endregion
3512
- //#region src/types/route/route.d.ts
3513
3212
  /**
3514
- * All the road and route features that route calculation can avoid.
3213
+ * A route section for a leg, the portion of route between two consecutive waypoints.
3515
3214
  *
3516
- * Use it to derive the {@link Avoidable} type or to validate user input against the supported
3517
- * avoidance options.
3215
+ * It is a top-level section that covers the entire journey segment.
3518
3216
  *
3519
3217
  * @remarks
3520
- * This readonly tuple is the source of truth for valid avoidance types. The {@link Avoidable}
3521
- * type derives from it, for type safety.
3218
+ * For example:
3219
+ * - A→B route: 1 leg (A to B)
3220
+ * - A→B→C route: 2 legs (A to B, then B to C)
3221
+ * - A path location (route reconstruction): one leg per leg the path was planned with
3522
3222
  *
3523
3223
  * @example
3524
3224
  * ```typescript
3525
- * // Check if a string is a valid avoidance type
3526
- * const userInput = 'tollRoads';
3527
- * if (avoidableTypes.includes(userInput as Avoidable)) {
3528
- * // userInput is valid
3529
- * }
3530
- *
3531
- * // Iterate over all available options
3532
- * avoidableTypes.forEach(type => {
3533
- * console.log(`Available option: ${type}`);
3534
- * });
3225
+ * const leg: LegSectionProps = {
3226
+ * id: 'leg-1',
3227
+ * summary: {
3228
+ * departureTime: new Date(),
3229
+ * arrivalTime: new Date(),
3230
+ * lengthInMeters: 50000,
3231
+ * travelTimeInSeconds: 3600,
3232
+ * // ... other summary fields
3233
+ * },
3234
+ * startPointIndex: 0,
3235
+ * endPointIndex: 250
3236
+ * };
3535
3237
  * ```
3536
3238
  *
3537
3239
  * @group Route
3538
3240
  */
3539
- export declare const avoidableTypes: readonly ["tollRoads", "motorways", "ferries", "unpavedRoads", "carpools", "alreadyUsedRoads", "borderCrossings", "tunnels", "carTrains", "lowEmissionZones"];
3540
- /**
3541
- * A route feature that the routing engine tries to avoid when calculating routes.
3542
- *
3543
- * Use it to customize routes for vehicle capabilities, user preferences or regulatory
3544
- * requirements. Note that avoidance is not guaranteed if no alternative route exists.
3545
- *
3546
- * @remarks
3547
- * The avoidance options:
3548
- * - `tollRoads`: Avoids roads requiring toll payments
3549
- * - `motorways`: Avoids high-speed limited-access highways (useful for scenic routes or vehicle restrictions)
3550
- * - `ferries`: Avoids water crossings requiring ferry transport
3551
- * - `unpavedRoads`: Avoids unpaved/dirt roads (recommended for standard vehicles)
3552
- * - `carpools`: Avoids carpool/HOV (High Occupancy Vehicle) lanes
3553
- * - `alreadyUsedRoads`: Prevents using the same road segment multiple times (useful for delivery routes)
3554
- * - `borderCrossings`: Avoids crossing international borders (useful for customs/visa considerations)
3555
- * - `tunnels`: Avoids underground tunnels (useful for vehicles carrying hazardous materials)
3556
- * - `carTrains`: Avoids car train transport segments
3557
- * - `lowEmissionZones`: Avoids zones with vehicle emission restrictions
3558
- *
3559
- * @example
3560
- * ```typescript
3561
- * // Avoid tolls and motorways for a scenic route
3562
- * const scenicAvoid: Avoidable[] = ['tollRoads', 'motorways'];
3563
- *
3564
- * // Avoid unpaved roads for a standard car
3565
- * const carAvoid: Avoidable[] = ['unpavedRoads'];
3566
- * ```
3241
+ export type LegSectionProps = Omit<SectionProps, 'startPointIndex' | 'endPointIndex'> & {
3242
+ /**
3243
+ * The index in the route coordinates where this leg starts. `calculateRoute` always sets it;
3244
+ * only a route built by hand can leave it out.
3245
+ */
3246
+ startPointIndex?: number;
3247
+ /**
3248
+ * The index in the route coordinates where this leg ends. `calculateRoute` always sets it;
3249
+ * only a route built by hand can leave it out.
3250
+ */
3251
+ endPointIndex?: number;
3252
+ /**
3253
+ * The index of the waypoint this leg ends at, in the `locations` the route was requested with.
3254
+ *
3255
+ * @remarks
3256
+ * A leg does not always end at the location with the same index. A path location expands into
3257
+ * legs of its own, so `legs[i]` is not reliably the leg arriving at `locations[i + 1]`. This
3258
+ * index maps a leg back to the stop the caller passed.
3259
+ *
3260
+ * It is absent on the final leg, and on legs that end somewhere the caller did not ask for.
3261
+ *
3262
+ * @example
3263
+ * ```typescript
3264
+ * // Which of the stops I passed does this leg arrive at?
3265
+ * const index = leg.originalWaypointIndex;
3266
+ * const stop = index === undefined ? undefined : locations[index];
3267
+ * ```
3268
+ */
3269
+ originalWaypointIndex?: number;
3270
+ /**
3271
+ * The summary statistics of this leg of the journey, with its departure and arrival times,
3272
+ * distances and durations.
3273
+ */
3274
+ summary: LegSummary;
3275
+ };
3276
+ /**
3277
+ * A direction a lane can lead to, as lane guidance reports it.
3567
3278
  *
3568
3279
  * @group Route
3569
3280
  */
3570
- export type Avoidable = (typeof avoidableTypes)[number];
3281
+ export type PossibleLaneDirection = 'STRAIGHT' | 'SLIGHT_RIGHT' | 'RIGHT' | 'SHARP_RIGHT' | 'RIGHT_U_TURN' | 'SLIGHT_LEFT' | 'LEFT' | 'SHARP_LEFT' | 'LEFT_U_TURN';
3571
3282
  /**
3572
- * The primary mode of transportation for route calculation.
3573
- *
3574
- * It determines the road type preferences, speed calculations and routing rules of the
3575
- * calculated route. Currently, only `'car'` is supported.
3576
- *
3577
- * @remarks
3578
- * Future versions may support additional modes such as truck, taxi, bus, bicycle and pedestrian.
3283
+ * The possible directions of a lane and the one to follow, for lane-level navigation guidance.
3579
3284
  *
3580
3285
  * @example
3581
3286
  * ```typescript
3582
- * const travelMode: TravelMode = 'car';
3287
+ * // Left lane allows left turn or straight
3288
+ * const laneDirection: LaneDirection = {
3289
+ * directions: ['LEFT', 'STRAIGHT'],
3290
+ * follow: 'LEFT' // Follow the left turn
3291
+ * };
3583
3292
  * ```
3584
3293
  *
3585
3294
  * @group Route
3586
3295
  */
3587
- export type TravelMode = 'car';
3296
+ export type LaneDirection = {
3297
+ /**
3298
+ * All possible directions this lane leads to.
3299
+ *
3300
+ * A lane may allow several, such as straight and turn.
3301
+ */
3302
+ directions: PossibleLaneDirection[];
3303
+ /**
3304
+ * The direction to follow in this lane for the route, present when guidance indicates it.
3305
+ */
3306
+ follow?: PossibleLaneDirection;
3307
+ };
3588
3308
  /**
3589
- * The cumulative distance and time at a position along the route.
3590
- *
3591
- * Both fields are optional because a progress entry may omit either value. Interpolation
3592
- * utilities return the resolved, always-present equivalent, {@link RouteProgressAtPoint}.
3593
- *
3309
+ * All the possible lane separators.
3594
3310
  * @group Route
3595
3311
  */
3596
- export type RouteProgress = {
3312
+ export type PossibleLaneSeparator = 'UNKNOWN' | 'NO_MARKING' | 'LONG_DASHED' | 'DOUBLE_SOLID' | 'SINGLE_SOLID' | 'SOLID_DASHED' | 'DASHED_SOLID' | 'SHORT_DASHED' | 'SHADED_AREA_MARKING' | 'DASHED_BLOCKS' | 'DOUBLE_DASHED' | 'CROSSING_ALERT' | 'PHYSICAL_DIVIDER' | 'PHYSICAL_DIVIDER_LESS_THAN_3M' | 'PHYSICAL_DIVIDER_GUARDRAIL' | 'CURB';
3313
+ /**
3314
+ * A section with a lane configuration.
3315
+ * @group Route
3316
+ */
3317
+ export type LaneSectionProps = SectionProps & {
3597
3318
  /**
3598
- * Cumulative travel time in seconds from the route start.
3319
+ * The lane directions for this lane section.
3599
3320
  */
3600
- travelTimeInSeconds?: number;
3321
+ lanes: LaneDirection[];
3601
3322
  /**
3602
- * Cumulative distance in meters from the route start.
3323
+ * The lane separators for this lane section.
3603
3324
  */
3604
- distanceInMeters?: number;
3325
+ laneSeparators: PossibleLaneSeparator[];
3326
+ /**
3327
+ * The properties of the lane section, possibly several combined.
3328
+ * The possible values are:
3329
+ * - `IS_MANEUVER`: The lane section contains a maneuver point, meaning a guidance instruction has a
3330
+ * `maneuverPoint` in this section. The section then describes the lane configuration for that instruction.
3331
+ *
3332
+ * The API may add more values in the future.
3333
+ */
3334
+ properties?: string[];
3605
3335
  };
3606
3336
  /**
3607
- * The progress at a specific coordinate on the route path.
3608
- *
3609
- * It adds to {@link RouteProgress} a `pointIndex` that identifies the coordinate's entry in
3610
- * the route's coordinate array.
3337
+ * A section with a speed limit.
3338
+ * @group Route
3339
+ */
3340
+ export type SpeedLimitSectionProps = SectionProps & {
3341
+ /**
3342
+ * The speed limit in km/h for this section.
3343
+ */
3344
+ maxSpeedLimitInKmh: number;
3345
+ };
3346
+ /**
3347
+ * A section with a road shield.
3348
+ * @group Route
3349
+ */
3350
+ export type RoadShieldSectionProps = SectionProps & {
3351
+ /**
3352
+ * The references of the road shields along this section.
3353
+ */
3354
+ roadShieldReferences: RoadShieldReference[];
3355
+ };
3356
+ /**
3357
+ * The sections of a route, the parts of it with specific characteristics, such as stretches on a
3358
+ * ferry or motorway or with traffic incidents.
3359
+ * With sections, you can show users where these lie on a planned route.
3360
+ * @group Route
3361
+ */
3362
+ export type SectionsProps = {
3363
+ /** Stretches reserved for carpool (high-occupancy) vehicles. */
3364
+ carpool?: SectionProps[];
3365
+ /** Stretches travelled on a car train, where the vehicle is carried by rail. */
3366
+ carTrain?: SectionProps[];
3367
+ /** One section per country the route passes through, each naming that country. */
3368
+ country?: CountrySectionProps[];
3369
+ /**
3370
+ * The curves of the route, in order along it.
3371
+ *
3372
+ * @remarks
3373
+ * The SDK finds them in the route's geometry, with {@link getCurveSections} and the thresholds of
3374
+ * the `curveDetection` of `calculateRoute`, when its `sectionTypes` names `curve`.
3375
+ * {@link withCurveSections} finds them again with others.
3376
+ */
3377
+ curve?: CurveSectionProps[];
3378
+ /**
3379
+ * The stretches where curves follow one another closely, in order along the route.
3380
+ *
3381
+ * @remarks
3382
+ * The SDK groups the route's curves into them, with {@link getCurvyStretchSections} and the
3383
+ * thresholds of the `curveDetection` of `calculateRoute`, when its `sectionTypes` names `curvyStretch`.
3384
+ */
3385
+ curvyStretch?: CurvyStretchSectionProps[];
3386
+ /**
3387
+ * The stretches no other route of the same response drives, in order along the route.
3388
+ *
3389
+ * @remarks
3390
+ * The SDK computes them, with {@link getDistinctSections}, whenever a response has two or more
3391
+ * routes. They are present on every route then, and empty on a route that shares every road
3392
+ * with the others.
3393
+ */
3394
+ distinct?: DistinctSectionProps[];
3395
+ /** Stretches travelled by ferry. */
3396
+ ferry?: SectionProps[];
3397
+ /** Stretches whose street name or road numbers identify the course of the route. */
3398
+ importantRoadStretch?: ImportantRoadStretchProps[];
3399
+ /**
3400
+ * The lane configuration sections. They are present only when `guidance` was requested and, if
3401
+ * `sectionTypes` was a list, only if it included `lanes`.
3402
+ */
3403
+ lanes?: LaneSectionProps[];
3404
+ /** One section per leg of the route, always present because every route has at least one leg. */
3405
+ leg: LegSectionProps[];
3406
+ /** Stretches inside a low-emission zone, which a vehicle may need to qualify to enter. */
3407
+ lowEmissionZone?: SectionProps[];
3408
+ /** Stretches on a motorway. */
3409
+ motorway?: SectionProps[];
3410
+ /** Stretches travelled on foot. */
3411
+ pedestrian?: SectionProps[];
3412
+ /** Stretches carrying road shields, for rendering route numbers along the route. */
3413
+ roadShields?: RoadShieldSectionProps[];
3414
+ /** Stretches with a known maximum speed limit. */
3415
+ speedLimit?: SpeedLimitSectionProps[];
3416
+ /**
3417
+ * Stretches where a per-use road toll is charged, on a ticket or barrier motorway or at a
3418
+ * free-flow tolling point.
3419
+ *
3420
+ * @remarks
3421
+ * It is a subset of {@link SectionsProps.tollRoad | `tollRoad`}, so every stretch reported here is
3422
+ * also reported there.
3423
+ *
3424
+ * Use `toll` for "will this route cost a toll to drive", and `tollRoad` for
3425
+ * "does this route cost anything at all to drive". `tollRoad` also covers vignette-only
3426
+ * motorways and urban charge zones, which carry no per-use toll.
3427
+ */
3428
+ toll?: SectionProps[];
3429
+ /**
3430
+ * Stretches that cost money to drive by any charging scheme, meaning per-use tolls, motorways
3431
+ * that need a vignette and urban road-charge zones.
3432
+ *
3433
+ * @remarks
3434
+ * It is a superset of {@link SectionsProps.toll | `toll`}: see there how the two differ.
3435
+ */
3436
+ tollRoad?: SectionProps[];
3437
+ /**
3438
+ * Stretches needing a vignette, one section per country requiring one.
3439
+ */
3440
+ tollVignette?: CountrySectionProps[];
3441
+ /** Stretches affected by a traffic incident, with its delay and cause. */
3442
+ traffic?: TrafficSectionProps[];
3443
+ /** Stretches inside a tunnel. */
3444
+ tunnel?: SectionProps[];
3445
+ /** Stretches on an unpaved road. */
3446
+ unpaved?: SectionProps[];
3447
+ /** Stretches on urban roads. */
3448
+ urban?: SectionProps[];
3449
+ /** Stretches the requested vehicle is not permitted to use. */
3450
+ vehicleRestricted?: SectionProps[];
3451
+ };
3452
+ /**
3453
+ * The name of one route section type, which is a key of {@link SectionsProps}.
3454
+ * @group Route
3455
+ */
3456
+ export type SectionType = keyof SectionsProps;
3457
+ /**
3458
+ * The section types a route calculation requests when its request has no `sectionTypes`: every type the
3459
+ * routing API returns, and `lanes` with guidance.
3611
3460
  *
3612
3461
  * @remarks
3613
- * The `progress` array of a route always has entries for the first and last points. You can
3614
- * linearly interpolate the progress of intermediate points between entries.
3462
+ * A `sectionTypes` list replaces the default rather than adding to it. Spread this one to add to
3463
+ * it, such as the curves, which the SDK finds only when a list names them.
3615
3464
  *
3616
3465
  * @example
3617
3466
  * ```typescript
3618
- * const points: RouteProgressPoint[] = [
3619
- * { pointIndex: 0, travelTimeInSeconds: 0, distanceInMeters: 0 },
3620
- * { pointIndex: 50, travelTimeInSeconds: 120, distanceInMeters: 2500 },
3621
- * { pointIndex: 100, travelTimeInSeconds: 300, distanceInMeters: 5000 }
3622
- * ];
3467
+ * const routes = await calculateRoute({ locations, sectionTypes: [...defaultSectionTypes, 'curve', 'curvyStretch'] });
3623
3468
  * ```
3624
3469
  *
3625
3470
  * @group Route
3626
3471
  */
3627
- export type RouteProgressPoint = RouteProgress & {
3628
- /**
3629
- * Zero-based index of this point in the route's coordinate array.
3630
- */
3631
- pointIndex: number;
3632
- };
3472
+ export declare const defaultSectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "lanes"];
3633
3473
  /**
3634
- * The resolved distance and time at an interpolated position on the route path.
3635
- *
3636
- * Both fields are required, because the SDK produces this type only when interpolation
3637
- * fully resolves, meaning both bracketing progress entries carry valid values.
3638
- *
3474
+ * The section types a route calculation request can ask to include in the response, except `lanes`,
3475
+ * which comes with guidance: see {@link inputSectionTypesWithGuidance}.
3639
3476
  * @group Route
3640
3477
  */
3641
- export type RouteProgressAtPoint = Required<RouteProgress>;
3478
+ export declare const inputSectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "curve", "curvyStretch"];
3642
3479
  /**
3643
- * The progress over a segment between two arbitrary points on the route path.
3644
- *
3480
+ * The section types, including guidance-related ones, a route calculation request can ask to include in the response.
3645
3481
  * @group Route
3646
3482
  */
3647
- export type RouteSegmentProgress = {
3648
- /** Progress at the start point. */
3649
- start: RouteProgressAtPoint;
3650
- /** Progress at the end point. */
3651
- end: RouteProgressAtPoint;
3652
- /** The distance and time the segment covers, as end minus start. */
3653
- delta: RouteProgressAtPoint;
3654
- };
3483
+ export declare const inputSectionTypesWithGuidance: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "curve", "curvyStretch", "lanes"];
3655
3484
  /**
3656
- * Geographic coordinate and cumulative progress values at a specific point along a route.
3657
- *
3658
- * @group Utils
3485
+ * Every section type a route can carry: the requestable ones, plus `leg` and `distinct`, which no request names.
3486
+ * @group Route
3659
3487
  */
3660
- export type RouteCoordinateAtProgress = RouteProgressAtPoint & {
3661
- /** Geographic position as a GeoJSON `[longitude, latitude]` coordinate. */
3662
- position: Position;
3663
- };
3488
+ export declare const sectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "curve", "curvyStretch", "lanes", "leg", "distinct"];
3489
+ //#endregion
3490
+ //#region src/types/route/analysis.d.ts
3664
3491
  /**
3665
- * A discriminated union that identifies a position along a route.
3666
- * Provide exactly one of the three variants.
3492
+ * The threshold a distinct section has to reach to be kept.
3667
3493
  *
3668
3494
  * @group Utils
3669
3495
  */
3670
- export type RouteProgressQuery = {
3671
- traveledTimeInSeconds: number;
3672
- } | {
3673
- traveledDistanceInMeters: number;
3674
- } | {
3675
- clockTime: Date;
3496
+ type DistinctSectionsOptions = {
3497
+ /** Leaves out the sections shorter than this. */
3498
+ minLengthInMeters?: number;
3676
3499
  };
3677
3500
  /**
3678
- * All the information of a calculated route, including its summary statistics, sections,
3679
- * guidance instructions and progress data.
3501
+ * The thresholds a stretch of road has to reach to count as a curve.
3502
+ *
3503
+ * @remarks
3504
+ * The defaults keep the bends a passenger feels: from a country road's 40° bend on a radius of 250
3505
+ * metres to a hairpin. Lower `maxRadiusInMeters` to keep only hard curves, such as to warn someone
3506
+ * prone to motion sickness, or raise it to count sweeping bends too.
3680
3507
  *
3681
- * @group Route
3508
+ * @group Utils
3682
3509
  */
3683
- export type RouteProps = {
3510
+ type CurveSectionsOptions = {
3684
3511
  /**
3685
- * The summary statistics of the entire route, with departure and arrival times, total length
3686
- * and duration.
3512
+ * Leaves out the curves turning less than this, either way.
3513
+ * @default 40
3687
3514
  */
3688
- summary: RouteSummary;
3515
+ minHeadingChangeInDegrees?: number;
3689
3516
  /**
3690
- * The route sections, which are portions of the route with distinct properties such as:
3691
- * - Countries traversed
3692
- * - Traffic incidents
3693
- * - Route legs (segments between waypoints)
3694
- * - Special road types (tunnels, ferries, toll roads)
3517
+ * Leaves out the curves wider than this.
3518
+ * @default 250
3695
3519
  */
3696
- sections: SectionsProps;
3520
+ maxRadiusInMeters?: number;
3697
3521
  /**
3698
- * The turn-by-turn navigation instructions, with maneuvers, road names and instruction text.
3522
+ * How far the road may run straight within a curve. A longer straight ends it, so two bends
3523
+ * apart are two curves.
3699
3524
  *
3700
- * They are present only when guidance was requested and is available.
3525
+ * It defaults to 40, or to 15% of a `maxRadiusInMeters` over 267, since a wide curve turns little
3526
+ * over 40 metres.
3701
3527
  */
3702
- guidance?: Guidance;
3528
+ maxStraightInMeters?: number;
3529
+ };
3530
+ /**
3531
+ * How close curves have to follow one another to make a curvy stretch.
3532
+ *
3533
+ * @group Utils
3534
+ */
3535
+ type CurvyStretchSectionsOptions = {
3703
3536
  /**
3704
- * The distance and time progress at key points along the route.
3705
- *
3706
- * It is present when extended route representations are requested, which is the default for route
3707
- * calculations. Use it to display progress information or calculate intermediate times.
3537
+ * The curves to group, in order along the route. Defaults to the route's `sections.curve`, or to
3538
+ * {@link getCurveSections} with its defaults when the route has none.
3708
3539
  */
3709
- progress?: RouteProgressPoint[];
3540
+ curves?: readonly CurveSectionProps[];
3710
3541
  /**
3711
- * The index of this route among the alternatives.
3712
- *
3713
- * The first route (index 0) is typically the recommended or best route, and the rest are alternatives.
3542
+ * The longest gap between two curves of one stretch.
3543
+ * @default 500
3714
3544
  */
3715
- index: number;
3545
+ maxGapInMeters?: number;
3546
+ /**
3547
+ * Leaves out the stretches with fewer curves than this.
3548
+ * @default 3
3549
+ */
3550
+ minCurveCount?: number;
3716
3551
  };
3717
3552
  /**
3718
- * A calculated route, as a GeoJSON Feature.
3719
- *
3720
- * Its geometry is a LineString of the route path coordinates, and its properties hold all
3721
- * route information (summary, sections, guidance).
3553
+ * The thresholds a route's curves and curvy stretches are found with.
3722
3554
  *
3723
- * @typeParam P - Type of the route properties (defaults to RouteProps)
3555
+ * @remarks
3556
+ * `calculateRoute` takes it as `curveDetection`, and {@link withCurveSections} to find them again
3557
+ * on a route you already have.
3724
3558
  *
3725
3559
  * @example
3726
3560
  * ```typescript
3727
- * const route: Route = {
3728
- * type: 'Feature',
3729
- * id: 'route-123',
3730
- * geometry: {
3731
- * type: 'LineString',
3732
- * coordinates: [[4.9, 52.3], [4.91, 52.31], ...]
3733
- * },
3734
- * properties: {
3735
- * summary: { lengthInMeters: 5000, travelTimeInSeconds: 300, ... },
3736
- * sections: { ... },
3737
- * index: 0
3738
- * },
3739
- * bbox: [4.9, 52.3, 4.91, 52.31]
3561
+ * // Only the hard curves, and the stretches of five or more of them
3562
+ * const curveDetection: CurveDetectionOptions = {
3563
+ * curve: { maxRadiusInMeters: 100 },
3564
+ * curvyStretch: { minCurveCount: 5 },
3740
3565
  * };
3741
3566
  * ```
3742
3567
  *
3743
- * @group Route
3568
+ * @group Utils
3744
3569
  */
3745
- export type Route<P extends RouteProps = RouteProps> = Omit<Feature<LineString, P>, 'id' | 'bbox'> & {
3746
- /**
3747
- * The unique identifier of this route, randomly generated to tell route alternatives apart.
3748
- */
3749
- id: string;
3570
+ type CurveDetectionOptions = {
3571
+ /** The thresholds a stretch of road has to reach to count as a curve. */
3572
+ curve?: CurveSectionsOptions;
3573
+ /** How close the curves found have to follow one another to make a curvy stretch. */
3574
+ curvyStretch?: Omit<CurvyStretchSectionsOptions, 'curves'>;
3575
+ };
3576
+ /**
3577
+ * A route's sections of one type within the spans asked about.
3578
+ *
3579
+ * @group Utils
3580
+ */
3581
+ type SectionsWithinOfType<T extends SectionType> = {
3582
+ /** The sections reaching into the spans, whole, in their order on the route. */
3583
+ sections: NonNullable<SectionsProps[T]>;
3750
3584
  /**
3751
- * The bounding box of the entire route, or at least of its waypoints.
3585
+ * Each section's share within the spans, from 0 to 1, in the order of `sections`. Use it to count
3586
+ * only that part of what a section carries, such as a traffic section's delay.
3752
3587
  */
3753
- bbox: BBox;
3588
+ shares: number[];
3589
+ /** How far they run within the spans, together. */
3590
+ lengthInMeters: number;
3754
3591
  };
3755
3592
  /**
3756
- * A GeoJSON FeatureCollection of one or more calculated routes.
3593
+ * A route's sections within the spans asked about, by type: only the types it has there.
3757
3594
  *
3758
- * It typically holds the main route (index 0) and optional alternative routes. Its properties
3759
- * can include metadata about the routing request.
3595
+ * @group Utils
3596
+ */
3597
+ type SectionsWithin = { [T in SectionType]?: SectionsWithinOfType<T>; };
3598
+ /**
3599
+ * Where to look along a route for its sections, and of which types.
3760
3600
  *
3761
- * @typeParam P - Type of individual route properties (defaults to RouteProps)
3762
- * @typeParam FeatureCollectionProps - Type of collection-level properties
3601
+ * @group Utils
3602
+ */
3603
+ type SectionsWithinOptions = {
3604
+ /** Only counts the sections within these spans of the route, which must not overlap. Defaults to the whole route. */
3605
+ within?: readonly RouteSpan[];
3606
+ /** The section types to look for. Defaults to every type. */
3607
+ types?: readonly SectionType[];
3608
+ };
3609
+ /**
3610
+ * How a route differs from a reference route: the stretches each drives alone, and their sections.
3763
3611
  *
3764
- * @example
3765
- * ```typescript
3766
- * const routes: Routes = {
3767
- * type: 'FeatureCollection',
3768
- * features: [
3769
- * { type: 'Feature', geometry: {...}, properties: { index: 0, ... } }, // Main route
3770
- * { type: 'Feature', geometry: {...}, properties: { index: 1, ... } } // Alternative
3771
- * ],
3772
- * properties: {
3773
- * requestId: 'req-456',
3774
- * calculatedAt: new Date()
3775
- * }
3776
- * };
3777
- * ```
3612
+ * @group Utils
3613
+ */
3614
+ type RouteComparison = {
3615
+ /** The stretches only the route drives, of the two. */
3616
+ distinct: DistinctSectionProps[];
3617
+ /** The stretches only the reference drives, of the two. */
3618
+ referenceDistinct: DistinctSectionProps[];
3619
+ /** The route's sections on the stretches only it drives: what it takes on. */
3620
+ adds: SectionsWithin;
3621
+ /** The reference's sections on the stretches only it drives: what the route stays clear of. */
3622
+ avoids: SectionsWithin;
3623
+ };
3624
+ /**
3625
+ * Which sections to weigh when comparing two routes.
3778
3626
  *
3779
- * @group Route
3627
+ * @group Utils
3780
3628
  */
3781
- export type Routes<P extends RouteProps = RouteProps, FeatureCollectionProps = unknown> = Omit<FeatureCollectionWithProperties<LineString, P, FeatureCollectionProps>, 'features' | 'bbox'> & {
3629
+ type CompareRoutesOptions = {
3782
3630
  /**
3783
- * The route features.
3631
+ * The section types to weigh. Defaults to every type `calculateRoute` can return, `curve` and
3632
+ * `curvyStretch` included when the routes carry them, leaving out `leg` and `distinct`.
3784
3633
  */
3785
- features: Route<P>[];
3634
+ types?: readonly SectionType[];
3635
+ };
3636
+ /**
3637
+ * A road a route takes, as its important road stretches name it.
3638
+ *
3639
+ * @remarks
3640
+ * Its `index` is that of its most important stretch: the lower, the more important. Its `streetName`
3641
+ * is the first one its stretches carry.
3642
+ *
3643
+ * @group Utils
3644
+ */
3645
+ type ImportantRoad = Pick<ImportantRoadStretchProps, 'index' | 'streetName'> & {
3646
+ /** What a driver calls it: its first road number, else its street name. Absent when it has neither. */
3647
+ name?: string;
3786
3648
  /**
3787
- * The bounding box of all the routes, or at least of their waypoints. It is defined only if there are routes.
3649
+ * Its road numbers, those of its stretches in turn, each sorted in descending order of display
3650
+ * priority. Empty when it has none.
3788
3651
  */
3789
- bbox?: BBox;
3652
+ roadNumbers: string[];
3653
+ /** How far the route follows it, counting only the parts within the sections asked about. */
3654
+ lengthInMeters: number;
3655
+ /** The route's important road stretch sections on it, in order along the route. */
3656
+ sections: ImportantRoadStretchProps[];
3657
+ };
3658
+ /**
3659
+ * Where to look for important roads along a route, and how much of each to require.
3660
+ *
3661
+ * @group Utils
3662
+ */
3663
+ type ImportantRoadsOptions = Pick<SectionsWithinOptions, 'within'> & {
3664
+ /** Leaves out the roads the route follows for less than this within the spans. */
3665
+ minLengthInMeters?: number;
3790
3666
  };
3791
3667
  //#endregion
3792
3668
  //#region src/types/route/locations.d.ts
@@ -3799,8 +3675,8 @@ type WaypointProps = {
3799
3675
  /**
3800
3676
  * How long the vehicle waits at this stop, in seconds.
3801
3677
  *
3802
- * If you set it, the routing service adds the wait to the leg arriving at this waypoint, and
3803
- * the map shows it on the stop's pin.
3678
+ * If you set it, the routing service plans the wait after the leg arriving at this waypoint and
3679
+ * reports it as that leg's `stopTimeInSeconds`, and the map shows it on the stop's pin.
3804
3680
  *
3805
3681
  * @remarks
3806
3682
  * - The wait counts towards the route's `travelTimeInSeconds`, not only its arrival time.
@@ -3825,7 +3701,8 @@ type WaypointProps = {
3825
3701
  * @typeParam T - Additional custom properties beyond the standard waypoint properties
3826
3702
  *
3827
3703
  * @remarks
3828
- * Every waypoint after the origin ends a route leg and creates an arrival instruction.
3704
+ * Every waypoint after the origin ends a route leg and creates a waypoint instruction, or an
3705
+ * arrival one at the destination.
3829
3706
  *
3830
3707
  * @example
3831
3708
  * ```typescript
@@ -3878,13 +3755,13 @@ type Waypoints<T extends Anything = Anything> = FeatureCollection<Point, Waypoin
3878
3755
  * @example
3879
3756
  * ```typescript
3880
3757
  * // As coordinate array
3881
- * const wp1: WaypointLike = [4.9041, 52.3676];
3758
+ * const coordinates: WaypointLike = [4.9041, 52.3676];
3882
3759
  *
3883
3760
  * // As Point geometry
3884
- * const wp2: WaypointLike = { type: 'Point', coordinates: [4.9041, 52.3676] };
3761
+ * const point: WaypointLike = { type: 'Point', coordinates: [4.9041, 52.3676] };
3885
3762
  *
3886
3763
  * // As full Waypoint Feature carrying custom properties
3887
- * const wp3: WaypointLike = {
3764
+ * const feature: WaypointLike = {
3888
3765
  * type: 'Feature',
3889
3766
  * geometry: { type: 'Point', coordinates: [4.9041, 52.3676] },
3890
3767
  * properties: { name: 'Amsterdam' }
@@ -3971,7 +3848,7 @@ export declare const sdkErrorCodes: readonly ["INVALID_REQUEST", "INSECURE_BASE_
3971
3848
  *
3972
3849
  * | Code | When |
3973
3850
  * | --- | --- |
3974
- * | `INVALID_REQUEST` | The SDK's request validation failed, a service could not build a request sent with `validateRequest: false`, or the API answered `400` or another `4xx` not below |
3851
+ * | `INVALID_REQUEST` | The SDK's request validation failed, a service could not build a request sent with `validateRequest: false`, `discoverPlaces` found no category matching its `poiCategoryQuery`, or the API answered `400` or another `4xx` not below |
3975
3852
  * | `INSECURE_BASE_URL` | `commonBaseURL` is neither `https:` nor `http:` on a loopback address, checked even with `validateRequest: false` |
3976
3853
  * | `INVALID_CREDENTIALS` | The API answered `401`: the key is missing, invalid or expired |
3977
3854
  * | `INSUFFICIENT_PERMISSIONS` | The API answered `403`: the key is valid but not allowed this request, because that API is not enabled for it (a Private Preview API needs its access granted) or its domain restriction refused the page |
@@ -4000,7 +3877,7 @@ export type AreaAnalyticsMetricRange = {
4000
3877
  max: number;
4001
3878
  };
4002
3879
  /**
4003
- * All traffic metric identifiers, ordered consistently across the SDK.
3880
+ * Every {@link AreaAnalyticsMetricKey}, in the order the SDK lists metrics everywhere.
4004
3881
  *
4005
3882
  * @group Traffic
4006
3883
  */
@@ -4165,9 +4042,8 @@ export type AreaAnalyticsTimedEntry = NonNullable<AreaAnalyticsTimedData[keyof A
4165
4042
  * Traffic metrics for a single geographic tile within the analysis region.
4166
4043
  *
4167
4044
  * @remarks
4168
- * All fields are optional, because only the metrics in the requested `metrics` are present.
4169
- * Here, `networkLength` is the total length of road segments **within that tile** (meters),
4170
- * not the region aggregate.
4045
+ * As in {@link AreaAnalyticsMetrics}, only the requested `metrics` are present. Here, `networkLength` is
4046
+ * the total length of road segments **within that tile** (meters), not the region aggregate.
4171
4047
  *
4172
4048
  * @group Traffic
4173
4049
  */
@@ -4203,8 +4079,8 @@ export type AreaAnalyticsAnomaly = {
4203
4079
  */
4204
4080
  export type AreaAnalyticsFeatureProperties = {
4205
4081
  /**
4206
- * Name of the analysis region, which the API echoes from a request that names one. The SDK names none, so it is
4207
- * absent.
4082
+ * Name of the analysis region, which the API echoes from a request that names one. The SDK sends its region
4083
+ * unnamed, so it is absent: the params' `name` names the report, not the region.
4208
4084
  */
4209
4085
  name?: string;
4210
4086
  /**
@@ -4224,7 +4100,7 @@ export type AreaAnalyticsFeatureProperties = {
4224
4100
  */
4225
4101
  timedData: AreaAnalyticsTimedData;
4226
4102
  /**
4227
- * Per-tile traffic metrics for the region, if heatmap data was requested.
4103
+ * Per-tile traffic metrics for the region, present when the response has them, as the collection's `properties.heatmap` tells.
4228
4104
  */
4229
4105
  tiledData?: {
4230
4106
  tiles: AreaAnalyticsTileEntry[];
@@ -4332,16 +4208,10 @@ export type TrafficAreaAnalytics = {
4332
4208
  * - `metric`: International System (SI), used in most of the world (Europe, Asia, Africa,
4333
4209
  * South America, Australia). It uses meters (m) and kilometers (km), decimal-based with no fractions.
4334
4210
  * - `imperial_us`: United States customary units, used in the United States. It uses feet (ft)
4335
- * for short distances (< 0.125 mi), and miles (mi) with fractions (¼, ½, ¾) for longer ones.
4211
+ * for short distances (< 0.125 mi), then miles (mi) to the quarter (¼, ½, ¾) under 3 mi, to the half
4212
+ * under 10 mi and whole from there.
4336
4213
  * - `imperial_uk`: United Kingdom imperial units, used in the United Kingdom. It uses yards (yd)
4337
- * for short distances (< 0.125 mi), and miles (mi) with fractions (¼, ½, ¾) for longer ones.
4338
- *
4339
- * @example
4340
- * ```typescript
4341
- * const system: DistanceUnitsType = 'metric'; // International
4342
- * const usSystem: DistanceUnitsType = 'imperial_us'; // United States
4343
- * const ukSystem: DistanceUnitsType = 'imperial_uk'; // United Kingdom
4344
- * ```
4214
+ * for short distances (< 0.125 mi), then miles (mi) as `imperial_us` gives them.
4345
4215
  *
4346
4216
  * @group Utils
4347
4217
  */
@@ -4351,8 +4221,6 @@ type DistanceUnitsType = 'metric' | 'imperial_us' | 'imperial_uk';
4351
4221
  /**
4352
4222
  * The labels and unit system the SDK uses to display distances.
4353
4223
  *
4354
- * The unit system is metric, US imperial or UK imperial.
4355
- *
4356
4224
  * @group Configuration
4357
4225
  */
4358
4226
  export type DistanceDisplayUnits = {
@@ -4416,8 +4284,6 @@ export type TimeDisplayUnits = {
4416
4284
  /**
4417
4285
  * The display units for time and distance.
4418
4286
  *
4419
- * Formatting utilities and map information displays use them to label durations and distances.
4420
- *
4421
4287
  * @group Configuration
4422
4288
  */
4423
4289
  export type DisplayUnits = {
@@ -4516,11 +4382,6 @@ export type GlobalConfig = {
4516
4382
  * @default ''
4517
4383
  */
4518
4384
  apiKey: string;
4519
- /**
4520
- * An experimental alternative to the API Key which enables oauth2 access to APIs.
4521
- * * If provided, then the API key parameter will be ignored.
4522
- * @experimental
4523
- */
4524
4385
  /**
4525
4386
  * The language of SDK services and map content.
4526
4387
  *
@@ -4546,12 +4407,11 @@ export type GlobalConfig = {
4546
4407
  /**
4547
4408
  * The base URL of every TomTom request, for service calls and the style, tile, sprite and glyph URLs the map fetches.
4548
4409
  *
4549
- * Change it only to route those requests through a proxy of your own. If you also leave `apiKey` unset, the SDK
4550
- * switches to proxy-credentials mode. No key then leaves the browser, and requests carry the proxy's session cookie.
4551
- *
4552
- * It must be absolute and `https:`. The SDK accepts `http:` only for a loopback address (`localhost`, `127.0.0.0/8`,
4553
- * `[::1]`). Otherwise service calls reject, and the map constructor throws, with code `INSECURE_BASE_URL`, even
4554
- * with `validateRequest: false`.
4410
+ * - Change it only to route those requests through a proxy of your own. If you also leave `apiKey` unset, the SDK
4411
+ * switches to proxy-credentials mode: no key leaves the browser, and requests carry the proxy's session cookie.
4412
+ * - It must be absolute and `https:`, or `http:` for a loopback address (`localhost`, `*.localhost`, `127.0.0.0/8`,
4413
+ * `[::1]`). Otherwise service calls reject, and the map constructor throws, with code `INSECURE_BASE_URL`, even
4414
+ * with `validateRequest: false`.
4555
4415
  *
4556
4416
  * @default "https://api.tomtom.com"
4557
4417
  * @see [Proxying your API calls](https://docs.tomtom.com/maps-sdk-js/guides/security/proxying-api-calls)
@@ -4562,7 +4422,7 @@ export type GlobalConfig = {
4562
4422
  *
4563
4423
  * TomTom reads it to tell which SDK versions are in use. Turn it off when that header must not
4564
4424
  * leave the page, or when a proxy of yours should not have to allow it in its CORS preflight answer.
4565
- * A map reads it at construction. Its image requests (sprite sheets, raster tiles) never carry the header.
4425
+ * A map reads it at construction. The images it loads by URL never carry the header; its sprite sheets and tiles do.
4566
4426
  *
4567
4427
  * @default true
4568
4428
  * @see [What the SDK sends](https://docs.tomtom.com/maps-sdk-js/guides/security/what-the-sdk-sends)
@@ -4631,7 +4491,7 @@ export declare class TomTomConfig {
4631
4491
  /**
4632
4492
  * The singleton instance of the configuration.
4633
4493
  */
4634
- static readonly instance: TomTomConfig;
4494
+ static get instance(): TomTomConfig;
4635
4495
  private config;
4636
4496
  private constructor();
4637
4497
  /**
@@ -4679,16 +4539,12 @@ export declare class TomTomConfig {
4679
4539
  /**
4680
4540
  * Whether the SDK is configured for a credentials proxy, such as the demos proxy.
4681
4541
  *
4682
- * That is the case with no `apiKey` and a non-default `commonBaseURL`. The proxy injects
4683
- * the real key server-side from a cookie-gated session.
4684
- *
4685
- * In this mode, SDK requests attach `credentials: 'include'` so the proxy's session cookie
4686
- * travels with them. Otherwise, as with direct TomTom usage or a customer-owned proxy that
4687
- * keeps a real `apiKey`, credentials stay at the browser default. This keeps backends that
4688
- * respond with `Access-Control-Allow-Origin: *` working, since the browser rejects
4689
- * credentialed responses against a wildcard origin.
4542
+ * That is the case with no `apiKey`, `undefined` and `''` alike, and a non-default `commonBaseURL`. The proxy
4543
+ * injects the real key server-side from a cookie-gated session.
4690
4544
  *
4691
- * An `apiKey` of `undefined` counts as unset, as `''` does.
4545
+ * - In this mode, SDK requests attach `credentials: 'include'`, so the proxy's session cookie travels with them.
4546
+ * - Otherwise, credentials stay at the browser default, which keeps backends that answer with
4547
+ * `Access-Control-Allow-Origin: *` working: the browser rejects credentialed responses against a wildcard origin.
4692
4548
  *
4693
4549
  * @param config - The config to inspect, by default the global {@link TomTomConfig}.
4694
4550
  * @group Configuration
@@ -4697,7 +4553,8 @@ export declare const isProxyCredentialsMode: (config?: Partial<Pick<GlobalConfig
4697
4553
  //#endregion
4698
4554
  //#region src/util/bbox.d.ts
4699
4555
  /**
4700
- * Whether the bounding box has both a width and a height. It is `false` for a single point, a line, or `undefined`.
4556
+ * Whether the bounding box has both a width and a height. It is `false` for a single point, a line along a
4557
+ * meridian or a parallel, or `undefined`.
4701
4558
  *
4702
4559
  * @group Utils
4703
4560
  */
@@ -4717,7 +4574,8 @@ export declare const bboxFromBBoxes: (bboxes: OptionalBBox[]) => OptionalBBox;
4717
4574
  * as GeoJSON to {@link bboxFromGeoJSON}, which follows its edges.
4718
4575
  * - It crosses the antimeridian, with `west > east`, when that box is narrower than the one from the
4719
4576
  * lowest to the highest longitude. A tie, or positions spanning -180 to 180, keeps the latter.
4720
- * - A very long array is sampled rather than scanned in full, which keeps the box close to exact.
4577
+ * - Past 1000 positions, the array is sampled rather than scanned in full, so the box can leave out a
4578
+ * position between two samples.
4721
4579
  *
4722
4580
  * @group Utils
4723
4581
  */
@@ -4725,14 +4583,10 @@ export declare const bboxFromCoordsArray: (coordinates: Position[] | undefined)
4725
4583
  /**
4726
4584
  * Extracts or calculates a bounding box from GeoJSON objects.
4727
4585
  *
4728
- * It handles various GeoJSON types, picking the best approach:
4729
- * - It uses an existing `bbox` property, which is fastest.
4730
- * - Otherwise, it calculates one from the geometry coordinates.
4586
+ * - An existing `bbox` property wins over the geometry, as for Point features from TomTom services,
4587
+ * whose bbox may cover a broader area than the point itself.
4588
+ * - Otherwise, it calculates one from the geometry coordinates, sampling large geometries.
4731
4589
  * - It aggregates the boxes of collections.
4732
- * - It samples large geometries for performance.
4733
- *
4734
- * An existing bbox wins over the geometry. This matters for Point features from TomTom
4735
- * services, whose bbox may cover a broader area than the point itself.
4736
4590
  *
4737
4591
  * A calculated box crosses the antimeridian, with `west > east`, when that is the narrower way to
4738
4592
  * enclose the input:
@@ -4752,32 +4606,6 @@ export declare const bboxFromCoordsArray: (coordinates: Position[] | undefined)
4752
4606
  * const bbox = bboxFromGeoJSON(place);
4753
4607
  * // Returns the bbox that came with the place
4754
4608
  *
4755
- * // From a Polygon geometry (calculates bbox)
4756
- * const polygon = {
4757
- * type: 'Polygon',
4758
- * coordinates: [[
4759
- * [4.88, 52.36],
4760
- * [4.90, 52.36],
4761
- * [4.90, 52.38],
4762
- * [4.88, 52.38],
4763
- * [4.88, 52.36]
4764
- * ]]
4765
- * };
4766
- * const polyBbox = bboxFromGeoJSON(polygon);
4767
- * // Returns: [4.88, 52.36, 4.90, 52.38]
4768
- *
4769
- * // From a FeatureCollection (aggregates all features)
4770
- * const places = await discoverPlaces({ query: 'coffee' });
4771
- * const collectionBbox = bboxFromGeoJSON(places);
4772
- * // Returns bbox encompassing all search results
4773
- *
4774
- * // From a LineString (calculates from coordinates)
4775
- * const route = await calculateRoute({
4776
- * locations: [[4.9, 52.3], [4.5, 51.9]]
4777
- * });
4778
- * const routeBbox = bboxFromGeoJSON(route.features[0].geometry);
4779
- * // Returns bbox containing the entire route
4780
- *
4781
4609
  * // From an array of GeoJSON objects
4782
4610
  * const multiBbox = bboxFromGeoJSON([place1, place2, place3]);
4783
4611
  * // Returns bbox encompassing all three places
@@ -4799,8 +4627,6 @@ export declare const bboxCenter: (bbox: BBox) => Position;
4799
4627
  * For a box crossing the antimeridian, with `west > east`, the ring's east edge is `east + 360`, which
4800
4628
  * keeps it around the box rather than around the rest of the world.
4801
4629
  *
4802
- * @param bbox The bounding box as `[west, south, east, north]`.
4803
- *
4804
4630
  * @group Utils
4805
4631
  */
4806
4632
  export declare const polygonFromBBox: (bbox: BBox) => Feature<Polygon>;
@@ -4818,8 +4644,9 @@ export declare const polygonFromBBox: (bbox: BBox) => Feature<Polygon>;
4818
4644
  * @remarks
4819
4645
  * - A grid cell is found from the point's coordinates alone, so the cost grows with the points, not the
4820
4646
  * cells. Every point with a value and finite coordinates lands in a cell, and the cells around the
4821
- * antimeridian stay side by side, their longitudes past ±180 where needed. A grid cell's `id` names
4822
- * its grid, column and row: `'hex:3:-2'`.
4647
+ * antimeridian stay side by side, their longitudes past ±180 where needed. With a `gridOrigin`, the
4648
+ * grid wraps around it instead, so its seam lies 180° from the origin. A grid cell's `id` names its
4649
+ * grid, column and row: `'hex:3:-2'`.
4823
4650
  * - Your own polygons are tested point by point, after a bounding-box check. A point inside several of
4824
4651
  * them counts in each.
4825
4652
  * - The cell size is fixed. To follow the zoom, aggregate again on the map's `zoomend` with a size for
@@ -4855,9 +4682,9 @@ export declare const aggregateIntoCells: <P extends GeoJsonProperties, const S e
4855
4682
  * them again with others.
4856
4683
  * - A curve ends at a straight longer than `maxStraightInMeters`, or where the road turns the
4857
4684
  * other way, so an S-bend is two curves.
4858
- * - A sharp corner between two straights, as at most junctions, is no curve: the road doesn't bend
4859
- * there. A roundabout is, and on a route with guidance a curve at a junction names its
4860
- * `maneuver`, as {@link CurveSectionProps} sets out.
4685
+ * - A corner on a single vertex between two long straights is no curve: the road doesn't bend
4686
+ * there. A junction corner drawn round its kerb is one, and so is a roundabout. On a route with
4687
+ * guidance, a curve at a junction names its `maneuver`, as {@link CurveSectionProps} sets out.
4861
4688
  * - Where a route turns back at a waypoint, as at the end of a dead-end road, it makes no curve.
4862
4689
  * - Each curve's `severity` reads the route's `speedLimit` sections, when it has them.
4863
4690
  *
@@ -4960,8 +4787,10 @@ export declare const withCurveSections: (route: Route, { curve, curvyStretch }?:
4960
4787
  * @remarks
4961
4788
  * `calculateRoute` already fills `sections.distinct` with every distinct section when it returns two
4962
4789
  * or more routes. Call this to compare routes from separate calculations, or to keep only the
4963
- * sections worth naming. Routes match on a road where they carry the same coordinates along it, as
4964
- * the routes of one response do; routes from separate calculations may not.
4790
+ * sections worth naming.
4791
+ *
4792
+ * Routes match on a road where they carry the same coordinates along it, as the routes of one
4793
+ * response do; routes from separate calculations may not.
4965
4794
  *
4966
4795
  * @example
4967
4796
  * ```typescript
@@ -4976,7 +4805,7 @@ export declare const getDistinctSections: (routes: Routes | Route[], { minLength
4976
4805
  //#endregion
4977
4806
  //#region src/util/generateId.d.ts
4978
4807
  /**
4979
- * Generate random id for map features
4808
+ * A random id, distinct on every call, for features and sections.
4980
4809
  * @ignore
4981
4810
  */
4982
4811
  export declare const generateId: () => string;
@@ -5003,7 +4832,7 @@ export declare const servesGeopoliticalView: (view: GeopoliticalView, api: Geopo
5003
4832
  //#endregion
5004
4833
  //#region src/util/headers.d.ts
5005
4834
  /**
5006
- * SDK name used TomTom custom header tomtom-user-agent
4835
+ * The SDK name the `tomtom-user-agent` header starts with.
5007
4836
  * @ignore
5008
4837
  */
5009
4838
  export declare const TOMTOM_USER_AGENT_SDK_NAME = "MapsSDKJS";
@@ -5047,8 +4876,9 @@ export declare const getImportantRoads: (route: Route, { within, minLengthInMete
5047
4876
  * @remarks
5048
4877
  * `calculateRoute` returns `lanes` sections only with `guidance`, and not every maneuver has one.
5049
4878
  *
5050
- * A section leads to the last instruction inside it or, when it ends at a stop line short of the
5051
- * junction, to the next one after it. Where several lead to one instruction, the closest wins.
4879
+ * A section leads to the last instruction at a junction inside it or, when it ends at a stop line
4880
+ * short of the junction, to the next one after it. A maneuver at no junction, such as a departure, a
4881
+ * waypoint, an arrival, a border or a tollgate, has no lanes. Where several lead to one instruction, the closest wins.
5052
4882
  * Instructions sharing a point, such as a roundabout's entry and exit, leave the lanes to the first.
5053
4883
  *
5054
4884
  * @param route - The route the instruction belongs to.
@@ -5073,37 +4903,18 @@ export declare const getInstructionLanes: (route: Route, instruction: Pick<Instr
5073
4903
  /**
5074
4904
  * Extracts the lng-lat position from various input formats.
5075
4905
  *
5076
- * It normalizes the input to a standard GeoJSON Position, a lng-lat coordinate array.
5077
4906
  * It accepts:
5078
4907
  * - Raw coordinate arrays `[lng, lat]`
5079
4908
  * - GeoJSON Point geometries
5080
4909
  * - GeoJSON Point Features, including Places with entry points
5081
4910
  *
5082
- * With `main-when-available`, a place with no entry point typed `'main'` uses its first untyped one, as
5083
- * reverse geocoding returns them. {@link GetPositionEntryPointOption} has the full rule.
4911
+ * With `main-when-available`, a place's entry point wins over its geometry, as
4912
+ * {@link GetPositionEntryPointOption} sets out.
5084
4913
  *
5085
- * @param hasLngLat An object that is or contains a lng-lat position.
5086
- * @param options How to extract the position.
5087
4914
  * @returns The extracted position as `[longitude, latitude]`, or `null` if the input is invalid.
5088
4915
  *
5089
4916
  * @example
5090
4917
  * ```typescript
5091
- * // From coordinate array
5092
- * getPosition([4.9, 52.3]); // Returns: [4.9, 52.3]
5093
- *
5094
- * // From Point geometry
5095
- * getPosition({
5096
- * type: 'Point',
5097
- * coordinates: [4.9, 52.3]
5098
- * }); // Returns: [4.9, 52.3]
5099
- *
5100
- * // From Point Feature
5101
- * getPosition({
5102
- * type: 'Feature',
5103
- * geometry: { type: 'Point', coordinates: [4.9, 52.3] },
5104
- * properties: {}
5105
- * }); // Returns: [4.9, 52.3]
5106
- *
5107
4918
  * // From Place with entry point
5108
4919
  * const place = {
5109
4920
  * type: 'Feature',
@@ -5116,15 +4927,22 @@ export declare const getInstructionLanes: (route: Route, instruction: Pick<Instr
5116
4927
  * };
5117
4928
  * getPosition(place, { useEntryPoint: 'main-when-available' });
5118
4929
  * // Returns: [4.901, 52.301] (entry point instead of geometry)
5119
- *
5120
- * // Invalid input
5121
- * getPosition(undefined); // Returns: null
5122
4930
  * ```
5123
4931
  *
5124
4932
  * @group Utils
5125
4933
  */
5126
4934
  export declare const getPosition: (hasLngLat: HasLngLat | undefined, options?: GetPositionOptions) => Position | null;
5127
4935
  //#endregion
4936
+ //#region src/util/polygon.d.ts
4937
+ /**
4938
+ * A point strictly inside a polygon, given as its rings of `[x, y]` points, the outer ring first: the
4939
+ * middle of the widest stretch inside it along a line near halfway up its extent, holes left out. The line
4940
+ * runs between two heights of its points, so it never runs along an edge. Unlike the middle of its extent,
4941
+ * which an L-shaped polygon can leave, or one of its corners, which a neighbouring polygon can share.
4942
+ * @ignore
4943
+ */
4944
+ export declare const pointInsidePolygon: (rings: readonly (readonly Position[])[]) => Position;
4945
+ //#endregion
5128
4946
  //#region src/util/route.d.ts
5129
4947
  /**
5130
4948
  * Finds the best index to insert a new waypoint into an existing route.
@@ -5140,26 +4958,11 @@ export declare const getPosition: (hasLngLat: HasLngLat | undefined, options?: G
5140
4958
  *
5141
4959
  * @remarks
5142
4960
  * - If the route has fewer than 2 coordinates or there are fewer than 2 existing waypoints, it returns 0.
5143
- * - Fitting the waypoint along the route's progression minimizes detours, which keeps the route streamlined.
5144
4961
  *
5145
4962
  * @example
5146
4963
  * ```typescript
5147
- * const route: Route = {
5148
- * type: 'Feature',
5149
- * id: 'route-1',
5150
- * geometry: {
5151
- * type: 'LineString',
5152
- * coordinates: [[4.9, 52.3], [4.95, 52.35], [5.0, 52.4]]
5153
- * },
5154
- * properties: { ... },
5155
- * bbox: [4.9, 52.3, 5.0, 52.4]
5156
- * };
5157
- *
5158
- * const waypoints: WaypointLike[] = [
5159
- * [4.9, 52.3], // origin
5160
- * [5.0, 52.4] // destination
5161
- * ];
5162
- *
4964
+ * // A route from [4.9, 52.3] to [5.0, 52.4], through [4.95, 52.35]
4965
+ * const waypoints: WaypointLike[] = [[4.9, 52.3], [5.0, 52.4]];
5163
4966
  * const newWaypoint: WaypointLike = [4.95, 52.35];
5164
4967
  *
5165
4968
  * const insertIndex = findBestWaypointInsertionIndex(route, waypoints, newWaypoint);
@@ -5178,13 +4981,8 @@ export declare const findBestWaypointInsertionIndex: (route: Route, existingWayp
5178
4981
  /**
5179
4982
  * The multi-waypoint variant of {@link findBestWaypointInsertionIndex}.
5180
4983
  *
5181
- * It projects every existing and new waypoint onto the route exactly once, then returns one
5182
- * insertion slot per new waypoint. The i-th index is the slot in `existingWaypoints` where the
5183
- * i-th new waypoint falls by its along-route location. Slot 0 is before the origin, and slot
5184
- * `existingWaypoints.length` is after the destination.
5185
- *
5186
- * Several new waypoints may share a slot. To also merge them into the existing array in
5187
- * along-route order, use {@link withInsertedWaypoints}, which ranks them within each slot.
4984
+ * It projects every existing and new waypoint onto the route once, and gives each new waypoint
4985
+ * the slot in `existingWaypoints` it falls in by its along-route location.
5188
4986
  *
5189
4987
  * @param route The existing calculated route, a Feature with LineString geometry.
5190
4988
  * @param existingWaypoints The existing waypoints in order, from origin through intermediate waypoints to destination.
@@ -5192,6 +4990,8 @@ export declare const findBestWaypointInsertionIndex: (route: Route, existingWayp
5192
4990
  * @returns The insertion slot indices, one per new waypoint, in input order.
5193
4991
  *
5194
4992
  * @remarks
4993
+ * - Several new waypoints may share a slot. To merge them into the existing array in along-route
4994
+ * order too, use {@link withInsertedWaypoints}, which ranks them within each slot.
5195
4995
  * - An empty `newWaypoints` returns an empty array.
5196
4996
  * - If the route has fewer than 2 coordinates or there are fewer than 2 existing waypoints, every
5197
4997
  * new waypoint gets `0`, so they would all prepend.
@@ -5212,30 +5012,13 @@ export declare const findBestWaypointInsertionIndices: (route: Route, existingWa
5212
5012
  *
5213
5013
  * @remarks
5214
5014
  * - It returns a new array and leaves the original waypoints array unmodified.
5215
- * - It places the waypoint with the same logic as findBestWaypointInsertionIndex.
5216
- * - It handles all edge cases, such as an empty route or fewer than 2 waypoints.
5015
+ * - It places the waypoint with the same logic as findBestWaypointInsertionIndex, which says what it
5016
+ * does with a route of fewer than 2 coordinates or fewer than 2 waypoints.
5217
5017
  *
5218
5018
  * @example
5219
5019
  * ```typescript
5220
- * const route: Route = {
5221
- * type: 'Feature',
5222
- * id: 'route-1',
5223
- * geometry: {
5224
- * type: 'LineString',
5225
- * coordinates: [[4.9, 52.3], [4.95, 52.35], [5.0, 52.4]]
5226
- * },
5227
- * properties: { ... },
5228
- * bbox: [4.9, 52.3, 5.0, 52.4]
5229
- * };
5230
- *
5231
- * const waypoints: WaypointLike[] = [
5232
- * [4.9, 52.3], // origin
5233
- * [5.0, 52.4] // destination
5234
- * ];
5235
- *
5236
- * const newWaypoint: WaypointLike = [4.95, 52.35];
5237
- *
5238
- * const updatedWaypoints = withInsertedWaypoint(route, waypoints, newWaypoint);
5020
+ * // A route from [4.9, 52.3] to [5.0, 52.4], through [4.95, 52.35]
5021
+ * const updatedWaypoints = withInsertedWaypoint(route, [[4.9, 52.3], [5.0, 52.4]], [4.95, 52.35]);
5239
5022
  * // Returns: [[4.9, 52.3], [4.95, 52.35], [5.0, 52.4]]
5240
5023
  * ```
5241
5024
  *
@@ -5245,21 +5028,16 @@ export declare const withInsertedWaypoint: (route: Route, existingWaypoints: Way
5245
5028
  /**
5246
5029
  * Returns a new array of waypoints with each new waypoint inserted at its optimal position.
5247
5030
  *
5248
- * The multi-waypoint variant of {@link withInsertedWaypoint}. Unlike one-at-a-time insertion,
5249
- * it projects every existing and new waypoint onto the route exactly once, then merges them:
5250
- *
5251
- * 1. It computes each new waypoint's insertion slot with {@link findBestWaypointInsertionIndices}.
5252
- * 2. It ranks the new waypoints within each slot by along-route location. Waypoints that
5253
- * project to the same location keep their input order.
5254
- *
5255
- * The result holds the existing waypoints with the new ones spliced in at the right positions,
5256
- * in along-route order, whatever the input order.
5031
+ * The multi-waypoint variant of {@link withInsertedWaypoint}: it takes each new waypoint's slot from
5032
+ * {@link findBestWaypointInsertionIndices}, and splices the new waypoints in along-route order,
5033
+ * whatever their input order.
5257
5034
  *
5258
5035
  * @param route The existing calculated route, a Feature with LineString geometry.
5259
5036
  * @param existingWaypoints The existing waypoints in order, from origin through intermediate waypoints to destination.
5260
5037
  * @returns A new array with the waypoints inserted at their optimal positions.
5261
5038
  *
5262
5039
  * @remarks
5040
+ * - Waypoints that project to the same location keep their input order.
5263
5041
  * - It returns a new array and leaves `existingWaypoints` unmodified.
5264
5042
  * - Passing an empty `newWaypoints` array returns a shallow copy of `existingWaypoints`.
5265
5043
  * - When the route has fewer than 2 coordinates or there are fewer than 2 existing waypoints, all
@@ -5291,7 +5069,7 @@ export declare const withInsertedWaypoints: (route: Route, existingWaypoints: Wa
5291
5069
  * @param pathIndex Zero-based index into the route's coordinate array.
5292
5070
  * @returns The interpolated {@link RouteProgressAtPoint}, or `undefined` when:
5293
5071
  * - the route has no `progress` data
5294
- * - `pathIndex` is outside `[0, coordinates.length - 1]`
5072
+ * - `pathIndex` is not an integer, or is outside `[0, coordinates.length - 1]`
5295
5073
  * - `pathIndex` falls outside the range covered by the progress entries
5296
5074
  * - any required distance or time value is missing from the bracketing entries
5297
5075
  *
@@ -5476,8 +5254,9 @@ export declare const getProgressAtNearestRoutePoint: (route: Route, point: HasLn
5476
5254
  * @returns The types the route has within the spans, each with its sections there and their length.
5477
5255
  *
5478
5256
  * @remarks
5479
- * - A section counts when it shares a segment with a span, as {@link getSectionOverlap} finds, and
5480
- * only its part within the spans adds to `lengthInMeters`. Its `shares` entry says how much of it
5257
+ * - A section counts when some of its length lies within the spans, so a segment of no length
5258
+ * shared with one, which {@link getSectionOverlap} still finds, doesn't count. Only its part
5259
+ * within the spans adds to `lengthInMeters`. Its `shares` entry says how much of it
5481
5260
  * that part is, to prorate a traffic section's `delayInSeconds`, for example.
5482
5261
  * - The sections come back whole, so their ids suit `RoutingModule.setSectionFocus` on the routes shown.
5483
5262
  * - Pass `sections.distinct` as `within` for what sets a route apart from its alternatives.
@@ -5603,6 +5382,8 @@ export declare function formatDuration(seconds: number, options?: TimeDisplayUni
5603
5382
  export declare function formatDuration(seconds: number | undefined, options?: TimeDisplayUnits): string | undefined;
5604
5383
  /**
5605
5384
  * Formats a distance in meters for display, by unit type. Fewer meters give more precision.
5385
+ *
5386
+ * To override the default units, use `options` or the global {@link TomTomConfig}.
5606
5387
  * @example
5607
5388
  * ```ts
5608
5389
  * const metric = { type: 'metric' } as const;
@@ -5637,4 +5418,4 @@ export declare function formatDuration(seconds: number | undefined, options?: Ti
5637
5418
  */
5638
5419
  export declare const formatDistance: (meters: number | undefined, options?: DistanceDisplayUnits) => string;
5639
5420
  //#endregion
5640
- export type { AggregateIntoCellsOptions, AggregatedCells, Anything, BBox, CellGrid, CellGridOptions, CellGridShape, CellStatistic, CellStatistics, CellValue, CellValueOptions, ChargingPark, CompareRoutesOptions, CurveDetectionOptions, CurveSectionsOptions, CurvyStretchSectionsOptions, DistanceUnitsType, DistinctSectionsOptions, DrivingSide, FeatureCollectionWithProperties, Fuel, GeometryDataSource, GetPositionEntryPointOption, GetPositionOptions, Guidance, HasBBox, HasLngLat, ImportantRoad, ImportantRoadsOptions, Instruction, InstructionText, Landmark, LatticeGridOptions, LegSummary, Maneuver, ManeuverAngle, ManeuverView, Moment, NumericPropertyKey, OpeningHours, OpeningHoursMode, OptionalBBox, POI, PathLike, PlaceDataSources, PoiDetailsDataSource, PolygonFeature, PolygonFeatures, RelatedPOI, RoadInformation, RoadInformationProperty, RoadShield, RoadShieldReference, RoundaboutType, RouteComparison, RoutePathPoint, RoutePlanningLocation, RoutePlanningLocationType, RouteSummary, SectionsWithin, SectionsWithinOfType, SectionsWithinOptions, SideRoad, SideRoadSide, Signpost, SummaryBase, TimeRange, TimeZone, TollPaymentType, TomTomAPIHeaders, Waypoint, WaypointLike, WaypointProps, Waypoints };
5421
+ export type { APIErrorDetails, AggregateIntoCellsOptions, AggregatedCells, Anything, BBox, CellGrid, CellGridOptions, CellGridShape, CellStatistic, CellStatistics, CellValue, CellValueOptions, ChargingPark, CompareRoutesOptions, CurveDetectionOptions, CurveSectionsOptions, CurvyStretchSectionsOptions, DistanceUnitsType, DistinctSectionsOptions, DrivingSide, FeatureCollectionWithProperties, Fuel, GeometryDataSource, GetPositionEntryPointOption, GetPositionOptions, Guidance, HasBBox, HasLngLat, ImportantRoad, ImportantRoadsOptions, Instruction, InstructionText, Landmark, LatticeGridOptions, LegSummary, Maneuver, ManeuverAngle, ManeuverView, Moment, NumericPropertyKey, OpeningHours, OpeningHoursMode, OptionalBBox, POI, PathLike, PlaceDataSources, PoiDetailsDataSource, PolygonFeature, PolygonFeatures, PrivatePreviewAccess, RelatedPOI, RoadInformation, RoadInformationProperty, RoadShield, RoadShieldReference, RoundaboutType, RouteComparison, RoutePathPoint, RoutePlanningLocation, RoutePlanningLocationType, RouteSummary, SectionsWithin, SectionsWithinOfType, SectionsWithinOptions, SideRoad, SideRoadSide, Signpost, SummaryBase, TimeRange, TimeZone, TollPaymentType, TomTomAPIHeaders, Waypoint, WaypointLike, WaypointProps, Waypoints };