@xylabs/geo 5.0.84 → 5.0.87
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/README.md +150 -230
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
17
17
|
|
|
18
|
+
|
|
19
|
+
|
|
18
20
|
## Reference
|
|
19
21
|
|
|
20
22
|
**@xylabs/geo**
|
|
@@ -23,39 +25,47 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
23
25
|
|
|
24
26
|
## Classes
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
| Class | Description |
|
|
29
|
+
| ------ | ------ |
|
|
30
|
+
| [GeoJson](#classes/GeoJson) | Provides GeoJSON geometry and MapBox source generation from a quadkey. |
|
|
31
|
+
| [LayerBase](#classes/LayerBase) | Abstract base class for managing MapBox map layers with add/remove lifecycle. |
|
|
32
|
+
| [MercatorBoundingBox](#classes/MercatorBoundingBox) | A Mercator bounding box extending MapBox LngLatBounds. |
|
|
33
|
+
| [MercatorLngLat](#classes/MercatorLngLat) | A Mercator coordinate extending MapBox LngLat. |
|
|
30
34
|
|
|
31
35
|
## Type Aliases
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
| Type Alias | Description |
|
|
38
|
+
| ------ | ------ |
|
|
39
|
+
| [MercatorTile](#type-aliases/MercatorTile) | A Mercator tile represented as [x, y, zoom]. |
|
|
40
|
+
| [MercatorBoundary](#type-aliases/MercatorBoundary) | An ordered array of MercatorLngLat points forming a boundary. |
|
|
35
41
|
|
|
36
42
|
## Variables
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
| Variable | Description |
|
|
45
|
+
| ------ | ------ |
|
|
46
|
+
| [d2r](#variables/d2r) | Conversion factor from degrees to radians. |
|
|
47
|
+
| [r2d](#variables/r2d) | Conversion factor from radians to degrees. |
|
|
40
48
|
|
|
41
49
|
## Functions
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
| Function | Description |
|
|
52
|
+
| ------ | ------ |
|
|
53
|
+
| [boundingBoxToBoundary](#functions/boundingBoxToBoundary) | Converts a bounding box to an ordered boundary polygon (closed ring of corner points). |
|
|
54
|
+
| [boundingBoxToCenter](#functions/boundingBoxToCenter) | Computes the center point of a bounding box as [lng, lat], rounded to the specified decimal places. |
|
|
55
|
+
| [boundingBoxToPolygon](#functions/boundingBoxToPolygon) | Converts a bounding box to a GeoJSON Polygon geometry. |
|
|
56
|
+
| [tileFromPoint](#functions/tileFromPoint) | Converts a geographic point to the integer Mercator tile containing it at the given zoom level. |
|
|
57
|
+
| [tileFromQuadkey](#functions/tileFromQuadkey) | Converts a quadkey string to a Mercator tile [x, y, zoom]. |
|
|
58
|
+
| [tileToBoundingBox](#functions/tileToBoundingBox) | Converts a Mercator tile to its geographic bounding box. |
|
|
59
|
+
| [tileToChildren](#functions/tileToChildren) | Returns the four child tiles at one zoom level higher. |
|
|
60
|
+
| [tileToGeoJson](#functions/tileToGeoJson) | Converts a Mercator tile to a GeoJSON Polygon geometry. |
|
|
61
|
+
| [tileToParent](#functions/tileToParent) | Returns the parent tile at one zoom level lower. |
|
|
62
|
+
| [tileToPoint](#functions/tileToPoint) | Returns the center point of a Mercator tile. |
|
|
63
|
+
| [tileToQuadkey](#functions/tileToQuadkey) | Converts a Mercator tile to its quadkey string representation. |
|
|
64
|
+
| [tileToSiblings](#functions/tileToSiblings) | Returns the four sibling tiles (children of the parent tile) for the given tile. |
|
|
65
|
+
| [tilesEqual](#functions/tilesEqual) | Checks whether two Mercator tiles are equal by comparing their x, y, and zoom values. |
|
|
66
|
+
| [tilesFromBoundingBox](#functions/tilesFromBoundingBox) | Returns all Mercator tiles that intersect the given bounding box at the specified zoom level. |
|
|
67
|
+
| [hasSiblings](#functions/hasSiblings) | Checks whether all four siblings of the given tile exist in the tile array. |
|
|
68
|
+
| [tilesHasTile](#functions/tilesHasTile) | Checks whether a specific tile exists in the given tile array. |
|
|
59
69
|
|
|
60
70
|
### classes
|
|
61
71
|
|
|
@@ -72,14 +82,14 @@ Provides GeoJSON geometry and MapBox source generation from a quadkey.
|
|
|
72
82
|
### Constructor
|
|
73
83
|
|
|
74
84
|
```ts
|
|
75
|
-
new GeoJson(quadkey): GeoJson;
|
|
85
|
+
new GeoJson(quadkey: string): GeoJson;
|
|
76
86
|
```
|
|
77
87
|
|
|
78
88
|
### Parameters
|
|
79
89
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
`string`
|
|
90
|
+
| Parameter | Type |
|
|
91
|
+
| ------ | ------ |
|
|
92
|
+
| `quadkey` | `string` |
|
|
83
93
|
|
|
84
94
|
### Returns
|
|
85
95
|
|
|
@@ -90,18 +100,16 @@ new GeoJson(quadkey): GeoJson;
|
|
|
90
100
|
### featureCollection()
|
|
91
101
|
|
|
92
102
|
```ts
|
|
93
|
-
static featureCollection(features): FeatureCollection;
|
|
103
|
+
static featureCollection(features: Feature<Geometry, GeoJsonProperties>[]): FeatureCollection;
|
|
94
104
|
```
|
|
95
105
|
|
|
96
106
|
Creates a GeoJSON FeatureCollection from an array of features.
|
|
97
107
|
|
|
98
108
|
### Parameters
|
|
99
109
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
`Feature`\<`Geometry`, `GeoJsonProperties`\>[]
|
|
103
|
-
|
|
104
|
-
The features to include
|
|
110
|
+
| Parameter | Type | Description |
|
|
111
|
+
| ------ | ------ | ------ |
|
|
112
|
+
| `features` | `Feature`\<`Geometry`, `GeoJsonProperties`\>[] | The features to include |
|
|
105
113
|
|
|
106
114
|
### Returns
|
|
107
115
|
|
|
@@ -114,18 +122,16 @@ A GeoJSON FeatureCollection
|
|
|
114
122
|
### featuresSource()
|
|
115
123
|
|
|
116
124
|
```ts
|
|
117
|
-
static featuresSource(data): GeoJSONSourceSpecification;
|
|
125
|
+
static featuresSource(data: FeatureCollection): GeoJSONSourceSpecification;
|
|
118
126
|
```
|
|
119
127
|
|
|
120
128
|
Creates a MapBox GeoJSON source specification from a FeatureCollection.
|
|
121
129
|
|
|
122
130
|
### Parameters
|
|
123
131
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
`FeatureCollection`
|
|
127
|
-
|
|
128
|
-
The FeatureCollection to use as the source data
|
|
132
|
+
| Parameter | Type | Description |
|
|
133
|
+
| ------ | ------ | ------ |
|
|
134
|
+
| `data` | `FeatureCollection` | The FeatureCollection to use as the source data |
|
|
129
135
|
|
|
130
136
|
### Returns
|
|
131
137
|
|
|
@@ -138,18 +144,16 @@ A MapBox GeoJSON source specification
|
|
|
138
144
|
### geometryFeature()
|
|
139
145
|
|
|
140
146
|
```ts
|
|
141
|
-
static geometryFeature(geometry): Feature;
|
|
147
|
+
static geometryFeature(geometry: Geometry): Feature;
|
|
142
148
|
```
|
|
143
149
|
|
|
144
150
|
Wraps a geometry object in a GeoJSON Feature.
|
|
145
151
|
|
|
146
152
|
### Parameters
|
|
147
153
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
`Geometry`
|
|
151
|
-
|
|
152
|
-
The geometry to wrap
|
|
154
|
+
| Parameter | Type | Description |
|
|
155
|
+
| ------ | ------ | ------ |
|
|
156
|
+
| `geometry` | `Geometry` | The geometry to wrap |
|
|
153
157
|
|
|
154
158
|
### Returns
|
|
155
159
|
|
|
@@ -307,27 +311,24 @@ Abstract base class for managing MapBox map layers with add/remove lifecycle.
|
|
|
307
311
|
|
|
308
312
|
## Type Parameters
|
|
309
313
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
`T` *extends* `MapBox.Layer`
|
|
314
|
+
| Type Parameter |
|
|
315
|
+
| ------ |
|
|
316
|
+
| `T` *extends* `MapBox.Layer` |
|
|
313
317
|
|
|
314
318
|
## Constructors
|
|
315
319
|
|
|
316
320
|
### Constructor
|
|
317
321
|
|
|
318
322
|
```ts
|
|
319
|
-
new LayerBase<T>(id, source): LayerBase<T>;
|
|
323
|
+
new LayerBase<T>(id: string, source: string): LayerBase<T>;
|
|
320
324
|
```
|
|
321
325
|
|
|
322
326
|
### Parameters
|
|
323
327
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
`string`
|
|
327
|
-
|
|
328
|
-
#### source
|
|
329
|
-
|
|
330
|
-
`string`
|
|
328
|
+
| Parameter | Type |
|
|
329
|
+
| ------ | ------ |
|
|
330
|
+
| `id` | `string` |
|
|
331
|
+
| `source` | `string` |
|
|
331
332
|
|
|
332
333
|
### Returns
|
|
333
334
|
|
|
@@ -335,43 +336,27 @@ new LayerBase<T>(id, source): LayerBase<T>;
|
|
|
335
336
|
|
|
336
337
|
## Properties
|
|
337
338
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
id
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
***
|
|
345
|
-
|
|
346
|
-
### source
|
|
347
|
-
|
|
348
|
-
```ts
|
|
349
|
-
source: string;
|
|
350
|
-
```
|
|
339
|
+
| Property | Type |
|
|
340
|
+
| ------ | ------ |
|
|
341
|
+
| <a id="id"></a> `id` | `string` |
|
|
342
|
+
| <a id="source"></a> `source` | `string` |
|
|
351
343
|
|
|
352
344
|
## Methods
|
|
353
345
|
|
|
354
346
|
### update()
|
|
355
347
|
|
|
356
348
|
```ts
|
|
357
|
-
update(map, show
|
|
349
|
+
update(map: Map$1, show?: boolean): void;
|
|
358
350
|
```
|
|
359
351
|
|
|
360
352
|
Removes and re-adds the layer on the map, optionally hiding it.
|
|
361
353
|
|
|
362
354
|
### Parameters
|
|
363
355
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
`Map$1`
|
|
367
|
-
|
|
368
|
-
The MapBox map instance
|
|
369
|
-
|
|
370
|
-
#### show?
|
|
371
|
-
|
|
372
|
-
`boolean` = `true`
|
|
373
|
-
|
|
374
|
-
Whether to show the layer after updating (default true)
|
|
356
|
+
| Parameter | Type | Default value | Description |
|
|
357
|
+
| ------ | ------ | ------ | ------ |
|
|
358
|
+
| `map` | `Map$1` | `undefined` | The MapBox map instance |
|
|
359
|
+
| `show` | `boolean` | `true` | Whether to show the layer after updating (default true) |
|
|
375
360
|
|
|
376
361
|
### Returns
|
|
377
362
|
|
|
@@ -408,18 +393,18 @@ A Mercator bounding box extending MapBox LngLatBounds.
|
|
|
408
393
|
### Constructor
|
|
409
394
|
|
|
410
395
|
```ts
|
|
411
|
-
new MercatorBoundingBox(sw
|
|
396
|
+
new MercatorBoundingBox(sw?:
|
|
397
|
+
| [number, number, number, number]
|
|
398
|
+
| LngLatLike
|
|
399
|
+
| [LngLatLike, LngLatLike], ne?: LngLatLike): MercatorBoundingBox;
|
|
412
400
|
```
|
|
413
401
|
|
|
414
402
|
### Parameters
|
|
415
403
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
\[`number`, `number`, `number`, `number`\]
|
|
419
|
-
|
|
420
|
-
#### ne?
|
|
421
|
-
|
|
422
|
-
`LngLatLike`
|
|
404
|
+
| Parameter | Type |
|
|
405
|
+
| ------ | ------ |
|
|
406
|
+
| `sw?` | \| \[`number`, `number`, `number`, `number`\] \| `LngLatLike` \| \[`LngLatLike`, `LngLatLike`\] |
|
|
407
|
+
| `ne?` | `LngLatLike` |
|
|
423
408
|
|
|
424
409
|
### Returns
|
|
425
410
|
|
|
@@ -448,18 +433,15 @@ A Mercator coordinate extending MapBox LngLat.
|
|
|
448
433
|
### Constructor
|
|
449
434
|
|
|
450
435
|
```ts
|
|
451
|
-
new MercatorLngLat(lng, lat): MercatorLngLat;
|
|
436
|
+
new MercatorLngLat(lng: number, lat: number): MercatorLngLat;
|
|
452
437
|
```
|
|
453
438
|
|
|
454
439
|
### Parameters
|
|
455
440
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
`number`
|
|
459
|
-
|
|
460
|
-
#### lat
|
|
461
|
-
|
|
462
|
-
`number`
|
|
441
|
+
| Parameter | Type |
|
|
442
|
+
| ------ | ------ |
|
|
443
|
+
| `lng` | `number` |
|
|
444
|
+
| `lat` | `number` |
|
|
463
445
|
|
|
464
446
|
### Returns
|
|
465
447
|
|
|
@@ -480,18 +462,16 @@ MapBox.LngLat.constructor
|
|
|
480
462
|
***
|
|
481
463
|
|
|
482
464
|
```ts
|
|
483
|
-
function boundingBoxToBoundary(box): MercatorBoundary;
|
|
465
|
+
function boundingBoxToBoundary(box: MercatorBoundingBox): MercatorBoundary;
|
|
484
466
|
```
|
|
485
467
|
|
|
486
468
|
Converts a bounding box to an ordered boundary polygon (closed ring of corner points).
|
|
487
469
|
|
|
488
470
|
## Parameters
|
|
489
471
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
[`MercatorBoundingBox`](#../classes/MercatorBoundingBox)
|
|
493
|
-
|
|
494
|
-
The bounding box to convert
|
|
472
|
+
| Parameter | Type | Description |
|
|
473
|
+
| ------ | ------ | ------ |
|
|
474
|
+
| `box` | [`MercatorBoundingBox`](#../classes/MercatorBoundingBox) | The bounding box to convert |
|
|
495
475
|
|
|
496
476
|
## Returns
|
|
497
477
|
|
|
@@ -506,24 +486,17 @@ An array of corner points forming a closed boundary
|
|
|
506
486
|
***
|
|
507
487
|
|
|
508
488
|
```ts
|
|
509
|
-
function boundingBoxToCenter(boundingBox, decimal
|
|
489
|
+
function boundingBoxToCenter(boundingBox: MercatorBoundingBox, decimal?: number): number[];
|
|
510
490
|
```
|
|
511
491
|
|
|
512
492
|
Computes the center point of a bounding box as [lng, lat], rounded to the specified decimal places.
|
|
513
493
|
|
|
514
494
|
## Parameters
|
|
515
495
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
[`MercatorBoundingBox`](#../classes/MercatorBoundingBox)
|
|
519
|
-
|
|
520
|
-
The bounding box to find the center of
|
|
521
|
-
|
|
522
|
-
### decimal?
|
|
523
|
-
|
|
524
|
-
`number` = `6`
|
|
525
|
-
|
|
526
|
-
Number of decimal places for rounding (default 6)
|
|
496
|
+
| Parameter | Type | Default value | Description |
|
|
497
|
+
| ------ | ------ | ------ | ------ |
|
|
498
|
+
| `boundingBox` | [`MercatorBoundingBox`](#../classes/MercatorBoundingBox) | `undefined` | The bounding box to find the center of |
|
|
499
|
+
| `decimal` | `number` | `6` | Number of decimal places for rounding (default 6) |
|
|
527
500
|
|
|
528
501
|
## Returns
|
|
529
502
|
|
|
@@ -538,18 +511,16 @@ A [longitude, latitude] tuple representing the center
|
|
|
538
511
|
***
|
|
539
512
|
|
|
540
513
|
```ts
|
|
541
|
-
function boundingBoxToPolygon(box): Polygon;
|
|
514
|
+
function boundingBoxToPolygon(box: MercatorBoundingBox): Polygon;
|
|
542
515
|
```
|
|
543
516
|
|
|
544
517
|
Converts a bounding box to a GeoJSON Polygon geometry.
|
|
545
518
|
|
|
546
519
|
## Parameters
|
|
547
520
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
[`MercatorBoundingBox`](#../classes/MercatorBoundingBox)
|
|
551
|
-
|
|
552
|
-
The bounding box to convert
|
|
521
|
+
| Parameter | Type | Description |
|
|
522
|
+
| ------ | ------ | ------ |
|
|
523
|
+
| `box` | [`MercatorBoundingBox`](#../classes/MercatorBoundingBox) | The bounding box to convert |
|
|
553
524
|
|
|
554
525
|
## Returns
|
|
555
526
|
|
|
@@ -564,24 +535,17 @@ A GeoJSON Polygon representing the bounding box
|
|
|
564
535
|
***
|
|
565
536
|
|
|
566
537
|
```ts
|
|
567
|
-
function hasSiblings(tiles, tile): boolean;
|
|
538
|
+
function hasSiblings(tiles: MercatorTile[], tile: MercatorTile): boolean;
|
|
568
539
|
```
|
|
569
540
|
|
|
570
541
|
Checks whether all four siblings of the given tile exist in the tile array.
|
|
571
542
|
|
|
572
543
|
## Parameters
|
|
573
544
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)[]
|
|
577
|
-
|
|
578
|
-
The array of tiles to search
|
|
579
|
-
|
|
580
|
-
### tile
|
|
581
|
-
|
|
582
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
583
|
-
|
|
584
|
-
The tile whose siblings to check for
|
|
545
|
+
| Parameter | Type | Description |
|
|
546
|
+
| ------ | ------ | ------ |
|
|
547
|
+
| `tiles` | [`MercatorTile`](#../type-aliases/MercatorTile)[] | The array of tiles to search |
|
|
548
|
+
| `tile` | [`MercatorTile`](#../type-aliases/MercatorTile) | The tile whose siblings to check for |
|
|
585
549
|
|
|
586
550
|
## Returns
|
|
587
551
|
|
|
@@ -596,24 +560,17 @@ True if all siblings are present in the array
|
|
|
596
560
|
***
|
|
597
561
|
|
|
598
562
|
```ts
|
|
599
|
-
function tileFromPoint(point, z): MercatorTile;
|
|
563
|
+
function tileFromPoint(point: MercatorLngLat, z: number): MercatorTile;
|
|
600
564
|
```
|
|
601
565
|
|
|
602
566
|
Converts a geographic point to the integer Mercator tile containing it at the given zoom level.
|
|
603
567
|
|
|
604
568
|
## Parameters
|
|
605
569
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
[`MercatorLngLat`](#../classes/MercatorLngLat)
|
|
609
|
-
|
|
610
|
-
The geographic coordinate
|
|
611
|
-
|
|
612
|
-
### z
|
|
613
|
-
|
|
614
|
-
`number`
|
|
615
|
-
|
|
616
|
-
The zoom level
|
|
570
|
+
| Parameter | Type | Description |
|
|
571
|
+
| ------ | ------ | ------ |
|
|
572
|
+
| `point` | [`MercatorLngLat`](#../classes/MercatorLngLat) | The geographic coordinate |
|
|
573
|
+
| `z` | `number` | The zoom level |
|
|
617
574
|
|
|
618
575
|
## Returns
|
|
619
576
|
|
|
@@ -628,18 +585,16 @@ The tile as [x, y, zoom]
|
|
|
628
585
|
***
|
|
629
586
|
|
|
630
587
|
```ts
|
|
631
|
-
function tileFromQuadkey(quadkey): MercatorTile;
|
|
588
|
+
function tileFromQuadkey(quadkey: string): MercatorTile;
|
|
632
589
|
```
|
|
633
590
|
|
|
634
591
|
Converts a quadkey string to a Mercator tile [x, y, zoom].
|
|
635
592
|
|
|
636
593
|
## Parameters
|
|
637
594
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
`string`
|
|
641
|
-
|
|
642
|
-
The quadkey string to decode
|
|
595
|
+
| Parameter | Type | Description |
|
|
596
|
+
| ------ | ------ | ------ |
|
|
597
|
+
| `quadkey` | `string` | The quadkey string to decode |
|
|
643
598
|
|
|
644
599
|
## Returns
|
|
645
600
|
|
|
@@ -654,18 +609,16 @@ The tile as [x, y, zoom]
|
|
|
654
609
|
***
|
|
655
610
|
|
|
656
611
|
```ts
|
|
657
|
-
function tileToBoundingBox(tile): MercatorBoundingBox;
|
|
612
|
+
function tileToBoundingBox(tile: MercatorTile): MercatorBoundingBox;
|
|
658
613
|
```
|
|
659
614
|
|
|
660
615
|
Converts a Mercator tile to its geographic bounding box.
|
|
661
616
|
|
|
662
617
|
## Parameters
|
|
663
618
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
667
|
-
|
|
668
|
-
The tile as [x, y, zoom]
|
|
619
|
+
| Parameter | Type | Description |
|
|
620
|
+
| ------ | ------ | ------ |
|
|
621
|
+
| `tile` | [`MercatorTile`](#../type-aliases/MercatorTile) | The tile as [x, y, zoom] |
|
|
669
622
|
|
|
670
623
|
## Returns
|
|
671
624
|
|
|
@@ -680,18 +633,16 @@ The bounding box covering the tile's geographic extent
|
|
|
680
633
|
***
|
|
681
634
|
|
|
682
635
|
```ts
|
|
683
|
-
function tileToChildren(tile): MercatorTile[];
|
|
636
|
+
function tileToChildren(tile: MercatorTile): MercatorTile[];
|
|
684
637
|
```
|
|
685
638
|
|
|
686
639
|
Returns the four child tiles at one zoom level higher.
|
|
687
640
|
|
|
688
641
|
## Parameters
|
|
689
642
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
693
|
-
|
|
694
|
-
The parent tile as [x, y, zoom]
|
|
643
|
+
| Parameter | Type | Description |
|
|
644
|
+
| ------ | ------ | ------ |
|
|
645
|
+
| `tile` | [`MercatorTile`](#../type-aliases/MercatorTile) | The parent tile as [x, y, zoom] |
|
|
695
646
|
|
|
696
647
|
## Returns
|
|
697
648
|
|
|
@@ -706,18 +657,16 @@ An array of four child tiles at zoom + 1
|
|
|
706
657
|
***
|
|
707
658
|
|
|
708
659
|
```ts
|
|
709
|
-
function tileToGeoJson(tile): Polygon;
|
|
660
|
+
function tileToGeoJson(tile: MercatorTile): Polygon;
|
|
710
661
|
```
|
|
711
662
|
|
|
712
663
|
Converts a Mercator tile to a GeoJSON Polygon geometry.
|
|
713
664
|
|
|
714
665
|
## Parameters
|
|
715
666
|
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
719
|
-
|
|
720
|
-
The tile as [x, y, zoom]
|
|
667
|
+
| Parameter | Type | Description |
|
|
668
|
+
| ------ | ------ | ------ |
|
|
669
|
+
| `tile` | [`MercatorTile`](#../type-aliases/MercatorTile) | The tile as [x, y, zoom] |
|
|
721
670
|
|
|
722
671
|
## Returns
|
|
723
672
|
|
|
@@ -732,18 +681,16 @@ A GeoJSON Polygon representing the tile's geographic extent
|
|
|
732
681
|
***
|
|
733
682
|
|
|
734
683
|
```ts
|
|
735
|
-
function tileToParent(tile): MercatorTile;
|
|
684
|
+
function tileToParent(tile: MercatorTile): MercatorTile;
|
|
736
685
|
```
|
|
737
686
|
|
|
738
687
|
Returns the parent tile at one zoom level lower.
|
|
739
688
|
|
|
740
689
|
## Parameters
|
|
741
690
|
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
745
|
-
|
|
746
|
-
The tile as [x, y, zoom]
|
|
691
|
+
| Parameter | Type | Description |
|
|
692
|
+
| ------ | ------ | ------ |
|
|
693
|
+
| `tile` | [`MercatorTile`](#../type-aliases/MercatorTile) | The tile as [x, y, zoom] |
|
|
747
694
|
|
|
748
695
|
## Returns
|
|
749
696
|
|
|
@@ -758,18 +705,16 @@ The parent tile at zoom - 1
|
|
|
758
705
|
***
|
|
759
706
|
|
|
760
707
|
```ts
|
|
761
|
-
function tileToPoint(tile): MercatorLngLat;
|
|
708
|
+
function tileToPoint(tile: MercatorTile): MercatorLngLat;
|
|
762
709
|
```
|
|
763
710
|
|
|
764
711
|
Returns the center point of a Mercator tile.
|
|
765
712
|
|
|
766
713
|
## Parameters
|
|
767
714
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
771
|
-
|
|
772
|
-
The tile as [x, y, zoom]
|
|
715
|
+
| Parameter | Type | Description |
|
|
716
|
+
| ------ | ------ | ------ |
|
|
717
|
+
| `tile` | [`MercatorTile`](#../type-aliases/MercatorTile) | The tile as [x, y, zoom] |
|
|
773
718
|
|
|
774
719
|
## Returns
|
|
775
720
|
|
|
@@ -784,18 +729,16 @@ The center coordinate as a MercatorLngLat
|
|
|
784
729
|
***
|
|
785
730
|
|
|
786
731
|
```ts
|
|
787
|
-
function tileToQuadkey(param0): string;
|
|
732
|
+
function tileToQuadkey(param0: MercatorTile): string;
|
|
788
733
|
```
|
|
789
734
|
|
|
790
735
|
Converts a Mercator tile to its quadkey string representation.
|
|
791
736
|
|
|
792
737
|
## Parameters
|
|
793
738
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
797
|
-
|
|
798
|
-
The tile as [tileX, tileY, tileZoom]
|
|
739
|
+
| Parameter | Type | Description |
|
|
740
|
+
| ------ | ------ | ------ |
|
|
741
|
+
| `param0` | [`MercatorTile`](#../type-aliases/MercatorTile) | The tile as [tileX, tileY, tileZoom] |
|
|
799
742
|
|
|
800
743
|
## Returns
|
|
801
744
|
|
|
@@ -810,18 +753,16 @@ The quadkey string encoding the tile's position and zoom
|
|
|
810
753
|
***
|
|
811
754
|
|
|
812
755
|
```ts
|
|
813
|
-
function tileToSiblings(tile): MercatorTile[];
|
|
756
|
+
function tileToSiblings(tile: MercatorTile): MercatorTile[];
|
|
814
757
|
```
|
|
815
758
|
|
|
816
759
|
Returns the four sibling tiles (children of the parent tile) for the given tile.
|
|
817
760
|
|
|
818
761
|
## Parameters
|
|
819
762
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
823
|
-
|
|
824
|
-
The tile as [x, y, zoom]
|
|
763
|
+
| Parameter | Type | Description |
|
|
764
|
+
| ------ | ------ | ------ |
|
|
765
|
+
| `tile` | [`MercatorTile`](#../type-aliases/MercatorTile) | The tile as [x, y, zoom] |
|
|
825
766
|
|
|
826
767
|
## Returns
|
|
827
768
|
|
|
@@ -836,24 +777,17 @@ An array of four sibling tiles at the same zoom level
|
|
|
836
777
|
***
|
|
837
778
|
|
|
838
779
|
```ts
|
|
839
|
-
function tilesEqual(param0, param1): boolean;
|
|
780
|
+
function tilesEqual(param0: MercatorTile, param1: MercatorTile): boolean;
|
|
840
781
|
```
|
|
841
782
|
|
|
842
783
|
Checks whether two Mercator tiles are equal by comparing their x, y, and zoom values.
|
|
843
784
|
|
|
844
785
|
## Parameters
|
|
845
786
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
849
|
-
|
|
850
|
-
The first tile as [x, y, zoom]
|
|
851
|
-
|
|
852
|
-
### param1
|
|
853
|
-
|
|
854
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
855
|
-
|
|
856
|
-
The second tile as [x, y, zoom]
|
|
787
|
+
| Parameter | Type | Description |
|
|
788
|
+
| ------ | ------ | ------ |
|
|
789
|
+
| `param0` | [`MercatorTile`](#../type-aliases/MercatorTile) | The first tile as [x, y, zoom] |
|
|
790
|
+
| `param1` | [`MercatorTile`](#../type-aliases/MercatorTile) | The second tile as [x, y, zoom] |
|
|
857
791
|
|
|
858
792
|
## Returns
|
|
859
793
|
|
|
@@ -868,24 +802,17 @@ True if both tiles have identical coordinates and zoom
|
|
|
868
802
|
***
|
|
869
803
|
|
|
870
804
|
```ts
|
|
871
|
-
function tilesFromBoundingBox(box, zoom): MercatorTile[];
|
|
805
|
+
function tilesFromBoundingBox(box: MercatorBoundingBox, zoom: number): MercatorTile[];
|
|
872
806
|
```
|
|
873
807
|
|
|
874
808
|
Returns all Mercator tiles that intersect the given bounding box at the specified zoom level.
|
|
875
809
|
|
|
876
810
|
## Parameters
|
|
877
811
|
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
[`MercatorBoundingBox`](#../classes/MercatorBoundingBox)
|
|
881
|
-
|
|
882
|
-
The geographic bounding box
|
|
883
|
-
|
|
884
|
-
### zoom
|
|
885
|
-
|
|
886
|
-
`number`
|
|
887
|
-
|
|
888
|
-
The zoom level
|
|
812
|
+
| Parameter | Type | Description |
|
|
813
|
+
| ------ | ------ | ------ |
|
|
814
|
+
| `box` | [`MercatorBoundingBox`](#../classes/MercatorBoundingBox) | The geographic bounding box |
|
|
815
|
+
| `zoom` | `number` | The zoom level |
|
|
889
816
|
|
|
890
817
|
## Returns
|
|
891
818
|
|
|
@@ -900,24 +827,17 @@ An array of tiles covering the bounding box
|
|
|
900
827
|
***
|
|
901
828
|
|
|
902
829
|
```ts
|
|
903
|
-
function tilesHasTile(tiles, tile): boolean;
|
|
830
|
+
function tilesHasTile(tiles: MercatorTile[], tile: MercatorTile): boolean;
|
|
904
831
|
```
|
|
905
832
|
|
|
906
833
|
Checks whether a specific tile exists in the given tile array.
|
|
907
834
|
|
|
908
835
|
## Parameters
|
|
909
836
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)[]
|
|
913
|
-
|
|
914
|
-
The array of tiles to search
|
|
915
|
-
|
|
916
|
-
### tile
|
|
917
|
-
|
|
918
|
-
[`MercatorTile`](#../type-aliases/MercatorTile)
|
|
919
|
-
|
|
920
|
-
The tile to look for
|
|
837
|
+
| Parameter | Type | Description |
|
|
838
|
+
| ------ | ------ | ------ |
|
|
839
|
+
| `tiles` | [`MercatorTile`](#../type-aliases/MercatorTile)[] | The array of tiles to search |
|
|
840
|
+
| `tile` | [`MercatorTile`](#../type-aliases/MercatorTile) | The tile to look for |
|
|
921
841
|
|
|
922
842
|
## Returns
|
|
923
843
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/geo",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.87",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xylabs",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@types/geojson": "~7946.0.16",
|
|
45
|
-
"mapbox-gl": "~3.
|
|
45
|
+
"mapbox-gl": "~3.20.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
49
|
-
"@xylabs/tsconfig": "~7.4.
|
|
48
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.24",
|
|
49
|
+
"@xylabs/tsconfig": "~7.4.24",
|
|
50
50
|
"typescript": "~5.9.3",
|
|
51
|
-
"vitest": "
|
|
51
|
+
"vitest": "^4.1.0"
|
|
52
52
|
},
|
|
53
53
|
"packageManager": "yarn@3.2.0",
|
|
54
54
|
"publishConfig": {
|