@tomtom-org/maps-sdk 1.0.0-rc.3 → 1.0.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,3 @@
1
- //#region src/types/generic.d.ts
2
- /**
3
- * An object with string keys and unknown values.
4
- *
5
- * Use it for objects whose shape is not fixed, such as extensible properties or arbitrary user data.
6
- *
7
- * @example
8
- * ```typescript
9
- * function processCustomData(data: Anything) {
10
- * // Access properties dynamically
11
- * console.log(data['customField']);
12
- * }
13
- * ```
14
- *
15
- * @group Shared
16
- */
17
- type Anything = {
18
- [x: string]: unknown;
19
- };
20
- //#endregion
21
1
  //#region ../node_modules/.pnpm/@types+geojson@7946.0.16/node_modules/@types/geojson/index.d.ts
22
2
  /**
23
3
  * The value values for the "type" property of GeoJSON Objects.
@@ -100,12 +80,12 @@ interface GeoJsonObject {
100
80
  /**
101
81
  * Union of GeoJSON objects.
102
82
  */
103
- type GeoJSON<G extends Geometry | null = Geometry, P = GeoJsonProperties> = G | Feature<G, P> | FeatureCollection<G, P>;
83
+ type GeoJSON<G extends Geometry$1 | null = Geometry$1, P = GeoJsonProperties> = G | Feature<G, P> | FeatureCollection<G, P>;
104
84
  /**
105
85
  * Geometry object.
106
86
  * https://tools.ietf.org/html/rfc7946#section-3
107
87
  */
108
- type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
88
+ type Geometry$1 = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
109
89
  /**
110
90
  * Point geometry object.
111
91
  * https://tools.ietf.org/html/rfc7946#section-3.1.2
@@ -158,7 +138,7 @@ interface MultiPolygon extends GeoJsonObject {
158
138
  * Geometry Collection
159
139
  * https://tools.ietf.org/html/rfc7946#section-3.1.8
160
140
  */
161
- interface GeometryCollection<G extends Geometry = Geometry> extends GeoJsonObject {
141
+ interface GeometryCollection<G extends Geometry$1 = Geometry$1> extends GeoJsonObject {
162
142
  type: "GeometryCollection";
163
143
  geometries: G[];
164
144
  }
@@ -169,7 +149,7 @@ type GeoJsonProperties = {
169
149
  * A feature object which contains a geometry and associated properties.
170
150
  * https://tools.ietf.org/html/rfc7946#section-3.2
171
151
  */
172
- interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
152
+ interface Feature<G extends Geometry$1 | null = Geometry$1, P = GeoJsonProperties> extends GeoJsonObject {
173
153
  type: "Feature";
174
154
  /**
175
155
  * The feature's geometry
@@ -189,11 +169,142 @@ interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> e
189
169
  * A collection of feature objects.
190
170
  * https://tools.ietf.org/html/rfc7946#section-3.3
191
171
  */
192
- interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
172
+ interface FeatureCollection<G extends Geometry$1 | null = Geometry$1, P = GeoJsonProperties> extends GeoJsonObject {
193
173
  type: "FeatureCollection";
194
174
  features: Array<Feature<G, P>>;
195
175
  }
196
176
  //#endregion
177
+ //#region src/types/cells.d.ts
178
+ /**
179
+ * A statistic {@link aggregateIntoCells} computes over the values of the points in each cell.
180
+ * - `count` - How many points the cell holds.
181
+ * - `sum`, `mean`, `median`, `min`, `max` - Of their values.
182
+ *
183
+ * @group Utils
184
+ */
185
+ type CellStatistic = 'count' | 'sum' | 'mean' | 'median' | 'min' | 'max';
186
+ /**
187
+ * The shape of the cells of a grid {@link aggregateIntoCells} lays out:
188
+ * - `'hex'` - Hexagons, flat side up.
189
+ * - `'square'` - Squares.
190
+ *
191
+ * @group Utils
192
+ */
193
+ type CellGridShape = 'hex' | 'square';
194
+ /**
195
+ * The cells {@link aggregateIntoCells} groups points into: a grid of {@link CellGridShape}, or a collection
196
+ * of your own polygons, such as districts.
197
+ *
198
+ * @group Utils
199
+ */
200
+ type CellGrid = CellGridShape | FeatureCollection<Polygon | MultiPolygon>;
201
+ /**
202
+ * The keys of `P` whose values are numbers.
203
+ *
204
+ * @group Utils
205
+ */
206
+ type NumericPropertyKey<P> = { [K in keyof NonNullable<P>]-?: NonNullable<P>[K] extends number | null | undefined ? K : never; }[keyof NonNullable<P>] & string;
207
+ /**
208
+ * Where a point's value comes from: the name of a numeric property, or a function that reads it.
209
+ *
210
+ * A point whose value is missing or not a finite number is left out of every statistic, `count` included.
211
+ *
212
+ * @group Utils
213
+ */
214
+ type CellValue<P extends GeoJsonProperties> = NumericPropertyKey<P> | ((point: Feature<Point, P>) => number | null | undefined);
215
+ /**
216
+ * The options of a grid of hexagons or squares.
217
+ *
218
+ * @group Utils
219
+ */
220
+ type LatticeGridOptions<G extends CellGridShape> = {
221
+ grid: G;
222
+ /** A cell's side in kilometres: a square's, or a hexagon's, which is also its centre-to-corner distance. */
223
+ cellSizeKM: number;
224
+ /**
225
+ * The centre of one cell, which lays out the grid. Its latitude sets the cell size in degrees.
226
+ * Defaults to the centre of the points' bounding box.
227
+ *
228
+ * Pass the same position each time, such as your city's centre, to keep the cells in place while
229
+ * your points change.
230
+ */
231
+ gridOrigin?: Position;
232
+ };
233
+ /**
234
+ * The grid half of {@link AggregateIntoCellsOptions}: a grid of hexagons or squares, or your own polygons.
235
+ * A `grid` that may be either needs narrowing first, as only a grid of hexagons or squares takes a `cellSizeKM`.
236
+ *
237
+ * @group Utils
238
+ */
239
+ type CellGridOptions<G extends CellGrid> = [G] extends [CellGridShape] ? LatticeGridOptions<G> : [G] extends [FeatureCollection<Polygon | MultiPolygon>] ? {
240
+ grid: G;
241
+ } : LatticeGridOptions<Extract<G, CellGridShape>> | {
242
+ grid: Exclude<G, CellGridShape>;
243
+ };
244
+ /**
245
+ * The value half of {@link AggregateIntoCellsOptions}: the statistics to compute, and the value they read.
246
+ * Without a `value`, the cells only count their points.
247
+ *
248
+ * @group Utils
249
+ */
250
+ type CellValueOptions<P extends GeoJsonProperties, S extends CellStatistic> = {
251
+ value?: undefined;
252
+ stats?: readonly (S & 'count')[];
253
+ } | {
254
+ value: CellValue<P>;
255
+ /** The statistics each cell gets, as properties of the same names. */
256
+ stats: readonly S[];
257
+ };
258
+ /**
259
+ * Options of {@link aggregateIntoCells}.
260
+ *
261
+ * @typeParam P - The properties of the points.
262
+ * @typeParam S - The statistics each cell gets.
263
+ * @typeParam G - The grid.
264
+ *
265
+ * @group Utils
266
+ */
267
+ type AggregateIntoCellsOptions<P extends GeoJsonProperties, S extends CellStatistic, G extends CellGrid> = CellGridOptions<G> & CellValueOptions<P, S> & {
268
+ /**
269
+ * Leaves out the cells holding fewer points than this. Defaults to 1. A value below 1 counts as 1,
270
+ * so one of your polygons without points never shows.
271
+ */
272
+ minCount?: number;
273
+ };
274
+ /**
275
+ * The statistics of one cell, each a property named after it.
276
+ *
277
+ * @group Utils
278
+ */
279
+ type CellStatistics<S extends CellStatistic> = { [K in S]: number; };
280
+ /**
281
+ * What {@link aggregateIntoCells} returns: one polygon per cell holding points, with the statistics as its
282
+ * properties. Your own polygons keep their geometry, `id` and properties, the statistics added to them.
283
+ *
284
+ * @group Utils
285
+ */
286
+ type AggregatedCells<S extends CellStatistic, G extends CellGrid> = [G] extends [FeatureCollection<infer Geometry, infer Properties>] ? FeatureCollection<Geometry, NonNullable<Properties> & CellStatistics<S>> : FeatureCollection<Polygon, CellStatistics<S>>;
287
+ //#endregion
288
+ //#region src/types/generic.d.ts
289
+ /**
290
+ * An object with string keys and unknown values.
291
+ *
292
+ * Use it for objects whose shape is not fixed, such as extensible properties or arbitrary user data.
293
+ *
294
+ * @example
295
+ * ```typescript
296
+ * function processCustomData(data: Anything) {
297
+ * // Access properties dynamically
298
+ * console.log(data['customField']);
299
+ * }
300
+ * ```
301
+ *
302
+ * @group Shared
303
+ */
304
+ type Anything = {
305
+ [x: string]: unknown;
306
+ };
307
+ //#endregion
197
308
  //#region src/types/geojson.d.ts
198
309
  /**
199
310
  * A geographic point, in one of these forms:
@@ -224,9 +335,15 @@ interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonPro
224
335
  */
225
336
  type HasLngLat = [number, number] | Position | Point | Feature<Point>;
226
337
  /**
227
- * A geographic bounding box as an array of four numbers.
338
+ * A geographic bounding box as an array of four numbers: `[west, south, east, north]`.
339
+ *
340
+ * @remarks
341
+ * A box whose west edge lies east of its east edge, `west > east`, crosses the antimeridian, as in
342
+ * {@link https://datatracker.ietf.org/doc/html/rfc7946#section-5.2 | RFC 7946 §5.2}: `[176.8, -21, -178.2, -12.5]`
343
+ * covers Fiji. The services return that form, and every bbox utility reads and returns it.
228
344
  *
229
- * The format is `[minLon, minLat, maxLon, maxLat]`, or `[west, south, east, north]`.
345
+ * MapLibre's `fitBounds` and the map's `bounds` option read it as is. Elsewhere in MapLibre, add 360 to
346
+ * `east`, as `LngLatBounds.adjustAntiMeridian()` does.
230
347
  *
231
348
  * @group Shared
232
349
  */
@@ -240,7 +357,7 @@ type BBox = [number, number, number, number];
240
357
  * - `GeoJSON[]` - An array of GeoJSON objects, a convenience extension to standard GeoJSON.
241
358
  *
242
359
  * @remarks
243
- * The format is `[minLon, minLat, maxLon, maxLat]`, or `[west, south, east, north]`.
360
+ * The format is `[west, south, east, north]`, crossing the antimeridian when `west > east`, as {@link BBox} describes.
244
361
  *
245
362
  * @example
246
363
  * ```typescript
@@ -371,7 +488,7 @@ type PolygonFeatures<P = GeoJsonProperties> = Omit<FeatureCollection<Polygon | M
371
488
  *
372
489
  * @group Shared
373
490
  */
374
- interface FeatureCollectionWithProperties<G extends Geometry | null = Geometry, P = GeoJsonProperties, FeatureCollectionProps = unknown> extends Omit<FeatureCollection<G, P>, 'bbox'> {
491
+ interface FeatureCollectionWithProperties<G extends Geometry$1 | null = Geometry$1, P = GeoJsonProperties, FeatureCollectionProps = unknown> extends Omit<FeatureCollection<G, P>, 'bbox'> {
375
492
  /**
376
493
  * The bounding box of all features in the collection, including any bounding boxes they have.
377
494
  * It is present only if the collection has features.
@@ -411,6 +528,8 @@ export declare const geopoliticalViews: readonly ["Unified", "AE", "AR", "BN", "
411
528
  * | Search, place details, reverse geocoding | `KR`, `US` |
412
529
  * | Geocoding | `AE`, `BN`, `CL`, `DZ`, `KR`, `MY`, `PH`, `US`, `VN` |
413
530
  *
531
+ * {@link servesGeopoliticalView} answers the same question in code.
532
+ *
414
533
  * @example
415
534
  * ```typescript
416
535
  * // The map and every service, from India's perspective
@@ -421,6 +540,20 @@ export declare const geopoliticalViews: readonly ["Unified", "AE", "AR", "BN", "
421
540
  * @group Shared
422
541
  */
423
542
  export type GeopoliticalView = (typeof geopoliticalViews)[number];
543
+ /**
544
+ * A TomTom API the SDK sends a {@link GeopoliticalView} to.
545
+ *
546
+ * @remarks
547
+ * - `mapTiles`: The Orbis vector tiles the map draws.
548
+ * - `search`: `fuzzySearch`, `geometrySearch`, `alongRouteSearch`, `discoverPlaces` and
549
+ * `getSearchSuggestions`.
550
+ * - `placeDetails`: `getPlaceDetails`.
551
+ * - `reverseGeocoding`: `reverseGeocode`.
552
+ * - `geocoding`: `geocode` and `geocodeOne`.
553
+ *
554
+ * @group Shared
555
+ */
556
+ export type GeopoliticalViewAPI = 'mapTiles' | 'search' | 'placeDetails' | 'reverseGeocoding' | 'geocoding';
424
557
  //#endregion
425
558
  //#region src/types/getPosition.d.ts
426
559
  /**
@@ -429,8 +562,9 @@ export type GeopoliticalView = (typeof geopoliticalViews)[number];
429
562
  * Entry points are specific access locations of a place, such as building entrances or parking lot entries.
430
563
  *
431
564
  * @remarks
432
- * - `main-when-available` - Returns the main entry point position if available, otherwise the default place position.
433
- * Use it for routing, to direct vehicles to the correct entrance.
565
+ * - `main-when-available` - Returns the position of the entry point typed `'main'`. A place with none uses its
566
+ * first untyped entry point, as reverse geocoding returns them. A place whose entry points are all `'minor'`, or
567
+ * that has none, returns its own position. Use it for routing, to direct vehicles to the correct entrance.
434
568
  * - `ignore` - Always returns the default position of the place, typically the center point.
435
569
  *
436
570
  * @example
@@ -454,8 +588,8 @@ type GetPositionOptions = {
454
588
  /**
455
589
  * Whether to use entry point positions when available.
456
590
  *
457
- * With `'main-when-available'`, you get the main entry point coordinates if they exist,
458
- * otherwise the default place position. Use it for routing, to direct users to the correct entrance.
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.
459
593
  *
460
594
  * @default 'ignore'
461
595
  *
@@ -523,7 +657,7 @@ type TomTomAPIHeaders = {
523
657
  *
524
658
  * @group Shared
525
659
  */
526
- export declare const languages: readonly ["ngt", "ngt-Latn", "ar", "bg-BG", "zh-Hant", "zh-Hans", "cs-CZ", "da-DK", "nl-NL", "en-AU", "en-CA", "en-GB", "en-NZ", "en-US", "fi-FI", "fr-FR", "de-DE", "el-GR", "hu-HU", "id-ID", "it-IT", "ko-KR", "ko-Latn-KR", "lt-LT", "ms-MY", "nb-NO", "pl-PL", "pt-BR", "pt-PT", "ru-RU", "ru-Latn-RU", "ru-Cyrl-RU", "sk-SK", "sl-SI", "es-ES", "es-MX", "sv-SE", "th-TH", "tr-TR"];
660
+ export declare const languages: readonly ["ngt", "ngt-Latn", "ar", "eu-ES", "bg-BG", "ca-ES", "zh-Hant", "zh-Hans", "hr-HR", "cs-CZ", "da-DK", "nl-NL", "en-AU", "en-CA", "en-GB", "en-NZ", "en-US", "et-EE", "fi-FI", "fr-FR", "gl-ES", "de-DE", "el-GR", "he-IL", "hi-IN", "hu-HU", "id-ID", "it-IT", "ja-JP", "kk-KZ", "ko-KR", "ko-Latn-KR", "lv-LV", "lt-LT", "ms-MY", "nb-NO", "pl-PL", "pt-BR", "pt-PT", "ro-RO", "ru-RU", "ru-Latn-RU", "ru-Cyrl-RU", "sr-RS", "sk-SK", "sl-SI", "es-ES", "es-MX", "sv-SE", "th-TH", "tr-TR", "uk-UA"];
527
661
  /**
528
662
  * A language code for map display and service responses.
529
663
  *
@@ -531,6 +665,11 @@ export declare const languages: readonly ["ngt", "ngt-Latn", "ar", "bg-BG", "zh-
531
665
  * - Map labels and text on vector tiles.
532
666
  * - Place names, addresses and other textual content in service responses.
533
667
  *
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
+ *
534
673
  * It covers locales with region-specific variants, such as `en-US` and `en-GB`. Special codes
535
674
  * such as `ngt` (Neutral Ground Truth) and `ngt-Latn` give language-neutral or Latin script alternatives.
536
675
  *
@@ -884,8 +1023,7 @@ type ChargingPark = {
884
1023
  * @example
885
1024
  * ```typescript
886
1025
  * const dataSources: PlaceDataSources = {
887
- * geometry: { id: 'geom-456' },
888
- * poiDetails: { id: 'poi-789', sourceName: 'TomTom' }
1026
+ * geometry: { id: 'geom-456' }
889
1027
  * };
890
1028
  * ```
891
1029
  *
@@ -907,9 +1045,10 @@ type PlaceDataSources = {
907
1045
  */
908
1046
  geometry?: GeometryDataSource;
909
1047
  /**
910
- * The data source for detailed POI information, present only for POI places (type === POI).
1048
+ * The data source for detailed POI information, which the Orbis places API doesn't return.
911
1049
  *
912
- * Use its ID to fetch extended details from the Points of Interest Details service.
1050
+ * @remarks
1051
+ * To fetch a place's details, pass the place's own `id` to `getPlaceDetails`.
913
1052
  */
914
1053
  poiDetails?: PoiDetailsDataSource;
915
1054
  };
@@ -936,27 +1075,16 @@ type GeometryDataSource = {
936
1075
  id: string;
937
1076
  };
938
1077
  /**
939
- * Data source reference for detailed POI information.
1078
+ * Data source reference for detailed POI information, which the Orbis places API doesn't return.
940
1079
  *
941
- * @example
942
- * ```typescript
943
- * const dataSource: PoiDetailsDataSource = {
944
- * id: 'poi-xyz789',
945
- * sourceName: 'TomTom'
946
- * };
947
- * ```
1080
+ * @remarks
1081
+ * To fetch a place's details, pass the place's own `id` to `getPlaceDetails`.
948
1082
  *
949
1083
  * @group Place
950
1084
  */
951
1085
  type PoiDetailsDataSource = {
952
1086
  /**
953
- * The POI details ID for the Points of Interest Details service.
954
- *
955
- * Pass it to fetch additional information such as:
956
- * - Extended opening hours
957
- * - Photos and ratings
958
- * - Detailed amenities
959
- * - Contact information
1087
+ * The POI details ID.
960
1088
  */
961
1089
  id: string;
962
1090
  /**
@@ -1205,10 +1333,12 @@ type POI = {
1205
1333
  */
1206
1334
  categories: POICategory[];
1207
1335
  /**
1208
- * The localized, human-readable category names of the POI, as the API returns them.
1336
+ * The human-readable category names of the POI, as the API returns them, such as `'italian'`,
1337
+ * `'restaurant'`, `'petrol station'` or `'hotel'`.
1209
1338
  *
1210
- * They are language-sensitive descriptions, such as `'italian'`, `'restaurant'`, `'gas station'`
1211
- * or `'hotel'`, to display in the UI.
1339
+ * They are in English, the same whatever the request `language`. For names in that language, look
1340
+ * up each of {@link categories} by `code` in what `getPOICategories` returns for it. A few of those
1341
+ * names are identifiers, such as `'GeneralHospitalAndPolyclinic'`: keep these English names there.
1212
1342
  */
1213
1343
  localizedCategories: string[];
1214
1344
  /**
@@ -1380,7 +1510,7 @@ export type AddressRanges = {
1380
1510
  * - `minor`: One of possibly several secondary or alternative entrances.
1381
1511
  *
1382
1512
  * The type is absent when the service does not classify its entry points, as with
1383
- * reverse geocoding.
1513
+ * reverse geocoding. {@link GetPositionEntryPointOption} `main-when-available` then uses the first untyped one.
1384
1514
  *
1385
1515
  * @group Place
1386
1516
  */
@@ -2515,16 +2645,23 @@ type SummaryBase = {
2515
2645
  */
2516
2646
  travelTimeInSeconds: number;
2517
2647
  /**
2518
- * The extra time in seconds that current traffic conditions cause, compared to free-flow conditions.
2648
+ * The delay in seconds of the traffic events along `trafficLengthInMeters`.
2519
2649
  *
2520
- * A value of 0 means no traffic delays.
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.
2521
2655
  */
2522
- trafficDelayInSeconds: number;
2656
+ trafficDelayInSeconds?: number;
2523
2657
  /**
2524
2658
  * The length in meters of the route that traffic events delay, which is the portion with
2525
2659
  * congestion or incidents.
2660
+ *
2661
+ * @remarks
2662
+ * It is present only when the routing service sends it.
2526
2663
  */
2527
- trafficLengthInMeters: number;
2664
+ trafficLengthInMeters?: number;
2528
2665
  /**
2529
2666
  * The estimated travel time in seconds in free-flow conditions, as if there were no traffic
2530
2667
  * delays (no congestion).
@@ -2790,10 +2927,12 @@ export type TrafficSectionProps = SectionProps & {
2790
2927
  */
2791
2928
  delayInSeconds?: number;
2792
2929
  /**
2793
- * The identifier of the traffic incident behind this section.
2930
+ * The routing service's identifier of the traffic incident behind this section.
2794
2931
  *
2795
- * It is the join key back to the full incident. To get the whole record, pass it to the traffic
2796
- * incident details service rather than re-deriving it from the section's geometry.
2932
+ * @remarks
2933
+ * It is the tail of the incident's `id` in `trafficIncidentDetails`, not that id, so passing it as
2934
+ * `ids` finds nothing. To get the whole record, query `trafficIncidentDetails` with the section's
2935
+ * {@link getSectionBBox} and keep the incident whose `id.endsWith(eventId)`.
2797
2936
  */
2798
2937
  eventId?: string;
2799
2938
  };
@@ -2812,6 +2951,103 @@ export type DistinctSectionProps = SectionProps & {
2812
2951
  /** The length of the section, along the route. */
2813
2952
  lengthInMeters: number;
2814
2953
  };
2954
+ /**
2955
+ * A curve of a route: a stretch where the road keeps turning the same way.
2956
+ *
2957
+ * @remarks
2958
+ * The SDK finds curves in the route's geometry, with {@link getCurveSections}. A small radius with a
2959
+ * large heading change makes a hard curve: a hairpin turns some 180° on a radius of 10 to 20 metres.
2960
+ *
2961
+ * @example
2962
+ * ```typescript
2963
+ * const hairpin: CurveSectionProps = {
2964
+ * id: 'curve-1',
2965
+ * startPointIndex: 120,
2966
+ * endPointIndex: 131,
2967
+ * headingChangeInDegrees: -172, // a left hairpin
2968
+ * radiusInMeters: 14,
2969
+ * lengthInMeters: 70,
2970
+ * curvinessScore: 84, // each of the 42 metres of its arc counts twice
2971
+ * severity: 0.94,
2972
+ * };
2973
+ * ```
2974
+ *
2975
+ * @group Route
2976
+ */
2977
+ export type CurveSectionProps = SectionProps & {
2978
+ /**
2979
+ * How far the heading turns along the curve: positive to the right, negative to the left. It can
2980
+ * pass 180° on a hairpin or a roundabout.
2981
+ */
2982
+ headingChangeInDegrees: number;
2983
+ /**
2984
+ * The radius of the circle the curve follows where it turns tightest, over the shortest part of
2985
+ * it that turns four fifths of its heading change: a curve can ease in on a wide bend first.
2986
+ */
2987
+ radiusInMeters: number;
2988
+ /** The length of the curve, along the route, from where it starts turning to where it straightens. */
2989
+ lengthInMeters: number;
2990
+ /**
2991
+ * How much the curve has to offer a rider, as roadcurvature.com scores roads: the length of its
2992
+ * arc, `radiusInMeters` times the heading change in radians, with each metre counted:
2993
+ * - 2 times below a radius of 30 m, 1.6 times below 60 m, 1.3 times below 100 m and 1 time below 175 m.
2994
+ * - Not at all on a curve wider than 175 m, which scores 0.
2995
+ */
2996
+ curvinessScore: number;
2997
+ /**
2998
+ * How hard the curve is to drive, from 0 to 1: how much a driver slows down for it, from the
2999
+ * speed limit on the road leading into it.
3000
+ *
3001
+ * @remarks
3002
+ * - It grows as the radius shrinks. A shallow curve counts as wider than its radius, since a
3003
+ * driver can straighten it out across the lane, but a hairpin can't be straightened.
3004
+ * - A turn at a junction, with a turn, U-turn or roundabout `maneuver`, scores as one the driver
3005
+ * slows right down for, however wide its corner is drawn.
3006
+ * - It reads the route's `speedLimit` sections, so ask for them along with the curves. Where the
3007
+ * route has no limit for the road, it takes a typical limit outside towns.
3008
+ * - A curve a driver takes at the limit scores 0. The tighter the curve is for the road, the
3009
+ * nearer 1 it scores.
3010
+ */
3011
+ severity: number;
3012
+ /**
3013
+ * The maneuver of the guidance instruction on the curve, such as `TURN_LEFT` or
3014
+ * `ROUNDABOUT_RIGHT`. It tells a turn at a junction from a bend of the road, so it is absent:
3015
+ * - On a curve no instruction falls on, or whose only instructions mark no junction: a departure,
3016
+ * an arrival, a waypoint, a border or a tollgate.
3017
+ * - Where the instruction keeps to the road, as "Turn left to stay on the SS38" where a side road
3018
+ * leaves a hairpin, or has no other way to take, as "Follow the road to the left". A roundabout
3019
+ * and a U-turn always name theirs.
3020
+ * - On every curve of a route calculated without `guidance`.
3021
+ */
3022
+ maneuver?: Maneuver;
3023
+ };
3024
+ /**
3025
+ * A curvy stretch of a route: curves that follow one another closely, such as a mountain pass.
3026
+ *
3027
+ * @remarks
3028
+ * The SDK groups the route's curves into stretches, with {@link getCurvyStretchSections}. To list
3029
+ * the curves of a stretch, pass it as `within` to {@link getSectionsWithin}.
3030
+ *
3031
+ * A curve at a maneuver ends a stretch, since a run of turns at junctions makes no winding road.
3032
+ * That takes a route with guidance: without it, turns at junctions between short roads can make one.
3033
+ *
3034
+ * @group Route
3035
+ */
3036
+ export type CurvyStretchSectionProps = SectionProps & {
3037
+ /** How many curves the stretch holds. Over `lengthInMeters`, it says how winding the stretch is. */
3038
+ curveCount: number;
3039
+ /** How many of its curves are hairpins, as {@link isHairpin} tells them. */
3040
+ hairpinCount: number;
3041
+ /** The length of the stretch, along the route. */
3042
+ lengthInMeters: number;
3043
+ /** The radius of the stretch's tightest curve. */
3044
+ minRadiusInMeters: number;
3045
+ /**
3046
+ * The `curvinessScore` of its curves, added up: the higher, the more a rider gets out of it.
3047
+ * Roadcurvature.com, which scores roads the same way, calls those over 1000 very twisty.
3048
+ */
3049
+ curvinessScore: number;
3050
+ };
2815
3051
  /**
2816
3052
  * A route section for a leg, the portion of route between two consecutive waypoints.
2817
3053
  *
@@ -2969,6 +3205,23 @@ export type SectionsProps = {
2969
3205
  carTrain?: SectionProps[];
2970
3206
  /** One section per country the route passes through, each naming that country. */
2971
3207
  country?: CountrySectionProps[];
3208
+ /**
3209
+ * The curves of the route, in order along it.
3210
+ *
3211
+ * @remarks
3212
+ * The SDK finds them in the route's geometry, with {@link getCurveSections} and the thresholds of
3213
+ * the `curveDetection` of `calculateRoute`, when its `sectionTypes` names `curve`.
3214
+ * {@link withCurveSections} finds them again with others.
3215
+ */
3216
+ curve?: CurveSectionProps[];
3217
+ /**
3218
+ * The stretches where curves follow one another closely, in order along the route.
3219
+ *
3220
+ * @remarks
3221
+ * The SDK groups the route's curves into them, with {@link getCurvyStretchSections} and the
3222
+ * thresholds of the `curveDetection` of `calculateRoute`, when its `sectionTypes` names `curvyStretch`.
3223
+ */
3224
+ curvyStretch?: CurvyStretchSectionProps[];
2972
3225
  /**
2973
3226
  * The stretches no other route of the same response drives, in order along the route.
2974
3227
  *
@@ -3046,21 +3299,37 @@ export type SectionsProps = {
3046
3299
  * @group Route
3047
3300
  */
3048
3301
  export type SectionType = keyof SectionsProps;
3302
+ /**
3303
+ * The section types a route calculation returns when its request names none: every type the
3304
+ * routing API returns, and `lanes` with guidance.
3305
+ *
3306
+ * @remarks
3307
+ * A `sectionTypes` list replaces the default rather than adding to it. Spread this one to add to
3308
+ * it, such as the curves, which the SDK finds only when a list names them.
3309
+ *
3310
+ * @example
3311
+ * ```typescript
3312
+ * const routes = await calculateRoute({ locations, sectionTypes: [...defaultSectionTypes, 'curve', 'curvyStretch'] });
3313
+ * ```
3314
+ *
3315
+ * @group Route
3316
+ */
3317
+ export declare const defaultSectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "lanes"];
3049
3318
  /**
3050
3319
  * The section types a route calculation request can ask to include in the response.
3051
3320
  * @group Route
3052
3321
  */
3053
- export declare const inputSectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted"];
3322
+ export declare const inputSectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "curve", "curvyStretch"];
3054
3323
  /**
3055
3324
  * The section types, including guidance-related ones, a route calculation request can ask to include in the response.
3056
3325
  * @group Route
3057
3326
  */
3058
- export declare const inputSectionTypesWithGuidance: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "lanes"];
3327
+ export declare const inputSectionTypesWithGuidance: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "curve", "curvyStretch", "lanes"];
3059
3328
  /**
3060
3329
  * Every section type a route can carry: the requestable ones, plus `leg` and `distinct`, which no request names.
3061
3330
  * @group Route
3062
3331
  */
3063
- export declare const sectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "lanes", "leg", "distinct"];
3332
+ export declare const sectionTypes: readonly ["carpool", "carTrain", "country", "ferry", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "roadShields", "speedLimit", "toll", "tollRoad", "tollVignette", "traffic", "tunnel", "unpaved", "urban", "vehicleRestricted", "curve", "curvyStretch", "lanes", "leg", "distinct"];
3064
3333
  //#endregion
3065
3334
  //#region src/types/route/analysis.d.ts
3066
3335
  /**
@@ -3072,6 +3341,82 @@ type DistinctSectionsOptions = {
3072
3341
  /** Leaves out the sections shorter than this. */
3073
3342
  minLengthInMeters?: number;
3074
3343
  };
3344
+ /**
3345
+ * The thresholds a stretch of road has to reach to count as a curve.
3346
+ *
3347
+ * @remarks
3348
+ * The defaults keep the bends a passenger feels: from a country road's 40° bend on a radius of 250
3349
+ * metres to a hairpin. Lower `maxRadiusInMeters` to keep only hard curves, such as to warn someone
3350
+ * prone to motion sickness, or raise it to count sweeping bends too.
3351
+ *
3352
+ * @group Utils
3353
+ */
3354
+ type CurveSectionsOptions = {
3355
+ /**
3356
+ * Leaves out the curves turning less than this, either way.
3357
+ * @default 40
3358
+ */
3359
+ minHeadingChangeInDegrees?: number;
3360
+ /**
3361
+ * Leaves out the curves wider than this.
3362
+ * @default 250
3363
+ */
3364
+ maxRadiusInMeters?: number;
3365
+ /**
3366
+ * How far the road may run straight within a curve. A longer straight ends it, so two bends
3367
+ * apart are two curves.
3368
+ *
3369
+ * It defaults to 40, or to 15% of a `maxRadiusInMeters` over 267, since a wide curve turns little
3370
+ * over 40 metres.
3371
+ */
3372
+ maxStraightInMeters?: number;
3373
+ };
3374
+ /**
3375
+ * How close curves have to follow one another to make a curvy stretch.
3376
+ *
3377
+ * @group Utils
3378
+ */
3379
+ type CurvyStretchSectionsOptions = {
3380
+ /**
3381
+ * The curves to group, in order along the route. Defaults to the route's `sections.curve`, or to
3382
+ * {@link getCurveSections} with its defaults when the route has none.
3383
+ */
3384
+ curves?: readonly CurveSectionProps[];
3385
+ /**
3386
+ * The longest gap between two curves of one stretch.
3387
+ * @default 500
3388
+ */
3389
+ maxGapInMeters?: number;
3390
+ /**
3391
+ * Leaves out the stretches with fewer curves than this.
3392
+ * @default 3
3393
+ */
3394
+ minCurveCount?: number;
3395
+ };
3396
+ /**
3397
+ * The thresholds a route's curves and curvy stretches are found with.
3398
+ *
3399
+ * @remarks
3400
+ * `calculateRoute` takes it as `curveDetection`, and {@link withCurveSections} to find them again
3401
+ * on a route you already have.
3402
+ *
3403
+ * @example
3404
+ * ```typescript
3405
+ * // Only the hard curves, and the stretches of five or more of them
3406
+ * const curveDetection: CurveDetectionOptions = {
3407
+ * curve: { maxRadiusInMeters: 100 },
3408
+ * curvyStretch: { minCurveCount: 5 },
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
+ };
3075
3420
  /**
3076
3421
  * A route's sections of one type within the spans asked about.
3077
3422
  *
@@ -3127,8 +3472,8 @@ type RouteComparison = {
3127
3472
  */
3128
3473
  type CompareRoutesOptions = {
3129
3474
  /**
3130
- * The section types to weigh. Defaults to every type the routing service returns, leaving out
3131
- * `leg` and `distinct`.
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`.
3132
3477
  */
3133
3478
  types?: readonly SectionType[];
3134
3479
  };
@@ -3626,11 +3971,11 @@ export declare const sdkErrorCodes: readonly ["INVALID_REQUEST", "INSECURE_BASE_
3626
3971
  *
3627
3972
  * | Code | When |
3628
3973
  * | --- | --- |
3629
- * | `INVALID_REQUEST` | The SDK's request validation failed, or the API answered `400` or another `4xx` not below |
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 |
3630
3975
  * | `INSECURE_BASE_URL` | `commonBaseURL` is neither `https:` nor `http:` on a loopback address, checked even with `validateRequest: false` |
3631
3976
  * | `INVALID_CREDENTIALS` | The API answered `401`: the key is missing, invalid or expired |
3632
3977
  * | `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 |
3633
- * | `NOT_FOUND` | The API answered `404` |
3978
+ * | `NOT_FOUND` | The API answered `404`, or `geocodeOne` or `discoverOnePlace` found no place |
3634
3979
  * | `RATE_LIMITED` | The API still answered `429` after the retries `retry` allows |
3635
3980
  * | `LIVE_SERVICE_NOT_AVAILABLE` | The API answered a `5xx` |
3636
3981
  * | `NETWORK_NOT_AVAILABLE` | No response arrived: offline, DNS, TLS or CORS failure |
@@ -4091,11 +4436,15 @@ export type DisplayUnits = {
4091
4436
  * When a service request receives a 429 status code, the SDK retries it with exponential
4092
4437
  * backoff. It respects a `Retry-After` header given in seconds.
4093
4438
  *
4439
+ * @remarks
4440
+ * Without a `Retry-After` header, each wait is drawn at random between half the backoff and the
4441
+ * whole of it, so that clients rate-limited at the same moment don't all retry together.
4442
+ *
4094
4443
  * @example
4095
4444
  * ```typescript
4096
4445
  * TomTomConfig.instance.put({
4097
4446
  * retry: {
4098
- * initialWaitMs: 0.447,
4447
+ * initialWaitMs: 447,
4099
4448
  * backoffFactor: 1.618,
4100
4449
  * timeoutMs: 40000,
4101
4450
  * }
@@ -4106,18 +4455,18 @@ export type DisplayUnits = {
4106
4455
  */
4107
4456
  export type RetryConfig = {
4108
4457
  /**
4109
- * The wait in milliseconds before the first retry.
4458
+ * The backoff in milliseconds before the first retry: the longest the first wait can be.
4110
4459
  *
4111
- * It is the base delay when no `Retry-After` header is present.
4460
+ * It applies when no `Retry-After` header is present.
4112
4461
  *
4113
- * @default 0.447
4462
+ * @default 447
4114
4463
  */
4115
4464
  initialWaitMs?: number;
4116
4465
  /**
4117
- * The multiplier applied to the wait after each retry.
4466
+ * The multiplier applied to the backoff after each retry.
4118
4467
  *
4119
- * For example, with `initialWaitMs: 0.447` and `backoffFactor: 1.618`,
4120
- * the waits are 0.447ms, 0.723ms, 1.170ms and so on.
4468
+ * For example, with `initialWaitMs: 447` and `backoffFactor: 1.618`,
4469
+ * the backoff is 447ms, 723ms, 1170ms and so on.
4121
4470
  *
4122
4471
  * @default 1.618
4123
4472
  */
@@ -4175,7 +4524,7 @@ export type GlobalConfig = {
4175
4524
  /**
4176
4525
  * The language of SDK services and map content.
4177
4526
  *
4178
- * It accepts IETF language codes, case-insensitive, and affects search results,
4527
+ * It accepts the IETF language codes {@link Language} lists, and affects search results,
4179
4528
  * routing instructions, map labels and traffic incident descriptions.
4180
4529
  *
4181
4530
  * @default "ngt" (Neutral Ground Truth - uses local language for each location)
@@ -4232,7 +4581,7 @@ export type GlobalConfig = {
4232
4581
  * By default, the SDK retries requests that receive a 429 status code with exponential backoff.
4233
4582
  * A field you leave out takes its default. To turn retrying off, set it to `undefined`.
4234
4583
  *
4235
- * @default { initialWaitMs: 0.447, backoffFactor: 1.618, timeoutMs: 40000 }
4584
+ * @default { initialWaitMs: 447, backoffFactor: 1.618, timeoutMs: 40000 }
4236
4585
  * @see {@link RetryConfig}
4237
4586
  */
4238
4587
  retry?: RetryConfig;
@@ -4289,8 +4638,8 @@ export declare class TomTomConfig {
4289
4638
  * Merges configuration values into the global configuration.
4290
4639
  *
4291
4640
  * New values override existing ones. The merge is shallow, so a nested object replaces the
4292
- * existing one entirely. The exception is a `retry` object, which takes its missing fields from
4293
- * the default retry config.
4641
+ * existing one entirely. A `retry` object then takes its missing fields from the default retry
4642
+ * config, not from an earlier `put`.
4294
4643
  *
4295
4644
  * @example
4296
4645
  * ```typescript
@@ -4315,6 +4664,10 @@ export declare class TomTomConfig {
4315
4664
  /**
4316
4665
  * Returns the current global configuration.
4317
4666
  *
4667
+ * It holds `apiKey`, `commonBaseURL`, `retry` (unless you set it to `undefined`) and the keys you
4668
+ * set. A key you never set reads `undefined` and behaves as its {@link GlobalConfig} property
4669
+ * describes.
4670
+ *
4318
4671
  * @example
4319
4672
  * ```typescript
4320
4673
  * const config = TomTomConfig.instance.get();
@@ -4350,7 +4703,9 @@ export declare const isProxyCredentialsMode: (config?: Partial<Pick<GlobalConfig
4350
4703
  */
4351
4704
  export declare const isBBoxWithArea: (bbox: OptionalBBox) => boolean;
4352
4705
  /**
4353
- * The bounding box that contains all the given ones, skipping `undefined` entries.
4706
+ * The narrowest bounding box that contains all the given ones, skipping `undefined` entries.
4707
+ *
4708
+ * It crosses the antimeridian, with `west > east`, when that is the narrower way to contain them.
4354
4709
  *
4355
4710
  * @group Utils
4356
4711
  */
@@ -4358,7 +4713,11 @@ export declare const bboxFromBBoxes: (bboxes: OptionalBBox[]) => OptionalBBox;
4358
4713
  /**
4359
4714
  * The bounding box of an array of `[longitude, latitude]` positions, or `undefined` if empty.
4360
4715
  *
4361
- * A very long array is sampled rather than scanned in full, which keeps the box close to exact.
4716
+ * - It reads the positions as loose points, with no edges between them. For a line or a ring, pass it
4717
+ * as GeoJSON to {@link bboxFromGeoJSON}, which follows its edges.
4718
+ * - It crosses the antimeridian, with `west > east`, when that box is narrower than the one from the
4719
+ * lowest to the highest longitude. A tie, or positions spanning -180 to 180, keeps the latter.
4720
+ * - A very long array is sampled rather than scanned in full, which keeps the box close to exact.
4362
4721
  *
4363
4722
  * @group Utils
4364
4723
  */
@@ -4375,8 +4734,16 @@ export declare const bboxFromCoordsArray: (coordinates: Position[] | undefined)
4375
4734
  * An existing bbox wins over the geometry. This matters for Point features from TomTom
4376
4735
  * services, whose bbox may cover a broader area than the point itself.
4377
4736
  *
4737
+ * A calculated box crosses the antimeridian, with `west > east`, when that is the narrower way to
4738
+ * enclose the input:
4739
+ * - Points and multi-points take the narrower box, as {@link bboxFromCoordsArray} does.
4740
+ * - A line or a ring follows its edges, which never wrap across the antimeridian (RFC 7946 §3.1.9):
4741
+ * `[[179, 0], [-179, 0]]` spans 358°, and `[[179, 0], [181, 0]]` gives `[179, 0, -179, 0]`.
4742
+ * - The parts of a multi-geometry and the members of a collection merge as {@link bboxFromBBoxes} does,
4743
+ * so a polygon cut at 180, as RFC 7946 asks, gets the box across the antimeridian.
4744
+ *
4378
4745
  * @param hasBBox A GeoJSON object, such as a Feature, FeatureCollection or Geometry, or an array of them.
4379
- * @returns The bounding box as `[minLng, minLat, maxLng, maxLat]`, or `undefined` for invalid input.
4746
+ * @returns The bounding box as `[west, south, east, north]`, or `undefined` for invalid input.
4380
4747
  *
4381
4748
  * @example
4382
4749
  * ```typescript
@@ -4425,15 +4792,162 @@ export declare const bboxFromGeoJSON: (hasBBox: HasBBox) => OptionalBBox;
4425
4792
  *
4426
4793
  * @group Utils
4427
4794
  */
4428
- export declare const bboxCenter: ([west, south, east, north]: BBox) => Position;
4795
+ export declare const bboxCenter: (bbox: BBox) => Position;
4429
4796
  /**
4430
4797
  * Creates a GeoJSON Polygon Feature representing the area of the given bounding box.
4798
+ *
4799
+ * For a box crossing the antimeridian, with `west > east`, the ring's east edge is `east + 360`, which
4800
+ * keeps it around the box rather than around the rest of the world.
4801
+ *
4431
4802
  * @param bbox The bounding box as `[west, south, east, north]`.
4432
4803
  *
4433
4804
  * @group Utils
4434
4805
  */
4435
4806
  export declare const polygonFromBBox: (bbox: BBox) => Feature<Polygon>;
4436
4807
  //#endregion
4808
+ //#region src/util/cells.d.ts
4809
+ /**
4810
+ * Groups points into cells, a grid of hexagons or squares or your own polygons, and gives each cell
4811
+ * statistics over a value of its points, such as the median price per square metre.
4812
+ *
4813
+ * @param points - The points to aggregate.
4814
+ * @param options - The cells, the value and the statistics.
4815
+ * @returns A polygon per cell holding at least `minCount` points, with the statistics as its properties,
4816
+ * for any map module to draw, such as `CustomGeoJSONModule`.
4817
+ *
4818
+ * @remarks
4819
+ * - A grid cell is found from the point's coordinates alone, so the cost grows with the points, not the
4820
+ * cells. Every point with a value and finite coordinates lands in a cell, and the cells around the
4821
+ * antimeridian stay side by side, their longitudes past ±180 where needed. A grid cell's `id` names
4822
+ * its grid, column and row: `'hex:3:-2'`.
4823
+ * - Your own polygons are tested point by point, after a bounding-box check. A point inside several of
4824
+ * them counts in each.
4825
+ * - The cell size is fixed. To follow the zoom, aggregate again on the map's `zoomend` with a size for
4826
+ * the new zoom.
4827
+ *
4828
+ * @example
4829
+ * ```typescript
4830
+ * const cells = aggregateIntoCells(listings, {
4831
+ * grid: 'hex',
4832
+ * cellSizeKM: 1,
4833
+ * value: 'pricePerSquareMeter',
4834
+ * stats: ['median', 'mean', 'count'],
4835
+ * minCount: 5,
4836
+ * });
4837
+ * // Each cell's properties: { median, mean, count }
4838
+ * ```
4839
+ *
4840
+ * @group Utils
4841
+ */
4842
+ export declare const aggregateIntoCells: <P extends GeoJsonProperties, const S extends CellStatistic = "count", const G extends CellGrid = CellGrid>(points: FeatureCollection<Point, P>, options: AggregateIntoCellsOptions<P, S, G>) => AggregatedCells<S, G>;
4843
+ //#endregion
4844
+ //#region src/util/curves.d.ts
4845
+ /**
4846
+ * Finds the curves of a route: the stretches where the road keeps turning the same way.
4847
+ *
4848
+ * @param route The route, with its geometry, and its guidance instructions when it has them.
4849
+ * @param options The thresholds a stretch has to reach to count as a curve.
4850
+ * @returns The curves, in order along the route.
4851
+ *
4852
+ * @remarks
4853
+ * - `calculateRoute` fills `sections.curve` when its `sectionTypes` names `curve`, with these
4854
+ * thresholds from its `curveDetection.curve`. Call this, or {@link withCurveSections}, to find
4855
+ * them again with others.
4856
+ * - A curve ends at a straight longer than `maxStraightInMeters`, or where the road turns the
4857
+ * other way, so an S-bend is two curves.
4858
+ * - A sharp corner between two straights, as at most junctions, is no curve: the road doesn't bend
4859
+ * there. A roundabout is, and on a route with guidance a curve at a junction names its
4860
+ * `maneuver`, as {@link CurveSectionProps} sets out.
4861
+ * - Where a route turns back at a waypoint, as at the end of a dead-end road, it makes no curve.
4862
+ * - Each curve's `severity` reads the route's `speedLimit` sections, when it has them.
4863
+ *
4864
+ * @example
4865
+ * ```typescript
4866
+ * // Only the hard curves, to warn a passenger prone to motion sickness
4867
+ * const hard = getCurveSections(route, { maxRadiusInMeters: 50, minHeadingChangeInDegrees: 60 });
4868
+ * ```
4869
+ *
4870
+ * @group Utils
4871
+ */
4872
+ export declare const getCurveSections: (route: Route, { minHeadingChangeInDegrees, maxRadiusInMeters, maxStraightInMeters }?: CurveSectionsOptions) => CurveSectionProps[];
4873
+ /**
4874
+ * Whether a curve is a hairpin: a bend of the road turning 140° or more on a radius of 40 m or less,
4875
+ * as the numbered bends of a mountain pass do.
4876
+ *
4877
+ * @remarks
4878
+ * - A wider bend that turns as far, as where a valley road swings round a spur, is a horseshoe a
4879
+ * driver takes at speed, and no hairpin.
4880
+ * - A curve at a maneuver, as a roundabout or a turn at a junction, is no hairpin however far it
4881
+ * turns.
4882
+ * - A curvy stretch's `hairpinCount` counts its curves this says yes to.
4883
+ *
4884
+ * @example
4885
+ * ```typescript
4886
+ * const hairpins = route.properties.sections.curve?.filter(isHairpin) ?? [];
4887
+ * ```
4888
+ *
4889
+ * @group Utils
4890
+ */
4891
+ export declare const isHairpin: (curve: Pick<CurveSectionProps, "headingChangeInDegrees" | "radiusInMeters" | "maneuver">) => boolean;
4892
+ /**
4893
+ * Finds the curvy stretches of a route: where curves follow one another closely, such as a
4894
+ * mountain pass or a winding country road.
4895
+ *
4896
+ * @param route The route, with its geometry.
4897
+ * @param options The curves to group, and how close they have to follow one another.
4898
+ * @returns The curvy stretches, in order along the route.
4899
+ *
4900
+ * @remarks
4901
+ * - `calculateRoute` fills `sections.curvyStretch` when its `sectionTypes` names `curvyStretch`,
4902
+ * with these thresholds from its `curveDetection.curvyStretch`. Call this for others, or over
4903
+ * curves you found with your own {@link getCurveSections} thresholds.
4904
+ * - A curve at a maneuver ends a stretch, as {@link CurvyStretchSectionProps} sets out.
4905
+ * - A stretch's `curveCount` over its `lengthInMeters` says how winding it is: the hairpins of a
4906
+ * mountain pass come one every 200 m or so. Rank the stretches by it to seek out the best roads, or
4907
+ * to tell which route stays clear of them. Its `hairpinCount` says how many of them are hairpins,
4908
+ * as {@link isHairpin} tells them.
4909
+ * - Its `curvinessScore` adds up its curves' scores, so a longer stretch scores more. Roadcurvature.com,
4910
+ * which scores roads the same way, lists them from 300 and calls those over 1000 very twisty.
4911
+ *
4912
+ * @example
4913
+ * ```typescript
4914
+ * const routes = await calculateRoute({ locations, costModel: { routeType: 'thrilling' }, guidance: { type: 'coded' } });
4915
+ * const passes = getCurvyStretchSections(routes.features[0], { minCurveCount: 5 });
4916
+ * passes.forEach((pass) => console.log(`${pass.curveCount} curves in ${formatDistance(pass.lengthInMeters)}`));
4917
+ *
4918
+ * // The most rewarding stretch to ride
4919
+ * const best = passes.toSorted((first, second) => second.curvinessScore - first.curvinessScore)[0];
4920
+ * ```
4921
+ *
4922
+ * @group Utils
4923
+ */
4924
+ export declare const getCurvyStretchSections: (route: Route, { curves, maxGapInMeters, minCurveCount }?: CurvyStretchSectionsOptions) => CurvyStretchSectionProps[];
4925
+ /**
4926
+ * A copy of a route with its curves and curvy stretches found again, with thresholds of your own.
4927
+ *
4928
+ * @param route The route, with its geometry, and its guidance instructions when it has them.
4929
+ * @param options The thresholds, `calculateRoute`'s `curveDetection` among them.
4930
+ * @returns The route with new `sections.curve` and `sections.curvyStretch`, each left out when it
4931
+ * finds none. Its other sections stay as they are.
4932
+ *
4933
+ * @remarks
4934
+ * - Tune the thresholds on routes you already have, with no new request. Calling
4935
+ * {@link getCurveSections} and {@link getCurvyStretchSections} yourself does the same, as long as
4936
+ * you pass the new curves to the second.
4937
+ * - The curves read the route as it came back: a `maneuver` needs its guidance, and a `severity`
4938
+ * its `speedLimit` sections. Ask for both when you calculate it.
4939
+ *
4940
+ * @example
4941
+ * ```typescript
4942
+ * // Count the sweeping bends of up to 500 m too
4943
+ * const wider = routes.features.map((route) => withCurveSections(route, { curve: { maxRadiusInMeters: 500 } }));
4944
+ * await routingModule.showRoutes({ ...routes, features: wider });
4945
+ * ```
4946
+ *
4947
+ * @group Utils
4948
+ */
4949
+ export declare const withCurveSections: (route: Route, { curve, curvyStretch }?: CurveDetectionOptions) => Route;
4950
+ //#endregion
4437
4951
  //#region src/util/distinctSections.d.ts
4438
4952
  /**
4439
4953
  * Finds the stretches of each route that none of the other routes drives.
@@ -4467,6 +4981,26 @@ export declare const getDistinctSections: (routes: Routes | Route[], { minLength
4467
4981
  */
4468
4982
  export declare const generateId: () => string;
4469
4983
  //#endregion
4984
+ //#region src/util/geopoliticalView.d.ts
4985
+ /**
4986
+ * Tells whether the SDK sends `view` to that API, so you can label a result with the view its request carried.
4987
+ *
4988
+ * @remarks
4989
+ * The map and the services decide what to send from this same predicate. A request without its
4990
+ * view gets the API's default, as {@link GeopoliticalView} describes.
4991
+ *
4992
+ * @example
4993
+ * ```typescript
4994
+ * const place = await reverseGeocode({ position, geopoliticalView: 'US' });
4995
+ * // false: the address is in the default view for the caller's country
4996
+ * const label = servesGeopoliticalView('US', 'reverseGeocoding') ? 'US' : 'Default view';
4997
+ * ```
4998
+ *
4999
+ * @see [Supported views](https://docs.tomtom.com/maps-sdk-js/guides/core/geopolitical-views#supported-views)
5000
+ * @group Shared
5001
+ */
5002
+ export declare const servesGeopoliticalView: (view: GeopoliticalView, api: GeopoliticalViewAPI) => boolean;
5003
+ //#endregion
4470
5004
  //#region src/util/headers.d.ts
4471
5005
  /**
4472
5006
  * SDK name used TomTom custom header tomtom-user-agent
@@ -4545,6 +5079,9 @@ export declare const getInstructionLanes: (route: Route, instruction: Pick<Instr
4545
5079
  * - GeoJSON Point geometries
4546
5080
  * - GeoJSON Point Features, including Places with entry points
4547
5081
  *
5082
+ * With `main-when-available`, a place with no entry point typed `'main'` uses its first untyped one, as
5083
+ * reverse geocoding returns them. {@link GetPositionEntryPointOption} has the full rule.
5084
+ *
4548
5085
  * @param hasLngLat An object that is or contains a lng-lat position.
4549
5086
  * @param options How to extract the position.
4550
5087
  * @returns The extracted position as `[longitude, latitude]`, or `null` if the input is invalid.
@@ -4837,7 +5374,7 @@ export declare const getRouteProgressForSection: (route: Route, section: RouteSp
4837
5374
  *
4838
5375
  * @param route The route containing the section.
4839
5376
  * @param section The section, or any {@link RouteSpan}, to calculate the bbox for.
4840
- * @returns The bounding box as `[minLng, minLat, maxLng, maxLat]`, or `undefined` if the section or route is invalid.
5377
+ * @returns The bounding box as `[west, south, east, north]`, or `undefined` if the section or route is invalid.
4841
5378
  *
4842
5379
  * @remarks
4843
5380
  * - Three points are fast, but a winding section can stray outside their box. For a tighter box,
@@ -4850,7 +5387,7 @@ export declare const getRouteProgressForSection: (route: Route, section: RouteSp
4850
5387
  * // section = { id: 'section-1', startPointIndex: 0, endPointIndex: 3, countryCodeISO3: 'NLD' }
4851
5388
  *
4852
5389
  * const bbox = getSectionBBox(route, section);
4853
- * // Returns: [minLng, minLat, maxLng, maxLat] spanning the section, or undefined
5390
+ * // Returns: [west, south, east, north] spanning the section, or undefined
4854
5391
  * ```
4855
5392
  *
4856
5393
  * @group Utils
@@ -5088,4 +5625,4 @@ export declare const formatDuration: (seconds: number | undefined, options?: Tim
5088
5625
  */
5089
5626
  export declare const formatDistance: (meters: number | undefined, options?: DistanceDisplayUnits) => string;
5090
5627
  //#endregion
5091
- export type { Anything, BBox, ChargingPark, CompareRoutesOptions, DistanceUnitsType, DistinctSectionsOptions, DrivingSide, FeatureCollectionWithProperties, Fuel, GeometryDataSource, GetPositionEntryPointOption, GetPositionOptions, Guidance, HasBBox, HasLngLat, ImportantRoad, ImportantRoadsOptions, Instruction, InstructionText, Landmark, LegSummary, Maneuver, ManeuverAngle, ManeuverView, Moment, 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 };
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 };