@tomtom-org/maps-sdk 1.0.0-rc.4 → 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.
- package/CHANGELOG.md +112 -0
- package/README.md +4 -4
- package/core/dist/core.es.js +1 -1
- package/core/dist/index.d.ts +774 -981
- package/map/dist/index.d.ts +1115 -569
- package/map/dist/map.es.js +5 -3
- package/package.json +2 -1
- package/services/dist/index.d.ts +128 -210
- package/services/dist/services.es.js +1 -1
package/core/dist/index.d.ts
CHANGED
|
@@ -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
|
|
354
|
+
* const pair: HasLngLat = [4.9041, 52.3676];
|
|
326
355
|
*
|
|
327
356
|
* // GeoJSON Point geometry
|
|
328
|
-
* const
|
|
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
|
|
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<
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
-
* @
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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)
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1446
|
-
* const
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
1987
|
-
*
|
|
1988
|
-
*
|
|
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
|
|
1999
|
-
*
|
|
2000
|
-
*
|
|
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
|
|
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,144 +2109,536 @@ export type TrafficIncident = Feature<Point | LineString, TrafficIncidentPropert
|
|
|
2184
2109
|
*
|
|
2185
2110
|
* @group Traffic
|
|
2186
2111
|
*/
|
|
2187
|
-
export type TrafficIncidentDetails = FeatureCollection<
|
|
2112
|
+
export type TrafficIncidentDetails = FeatureCollection<TrafficIncident['geometry'], TrafficIncident['properties']>;
|
|
2188
2113
|
//#endregion
|
|
2189
|
-
//#region src/types/route/
|
|
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
|
-
*
|
|
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
|
|
2119
|
+
type SummaryBase = {
|
|
2243
2120
|
/**
|
|
2244
|
-
* The
|
|
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
|
-
|
|
2125
|
+
arrivalTime: Date;
|
|
2247
2126
|
/**
|
|
2248
|
-
* The
|
|
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
|
-
|
|
2134
|
+
lengthInMeters: number;
|
|
2251
2135
|
/**
|
|
2252
|
-
* The
|
|
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
|
|
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
|
-
|
|
2266
|
-
};
|
|
2267
|
-
/**
|
|
2268
|
-
* A single road shield reference.
|
|
2269
|
-
* @group Route
|
|
2270
|
-
*/
|
|
2271
|
-
type RoadShieldReference = {
|
|
2154
|
+
trafficDelayInSeconds?: number;
|
|
2272
2155
|
/**
|
|
2273
|
-
*
|
|
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
|
-
|
|
2162
|
+
trafficLengthInMeters?: number;
|
|
2276
2163
|
/**
|
|
2277
|
-
* The
|
|
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
|
-
|
|
2169
|
+
noTrafficTravelTimeInSeconds?: number;
|
|
2280
2170
|
/**
|
|
2281
|
-
* The
|
|
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
|
-
|
|
2284
|
-
};
|
|
2285
|
-
/**
|
|
2286
|
-
* A road shield, with extra information.
|
|
2287
|
-
* @group Route
|
|
2288
|
-
*/
|
|
2289
|
-
type RoadShield = {
|
|
2177
|
+
historicTrafficTravelTimeInSeconds?: number;
|
|
2290
2178
|
/**
|
|
2291
|
-
* The
|
|
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
|
-
|
|
2184
|
+
liveTrafficIncidentsTravelTimeInSeconds?: number;
|
|
2294
2185
|
/**
|
|
2295
|
-
*
|
|
2296
|
-
*
|
|
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
|
-
|
|
2192
|
+
deviationDistanceInMeters?: number;
|
|
2299
2193
|
/**
|
|
2300
|
-
* The
|
|
2301
|
-
*
|
|
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
|
-
|
|
2200
|
+
deviationTimeInSeconds?: number;
|
|
2304
2201
|
/**
|
|
2305
|
-
* The
|
|
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
|
-
|
|
2208
|
+
deviationPoint?: Position;
|
|
2308
2209
|
};
|
|
2309
2210
|
/**
|
|
2310
|
-
*
|
|
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
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2216
|
+
type RouteSummary = SummaryBase;
|
|
2217
|
+
/**
|
|
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
|
+
*
|
|
2224
|
+
* @group Route
|
|
2225
|
+
*/
|
|
2226
|
+
type LegSummary = SummaryBase & {
|
|
2227
|
+
/**
|
|
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
|
+
* ```
|
|
2247
|
+
*/
|
|
2248
|
+
stopTimeInSeconds?: number;
|
|
2249
|
+
};
|
|
2250
|
+
//#endregion
|
|
2251
|
+
//#region src/types/route/route.d.ts
|
|
2252
|
+
/**
|
|
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
|
+
*
|
|
2272
|
+
* @group Route
|
|
2273
|
+
*/
|
|
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 = {
|
|
2327
|
+
/**
|
|
2328
|
+
* Cumulative travel time in seconds from the route start.
|
|
2329
|
+
*/
|
|
2330
|
+
travelTimeInSeconds?: number;
|
|
2331
|
+
/**
|
|
2332
|
+
* Cumulative distance in meters from the route start.
|
|
2333
|
+
*/
|
|
2334
|
+
distanceInMeters?: number;
|
|
2335
|
+
};
|
|
2336
|
+
/**
|
|
2337
|
+
* The progress at a specific coordinate on the route path.
|
|
2338
|
+
*
|
|
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.
|
|
2345
|
+
*
|
|
2346
|
+
* @example
|
|
2347
|
+
* ```typescript
|
|
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
|
+
* ];
|
|
2353
|
+
* ```
|
|
2354
|
+
*
|
|
2355
|
+
* @group Route
|
|
2356
|
+
*/
|
|
2357
|
+
export type RouteProgressPoint = RouteProgress & {
|
|
2358
|
+
/**
|
|
2359
|
+
* Zero-based index of this point in the route's coordinate array.
|
|
2360
|
+
*/
|
|
2361
|
+
pointIndex: number;
|
|
2362
|
+
};
|
|
2363
|
+
/**
|
|
2364
|
+
* A distance and a time along the route, both known.
|
|
2365
|
+
*
|
|
2366
|
+
* @group Route
|
|
2367
|
+
*/
|
|
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 = {
|
|
2411
|
+
/**
|
|
2412
|
+
* The summary statistics of the entire route, with departure and arrival times, total length
|
|
2413
|
+
* and duration.
|
|
2414
|
+
*/
|
|
2415
|
+
summary: RouteSummary;
|
|
2416
|
+
/**
|
|
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)
|
|
2422
|
+
*/
|
|
2423
|
+
sections: SectionsProps;
|
|
2424
|
+
/**
|
|
2425
|
+
* The turn-by-turn navigation instructions, with maneuvers, road names and instruction text.
|
|
2426
|
+
*
|
|
2427
|
+
* They are present only when guidance was requested and is available.
|
|
2428
|
+
*/
|
|
2429
|
+
guidance?: Guidance;
|
|
2430
|
+
/**
|
|
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.
|
|
2435
|
+
*/
|
|
2436
|
+
progress?: RouteProgressPoint[];
|
|
2437
|
+
/**
|
|
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.
|
|
2441
|
+
*/
|
|
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'> & {
|
|
2473
|
+
/**
|
|
2474
|
+
* The unique identifier of this route, randomly generated to tell route alternatives apart.
|
|
2475
|
+
*/
|
|
2476
|
+
id: string;
|
|
2477
|
+
/**
|
|
2478
|
+
* The bounding box of the entire route, or at least of its waypoints.
|
|
2479
|
+
*/
|
|
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'> & {
|
|
2505
|
+
/**
|
|
2506
|
+
* The route features.
|
|
2507
|
+
*/
|
|
2508
|
+
features: Route<P>[];
|
|
2509
|
+
/**
|
|
2510
|
+
* The bounding box of all the routes, or at least of their waypoints. It is defined only if there are routes.
|
|
2511
|
+
*/
|
|
2512
|
+
bbox?: BBox;
|
|
2513
|
+
};
|
|
2514
|
+
//#endregion
|
|
2515
|
+
//#region src/types/route/guidance.d.ts
|
|
2516
|
+
/**
|
|
2517
|
+
* Whether traffic drives on the left or right at the point of the maneuver.
|
|
2518
|
+
* @group Route
|
|
2519
|
+
*/
|
|
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 & {
|
|
2569
|
+
/**
|
|
2570
|
+
* The position of this point on the route.
|
|
2571
|
+
*/
|
|
2572
|
+
point: Position;
|
|
2573
|
+
};
|
|
2574
|
+
/**
|
|
2575
|
+
* The name of a street, road number, exit, intersection, tollgate or country in a guidance
|
|
2576
|
+
* instruction.
|
|
2577
|
+
* @group Route
|
|
2578
|
+
*/
|
|
2579
|
+
type InstructionText = {
|
|
2580
|
+
/**
|
|
2581
|
+
* The name as a text string.
|
|
2582
|
+
*/
|
|
2583
|
+
text: string;
|
|
2584
|
+
};
|
|
2585
|
+
/**
|
|
2586
|
+
* A single road shield reference.
|
|
2587
|
+
* @group Route
|
|
2588
|
+
*/
|
|
2589
|
+
type RoadShieldReference = {
|
|
2590
|
+
/**
|
|
2591
|
+
* A unique identifier for the road shield.
|
|
2592
|
+
*/
|
|
2593
|
+
reference: string;
|
|
2594
|
+
/**
|
|
2595
|
+
* The text to show on the road shield.
|
|
2596
|
+
*/
|
|
2597
|
+
shieldContent?: string;
|
|
2598
|
+
/**
|
|
2599
|
+
* The possible affixes to show in addition to the `shieldContent`.
|
|
2600
|
+
*/
|
|
2601
|
+
affixes?: string[];
|
|
2602
|
+
};
|
|
2603
|
+
/**
|
|
2604
|
+
* A road shield, with extra information.
|
|
2605
|
+
* @group Route
|
|
2606
|
+
*/
|
|
2607
|
+
type RoadShield = {
|
|
2608
|
+
/**
|
|
2609
|
+
* The road number. Most road numbers have a 'letter' prefix, which is also returned.
|
|
2610
|
+
*/
|
|
2611
|
+
roadNumber: InstructionText;
|
|
2612
|
+
/**
|
|
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.
|
|
2615
|
+
*/
|
|
2616
|
+
roadShieldReference?: RoadShieldReference;
|
|
2617
|
+
/**
|
|
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.
|
|
2620
|
+
*/
|
|
2621
|
+
stateCode?: string;
|
|
2622
|
+
/**
|
|
2623
|
+
* The country code (ISO 3166-1 alpha-3) of the country the shield is in.
|
|
2624
|
+
*/
|
|
2625
|
+
countryCode: string;
|
|
2626
|
+
};
|
|
2627
|
+
/**
|
|
2628
|
+
* Road information, including properties, street name and road shields.
|
|
2629
|
+
* @group Route
|
|
2630
|
+
*/
|
|
2631
|
+
type RoadInformation = {
|
|
2632
|
+
/**
|
|
2633
|
+
* The properties of the road, possibly several combined.
|
|
2634
|
+
*/
|
|
2635
|
+
properties: RoadInformationProperty[];
|
|
2318
2636
|
/**
|
|
2319
2637
|
* The street name of the road, if available.
|
|
2320
2638
|
*/
|
|
2321
2639
|
streetName?: InstructionText;
|
|
2322
2640
|
/**
|
|
2323
|
-
* The road shields of this road.
|
|
2324
|
-
* The list can be empty if none are available.
|
|
2641
|
+
* The road shields of this road, absent when it has none.
|
|
2325
2642
|
*/
|
|
2326
2643
|
roadShields?: RoadShield[];
|
|
2327
2644
|
/**
|
|
@@ -2463,10 +2780,11 @@ type Instruction = {
|
|
|
2463
2780
|
trafficLightOffsetInMeters?: number;
|
|
2464
2781
|
/**
|
|
2465
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.
|
|
2466
|
-
*
|
|
2467
|
-
*
|
|
2468
|
-
*
|
|
2469
|
-
*
|
|
2783
|
+
*
|
|
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.
|
|
2470
2788
|
*/
|
|
2471
2789
|
sideRoads?: SideRoad[];
|
|
2472
2790
|
/**
|
|
@@ -2521,6 +2839,7 @@ type Instruction = {
|
|
|
2521
2839
|
* The offset on the route, in meters, of an ambiguous exit from the maneuver point (`maneuverPoint`).
|
|
2522
2840
|
* It is present if this maneuver is an exit and another exit within a reasonable distance before it may cause ambiguity.
|
|
2523
2841
|
* The client might then need to resolve the ambiguity and compose an instruction such as "Take the 2nd exit".
|
|
2842
|
+
*
|
|
2524
2843
|
* The offset is absolute, so it is a positive integer even though the ambiguous exit is before the maneuver on the route.
|
|
2525
2844
|
* It applies to maneuvers that are one of:
|
|
2526
2845
|
* - EXIT_ROUNDABOUT
|
|
@@ -2532,15 +2851,7 @@ type Instruction = {
|
|
|
2532
2851
|
offsetOfAmbiguousExitFromManeuverInMeters?: number;
|
|
2533
2852
|
/**
|
|
2534
2853
|
* 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
|
|
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
|
|
2854
|
+
* It is present if the maneuver is one of the `ROUNDABOUT_*` ones {@link Instruction.changeOfAngleInDegrees} lists.
|
|
2544
2855
|
*/
|
|
2545
2856
|
roundaboutExitNumber?: number;
|
|
2546
2857
|
/**
|
|
@@ -2575,179 +2886,29 @@ type Instruction = {
|
|
|
2575
2886
|
countryCrossingFromName?: InstructionText;
|
|
2576
2887
|
/**
|
|
2577
2888
|
* The code (ISO 3166-1 alpha-3) of the country the border crossing occurs from.
|
|
2578
|
-
* It is present
|
|
2579
|
-
* - CROSS_BORDER
|
|
2580
|
-
* - TAKE_SHIP_FERRY
|
|
2581
|
-
* - TAKE_CAR_TRAIN
|
|
2582
|
-
* - LEAVE_SHIP_FERRY
|
|
2583
|
-
* - LEAVE_CAR_TRAIN
|
|
2889
|
+
* It is present on the maneuvers {@link Instruction.countryCrossingFromName} lists.
|
|
2584
2890
|
*/
|
|
2585
2891
|
countryCrossingFromCode?: string;
|
|
2586
2892
|
/**
|
|
2587
2893
|
* The name of the country the border crossing occurs to.
|
|
2588
|
-
* It is present
|
|
2589
|
-
* - CROSS_BORDER
|
|
2590
|
-
* - TAKE_SHIP_FERRY
|
|
2591
|
-
* - TAKE_CAR_TRAIN
|
|
2592
|
-
* - LEAVE_SHIP_FERRY
|
|
2593
|
-
* - LEAVE_CAR_TRAIN
|
|
2594
|
-
*/
|
|
2595
|
-
countryCrossingToName?: InstructionText;
|
|
2596
|
-
/**
|
|
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
|
|
2604
|
-
*/
|
|
2605
|
-
countryCrossingToCode?: string;
|
|
2606
|
-
};
|
|
2607
|
-
/**
|
|
2608
|
-
* The guidance elements of a route, present only when guidance was requested and is available.
|
|
2609
|
-
* @group Route
|
|
2610
|
-
*/
|
|
2611
|
-
type Guidance = {
|
|
2612
|
-
/**
|
|
2613
|
-
* Main ordered list of instructions to follow.
|
|
2614
|
-
*/
|
|
2615
|
-
instructions: Instruction[];
|
|
2616
|
-
};
|
|
2617
|
-
//#endregion
|
|
2618
|
-
//#region src/types/route/summary.d.ts
|
|
2619
|
-
/**
|
|
2620
|
-
* The summary of a route or route leg, with departure and arrival times, lengths and durations.
|
|
2621
|
-
* @group Route
|
|
2622
|
-
*/
|
|
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;
|
|
2647
|
-
/**
|
|
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.
|
|
2655
|
-
*/
|
|
2656
|
-
trafficDelayInSeconds?: number;
|
|
2657
|
-
/**
|
|
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.
|
|
2663
|
-
*/
|
|
2664
|
-
trafficLengthInMeters?: number;
|
|
2665
|
-
/**
|
|
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.
|
|
2894
|
+
* It is present on the maneuvers {@link Instruction.countryCrossingFromName} lists.
|
|
2670
2895
|
*/
|
|
2671
|
-
|
|
2672
|
-
/**
|
|
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.
|
|
2678
|
-
*/
|
|
2679
|
-
historicTrafficTravelTimeInSeconds?: number;
|
|
2680
|
-
/**
|
|
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.
|
|
2685
|
-
*/
|
|
2686
|
-
liveTrafficIncidentsTravelTimeInSeconds?: number;
|
|
2687
|
-
/**
|
|
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.
|
|
2693
|
-
*/
|
|
2694
|
-
deviationDistanceInMeters?: number;
|
|
2695
|
-
/**
|
|
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.
|
|
2701
|
-
*/
|
|
2702
|
-
deviationTimeInSeconds?: number;
|
|
2896
|
+
countryCrossingToName?: InstructionText;
|
|
2703
2897
|
/**
|
|
2704
|
-
* The
|
|
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.
|
|
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.
|
|
2709
2900
|
*/
|
|
2710
|
-
|
|
2901
|
+
countryCrossingToCode?: string;
|
|
2711
2902
|
};
|
|
2712
2903
|
/**
|
|
2713
|
-
* The
|
|
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
|
-
*
|
|
2904
|
+
* The guidance elements of a route, present only when guidance was requested and is available.
|
|
2726
2905
|
* @group Route
|
|
2727
2906
|
*/
|
|
2728
|
-
type
|
|
2907
|
+
type Guidance = {
|
|
2729
2908
|
/**
|
|
2730
|
-
*
|
|
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
|
-
* ```
|
|
2909
|
+
* Main ordered list of instructions to follow.
|
|
2749
2910
|
*/
|
|
2750
|
-
|
|
2911
|
+
instructions: Instruction[];
|
|
2751
2912
|
};
|
|
2752
2913
|
//#endregion
|
|
2753
2914
|
//#region src/types/route/sections.d.ts
|
|
@@ -2895,7 +3056,7 @@ export type TrafficIncidentTEC = {
|
|
|
2895
3056
|
* magnitudeOfDelay: 'moderate',
|
|
2896
3057
|
* delayInSeconds: 420, // 7 minutes
|
|
2897
3058
|
* effectiveSpeedInKmh: 25,
|
|
2898
|
-
* tec: { effectCode: 1, causes: [{ mainCauseCode:
|
|
3059
|
+
* tec: { effectCode: 1, causes: [{ mainCauseCode: 1 }] }
|
|
2899
3060
|
* };
|
|
2900
3061
|
* ```
|
|
2901
3062
|
*
|
|
@@ -2956,7 +3117,7 @@ export type DistinctSectionProps = SectionProps & {
|
|
|
2956
3117
|
*
|
|
2957
3118
|
* @remarks
|
|
2958
3119
|
* 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
|
|
3120
|
+
* large heading change makes a hard curve, up to a hairpin as {@link isHairpin} tells them.
|
|
2960
3121
|
*
|
|
2961
3122
|
* @example
|
|
2962
3123
|
* ```typescript
|
|
@@ -3079,13 +3240,13 @@ export type CurvyStretchSectionProps = SectionProps & {
|
|
|
3079
3240
|
*/
|
|
3080
3241
|
export type LegSectionProps = Omit<SectionProps, 'startPointIndex' | 'endPointIndex'> & {
|
|
3081
3242
|
/**
|
|
3082
|
-
* The index in the route coordinates where this leg starts
|
|
3083
|
-
*
|
|
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.
|
|
3084
3245
|
*/
|
|
3085
3246
|
startPointIndex?: number;
|
|
3086
3247
|
/**
|
|
3087
|
-
* The index in the route coordinates where this leg ends
|
|
3088
|
-
*
|
|
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.
|
|
3089
3250
|
*/
|
|
3090
3251
|
endPointIndex?: number;
|
|
3091
3252
|
/**
|
|
@@ -3188,7 +3349,7 @@ export type SpeedLimitSectionProps = SectionProps & {
|
|
|
3188
3349
|
*/
|
|
3189
3350
|
export type RoadShieldSectionProps = SectionProps & {
|
|
3190
3351
|
/**
|
|
3191
|
-
* The road
|
|
3352
|
+
* The references of the road shields along this section.
|
|
3192
3353
|
*/
|
|
3193
3354
|
roadShieldReferences: RoadShieldReference[];
|
|
3194
3355
|
};
|
|
@@ -3258,12 +3419,11 @@ export type SectionsProps = {
|
|
|
3258
3419
|
*
|
|
3259
3420
|
* @remarks
|
|
3260
3421
|
* It is a subset of {@link SectionsProps.tollRoad | `tollRoad`}, so every stretch reported here is
|
|
3261
|
-
* also reported there.
|
|
3422
|
+
* also reported there.
|
|
3423
|
+
*
|
|
3424
|
+
* Use `toll` for "will this route cost a toll to drive", and `tollRoad` for
|
|
3262
3425
|
* "does this route cost anything at all to drive". `tollRoad` also covers vignette-only
|
|
3263
3426
|
* 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.
|
|
3267
3427
|
*/
|
|
3268
3428
|
toll?: SectionProps[];
|
|
3269
3429
|
/**
|
|
@@ -3271,12 +3431,7 @@ export type SectionsProps = {
|
|
|
3271
3431
|
* that need a vignette and urban road-charge zones.
|
|
3272
3432
|
*
|
|
3273
3433
|
* @remarks
|
|
3274
|
-
* It is a superset of {@link SectionsProps.toll | `toll`}
|
|
3275
|
-
* same stretches. A vignette-only motorway or a city charge zone appears here and not in
|
|
3276
|
-
* `toll`.
|
|
3277
|
-
*
|
|
3278
|
-
* By default, it is included, since leaving `sectionTypes` unset requests it. A `sectionTypes`
|
|
3279
|
-
* list has to name `'tollRoad'` to keep it.
|
|
3434
|
+
* It is a superset of {@link SectionsProps.toll | `toll`}: see there how the two differ.
|
|
3280
3435
|
*/
|
|
3281
3436
|
tollRoad?: SectionProps[];
|
|
3282
3437
|
/**
|
|
@@ -3300,7 +3455,7 @@ export type SectionsProps = {
|
|
|
3300
3455
|
*/
|
|
3301
3456
|
export type SectionType = keyof SectionsProps;
|
|
3302
3457
|
/**
|
|
3303
|
-
* The section types a route calculation
|
|
3458
|
+
* The section types a route calculation requests when its request has no `sectionTypes`: every type the
|
|
3304
3459
|
* routing API returns, and `lanes` with guidance.
|
|
3305
3460
|
*
|
|
3306
3461
|
* @remarks
|
|
@@ -3316,7 +3471,8 @@ export type SectionType = keyof SectionsProps;
|
|
|
3316
3471
|
*/
|
|
3317
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"];
|
|
3318
3473
|
/**
|
|
3319
|
-
* The section types a route calculation request can ask to include in the response
|
|
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}.
|
|
3320
3476
|
* @group Route
|
|
3321
3477
|
*/
|
|
3322
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"];
|
|
@@ -3404,389 +3560,109 @@ type CurvyStretchSectionsOptions = {
|
|
|
3404
3560
|
* ```typescript
|
|
3405
3561
|
* // Only the hard curves, and the stretches of five or more of them
|
|
3406
3562
|
* const curveDetection: CurveDetectionOptions = {
|
|
3407
|
-
* curve: { maxRadiusInMeters: 100 },
|
|
3408
|
-
* curvyStretch: { minCurveCount: 5 },
|
|
3409
|
-
* };
|
|
3410
|
-
* ```
|
|
3411
|
-
*
|
|
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
|
|
3424
|
-
*/
|
|
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]>;
|
|
3428
|
-
/**
|
|
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.
|
|
3431
|
-
*/
|
|
3432
|
-
shares: number[];
|
|
3433
|
-
/** How far they run within the spans, together. */
|
|
3434
|
-
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
|
-
/**
|
|
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`.
|
|
3477
|
-
*/
|
|
3478
|
-
types?: readonly SectionType[];
|
|
3479
|
-
};
|
|
3480
|
-
/**
|
|
3481
|
-
* A road a route takes, as its important road stretches name it.
|
|
3482
|
-
*
|
|
3483
|
-
* @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.
|
|
3486
|
-
*
|
|
3487
|
-
* @group Utils
|
|
3488
|
-
*/
|
|
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;
|
|
3492
|
-
/**
|
|
3493
|
-
* Its road numbers, those of its stretches in turn, each sorted in descending order of display
|
|
3494
|
-
* priority. Empty when it has none.
|
|
3495
|
-
*/
|
|
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;
|
|
3510
|
-
};
|
|
3511
|
-
//#endregion
|
|
3512
|
-
//#region src/types/route/route.d.ts
|
|
3513
|
-
/**
|
|
3514
|
-
* All the road and route features that route calculation can avoid.
|
|
3515
|
-
*
|
|
3516
|
-
* Use it to derive the {@link Avoidable} type or to validate user input against the supported
|
|
3517
|
-
* avoidance options.
|
|
3518
|
-
*
|
|
3519
|
-
* @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.
|
|
3522
|
-
*
|
|
3523
|
-
* @example
|
|
3524
|
-
* ```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
|
-
* });
|
|
3535
|
-
* ```
|
|
3536
|
-
*
|
|
3537
|
-
* @group Route
|
|
3538
|
-
*/
|
|
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
|
-
* ```
|
|
3567
|
-
*
|
|
3568
|
-
* @group Route
|
|
3569
|
-
*/
|
|
3570
|
-
export type Avoidable = (typeof avoidableTypes)[number];
|
|
3571
|
-
/**
|
|
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.
|
|
3579
|
-
*
|
|
3580
|
-
* @example
|
|
3581
|
-
* ```typescript
|
|
3582
|
-
* const travelMode: TravelMode = 'car';
|
|
3583
|
-
* ```
|
|
3584
|
-
*
|
|
3585
|
-
* @group Route
|
|
3586
|
-
*/
|
|
3587
|
-
export type TravelMode = 'car';
|
|
3588
|
-
/**
|
|
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
|
-
*
|
|
3594
|
-
* @group Route
|
|
3595
|
-
*/
|
|
3596
|
-
export type RouteProgress = {
|
|
3597
|
-
/**
|
|
3598
|
-
* Cumulative travel time in seconds from the route start.
|
|
3599
|
-
*/
|
|
3600
|
-
travelTimeInSeconds?: number;
|
|
3601
|
-
/**
|
|
3602
|
-
* Cumulative distance in meters from the route start.
|
|
3603
|
-
*/
|
|
3604
|
-
distanceInMeters?: number;
|
|
3605
|
-
};
|
|
3606
|
-
/**
|
|
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.
|
|
3611
|
-
*
|
|
3612
|
-
* @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.
|
|
3615
|
-
*
|
|
3616
|
-
* @example
|
|
3617
|
-
* ```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
|
-
* ];
|
|
3563
|
+
* curve: { maxRadiusInMeters: 100 },
|
|
3564
|
+
* curvyStretch: { minCurveCount: 5 },
|
|
3565
|
+
* };
|
|
3623
3566
|
* ```
|
|
3624
3567
|
*
|
|
3625
|
-
* @group
|
|
3568
|
+
* @group Utils
|
|
3626
3569
|
*/
|
|
3627
|
-
|
|
3628
|
-
/**
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
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'>;
|
|
3632
3575
|
};
|
|
3633
3576
|
/**
|
|
3634
|
-
*
|
|
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.
|
|
3577
|
+
* A route's sections of one type within the spans asked about.
|
|
3638
3578
|
*
|
|
3639
|
-
* @group
|
|
3579
|
+
* @group Utils
|
|
3640
3580
|
*/
|
|
3641
|
-
|
|
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]>;
|
|
3584
|
+
/**
|
|
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.
|
|
3587
|
+
*/
|
|
3588
|
+
shares: number[];
|
|
3589
|
+
/** How far they run within the spans, together. */
|
|
3590
|
+
lengthInMeters: number;
|
|
3591
|
+
};
|
|
3642
3592
|
/**
|
|
3643
|
-
*
|
|
3593
|
+
* A route's sections within the spans asked about, by type: only the types it has there.
|
|
3644
3594
|
*
|
|
3645
|
-
* @group
|
|
3595
|
+
* @group Utils
|
|
3646
3596
|
*/
|
|
3647
|
-
|
|
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
|
-
};
|
|
3597
|
+
type SectionsWithin = { [T in SectionType]?: SectionsWithinOfType<T>; };
|
|
3655
3598
|
/**
|
|
3656
|
-
*
|
|
3599
|
+
* Where to look along a route for its sections, and of which types.
|
|
3657
3600
|
*
|
|
3658
3601
|
* @group Utils
|
|
3659
3602
|
*/
|
|
3660
|
-
|
|
3661
|
-
/**
|
|
3662
|
-
|
|
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[];
|
|
3663
3608
|
};
|
|
3664
3609
|
/**
|
|
3665
|
-
*
|
|
3666
|
-
* Provide exactly one of the three variants.
|
|
3610
|
+
* How a route differs from a reference route: the stretches each drives alone, and their sections.
|
|
3667
3611
|
*
|
|
3668
3612
|
* @group Utils
|
|
3669
3613
|
*/
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
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;
|
|
3676
3623
|
};
|
|
3677
3624
|
/**
|
|
3678
|
-
*
|
|
3679
|
-
* guidance instructions and progress data.
|
|
3625
|
+
* Which sections to weigh when comparing two routes.
|
|
3680
3626
|
*
|
|
3681
|
-
* @group
|
|
3627
|
+
* @group Utils
|
|
3682
3628
|
*/
|
|
3683
|
-
|
|
3684
|
-
/**
|
|
3685
|
-
* The summary statistics of the entire route, with departure and arrival times, total length
|
|
3686
|
-
* and duration.
|
|
3687
|
-
*/
|
|
3688
|
-
summary: RouteSummary;
|
|
3689
|
-
/**
|
|
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)
|
|
3695
|
-
*/
|
|
3696
|
-
sections: SectionsProps;
|
|
3697
|
-
/**
|
|
3698
|
-
* The turn-by-turn navigation instructions, with maneuvers, road names and instruction text.
|
|
3699
|
-
*
|
|
3700
|
-
* They are present only when guidance was requested and is available.
|
|
3701
|
-
*/
|
|
3702
|
-
guidance?: Guidance;
|
|
3703
|
-
/**
|
|
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.
|
|
3708
|
-
*/
|
|
3709
|
-
progress?: RouteProgressPoint[];
|
|
3629
|
+
type CompareRoutesOptions = {
|
|
3710
3630
|
/**
|
|
3711
|
-
* The
|
|
3712
|
-
*
|
|
3713
|
-
* The first route (index 0) is typically the recommended or best route, and the rest are alternatives.
|
|
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`.
|
|
3714
3633
|
*/
|
|
3715
|
-
|
|
3634
|
+
types?: readonly SectionType[];
|
|
3716
3635
|
};
|
|
3717
3636
|
/**
|
|
3718
|
-
* A
|
|
3719
|
-
*
|
|
3720
|
-
* Its geometry is a LineString of the route path coordinates, and its properties hold all
|
|
3721
|
-
* route information (summary, sections, guidance).
|
|
3722
|
-
*
|
|
3723
|
-
* @typeParam P - Type of the route properties (defaults to RouteProps)
|
|
3637
|
+
* A road a route takes, as its important road stretches name it.
|
|
3724
3638
|
*
|
|
3725
|
-
* @
|
|
3726
|
-
*
|
|
3727
|
-
*
|
|
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]
|
|
3740
|
-
* };
|
|
3741
|
-
* ```
|
|
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.
|
|
3742
3642
|
*
|
|
3743
|
-
* @group
|
|
3643
|
+
* @group Utils
|
|
3744
3644
|
*/
|
|
3745
|
-
|
|
3746
|
-
/**
|
|
3747
|
-
|
|
3748
|
-
*/
|
|
3749
|
-
id: string;
|
|
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;
|
|
3750
3648
|
/**
|
|
3751
|
-
*
|
|
3649
|
+
* Its road numbers, those of its stretches in turn, each sorted in descending order of display
|
|
3650
|
+
* priority. Empty when it has none.
|
|
3752
3651
|
*/
|
|
3753
|
-
|
|
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[];
|
|
3754
3657
|
};
|
|
3755
3658
|
/**
|
|
3756
|
-
*
|
|
3757
|
-
*
|
|
3758
|
-
* It typically holds the main route (index 0) and optional alternative routes. Its properties
|
|
3759
|
-
* can include metadata about the routing request.
|
|
3760
|
-
*
|
|
3761
|
-
* @typeParam P - Type of individual route properties (defaults to RouteProps)
|
|
3762
|
-
* @typeParam FeatureCollectionProps - Type of collection-level properties
|
|
3763
|
-
*
|
|
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
|
-
* ```
|
|
3659
|
+
* Where to look for important roads along a route, and how much of each to require.
|
|
3778
3660
|
*
|
|
3779
|
-
* @group
|
|
3661
|
+
* @group Utils
|
|
3780
3662
|
*/
|
|
3781
|
-
|
|
3782
|
-
/**
|
|
3783
|
-
|
|
3784
|
-
*/
|
|
3785
|
-
features: Route<P>[];
|
|
3786
|
-
/**
|
|
3787
|
-
* The bounding box of all the routes, or at least of their waypoints. It is defined only if there are routes.
|
|
3788
|
-
*/
|
|
3789
|
-
bbox?: BBox;
|
|
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
|
|
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
|
|
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
|
|
3758
|
+
* const coordinates: WaypointLike = [4.9041, 52.3676];
|
|
3882
3759
|
*
|
|
3883
3760
|
* // As Point geometry
|
|
3884
|
-
* const
|
|
3761
|
+
* const point: WaypointLike = { type: 'Point', coordinates: [4.9041, 52.3676] };
|
|
3885
3762
|
*
|
|
3886
3763
|
* // As full Waypoint Feature carrying custom properties
|
|
3887
|
-
* const
|
|
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
|
-
*
|
|
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
|
-
*
|
|
4169
|
-
*
|
|
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
|
|
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,
|
|
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),
|
|
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),
|
|
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
|
-
*
|
|
4551
|
-
*
|
|
4552
|
-
*
|
|
4553
|
-
*
|
|
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.
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
-
* -
|
|
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
|
-
*
|
|
4729
|
-
*
|
|
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.
|
|
4822
|
-
* its grid
|
|
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
|
|
4859
|
-
* there. A
|
|
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.
|
|
4964
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
|
5051
|
-
* junction, to the next one after it.
|
|
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
|
|
5083
|
-
*
|
|
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
|
-
*
|
|
5148
|
-
*
|
|
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
|
|
5182
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
5221
|
-
*
|
|
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}
|
|
5249
|
-
*
|
|
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
|
|
5480
|
-
*
|
|
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.
|
|
@@ -5542,14 +5321,16 @@ export declare const indexedMagnitudes: DelayMagnitude[];
|
|
|
5542
5321
|
*
|
|
5543
5322
|
* It shows hours and minutes, rounding and formatting by the duration's length.
|
|
5544
5323
|
*
|
|
5545
|
-
* @param seconds The duration in seconds.
|
|
5324
|
+
* @param seconds The duration in seconds. A negative duration formats as its absolute value.
|
|
5546
5325
|
* @param options Custom display units for the hours and minutes text.
|
|
5547
5326
|
*
|
|
5548
|
-
* @returns The formatted time, such as "1 hr 30 min"
|
|
5327
|
+
* @returns The formatted time, such as "1 hr 30 min", "45 min" or "< 1 min". A number always gives a
|
|
5328
|
+
* string; only an `undefined` duration returns `undefined`.
|
|
5549
5329
|
*
|
|
5550
5330
|
* @remarks
|
|
5551
5331
|
* Rounding:
|
|
5552
|
-
* -
|
|
5332
|
+
* - `0` gives "0 min".
|
|
5333
|
+
* - Any other duration under 30 seconds gives "< 1 min", in the minute units you set.
|
|
5553
5334
|
* - 30-59 seconds round to "1 min".
|
|
5554
5335
|
* - Minutes round to the nearest minute.
|
|
5555
5336
|
* - Hours show once the duration rounds to an hour or more.
|
|
@@ -5564,8 +5345,9 @@ export declare const indexedMagnitudes: DelayMagnitude[];
|
|
|
5564
5345
|
* @example
|
|
5565
5346
|
* ```typescript
|
|
5566
5347
|
* // Basic usage
|
|
5567
|
-
* formatDuration(
|
|
5568
|
-
* formatDuration(
|
|
5348
|
+
* formatDuration(undefined); // undefined
|
|
5349
|
+
* formatDuration(0); // "0 min"
|
|
5350
|
+
* formatDuration(20); // "< 1 min"
|
|
5569
5351
|
* formatDuration(30); // "1 min"
|
|
5570
5352
|
* formatDuration(60); // "1 min"
|
|
5571
5353
|
* formatDuration(100); // "2 min"
|
|
@@ -5578,6 +5360,8 @@ export declare const indexedMagnitudes: DelayMagnitude[];
|
|
|
5578
5360
|
* // Custom units
|
|
5579
5361
|
* formatDuration(3660, { hours: 'h', minutes: 'm' });
|
|
5580
5362
|
* // Returns: "1 h 01 m"
|
|
5363
|
+
* formatDuration(20, { minutes: 'm' });
|
|
5364
|
+
* // Returns: "< 1 m"
|
|
5581
5365
|
*
|
|
5582
5366
|
* // Route travel time
|
|
5583
5367
|
* const route = await calculateRoute({ ... });
|
|
@@ -5588,9 +5372,18 @@ export declare const indexedMagnitudes: DelayMagnitude[];
|
|
|
5588
5372
|
*
|
|
5589
5373
|
* @group Utils
|
|
5590
5374
|
*/
|
|
5591
|
-
export declare
|
|
5375
|
+
export declare function formatDuration(seconds: number, options?: TimeDisplayUnits): string;
|
|
5376
|
+
/**
|
|
5377
|
+
* Formats a duration in seconds into a human-readable time string, as the overload above does for a
|
|
5378
|
+
* number, or returns `undefined` for an `undefined` duration.
|
|
5379
|
+
*
|
|
5380
|
+
* @group Utils
|
|
5381
|
+
*/
|
|
5382
|
+
export declare function formatDuration(seconds: number | undefined, options?: TimeDisplayUnits): string | undefined;
|
|
5592
5383
|
/**
|
|
5593
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}.
|
|
5594
5387
|
* @example
|
|
5595
5388
|
* ```ts
|
|
5596
5389
|
* const metric = { type: 'metric' } as const;
|
|
@@ -5625,4 +5418,4 @@ export declare const formatDuration: (seconds: number | undefined, options?: Tim
|
|
|
5625
5418
|
*/
|
|
5626
5419
|
export declare const formatDistance: (meters: number | undefined, options?: DistanceDisplayUnits) => string;
|
|
5627
5420
|
//#endregion
|
|
5628
|
-
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 };
|