@xylabs/geo 5.0.83 → 5.0.84

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.
Files changed (44) hide show
  1. package/README.md +175 -5
  2. package/dist/neutral/GeoJson.d.ts +26 -0
  3. package/dist/neutral/GeoJson.d.ts.map +1 -1
  4. package/dist/neutral/LayerBase.d.ts +7 -0
  5. package/dist/neutral/LayerBase.d.ts.map +1 -1
  6. package/dist/neutral/index.mjs +30 -0
  7. package/dist/neutral/index.mjs.map +1 -1
  8. package/dist/neutral/mercator/boundingbox/to/boundary.d.ts +5 -0
  9. package/dist/neutral/mercator/boundingbox/to/boundary.d.ts.map +1 -1
  10. package/dist/neutral/mercator/boundingbox/to/center.d.ts +6 -0
  11. package/dist/neutral/mercator/boundingbox/to/center.d.ts.map +1 -1
  12. package/dist/neutral/mercator/boundingbox/to/polygon.d.ts +5 -0
  13. package/dist/neutral/mercator/boundingbox/to/polygon.d.ts.map +1 -1
  14. package/dist/neutral/mercator/constants.d.ts +2 -0
  15. package/dist/neutral/mercator/constants.d.ts.map +1 -1
  16. package/dist/neutral/mercator/tile/from/point.d.ts +6 -0
  17. package/dist/neutral/mercator/tile/from/point.d.ts.map +1 -1
  18. package/dist/neutral/mercator/tile/from/quadkey.d.ts +5 -0
  19. package/dist/neutral/mercator/tile/from/quadkey.d.ts.map +1 -1
  20. package/dist/neutral/mercator/tile/to/boundingbox.d.ts +5 -0
  21. package/dist/neutral/mercator/tile/to/boundingbox.d.ts.map +1 -1
  22. package/dist/neutral/mercator/tile/to/children.d.ts +5 -0
  23. package/dist/neutral/mercator/tile/to/children.d.ts.map +1 -1
  24. package/dist/neutral/mercator/tile/to/geoJson.d.ts +5 -0
  25. package/dist/neutral/mercator/tile/to/geoJson.d.ts.map +1 -1
  26. package/dist/neutral/mercator/tile/to/parent.d.ts +5 -0
  27. package/dist/neutral/mercator/tile/to/parent.d.ts.map +1 -1
  28. package/dist/neutral/mercator/tile/to/point.d.ts +5 -0
  29. package/dist/neutral/mercator/tile/to/point.d.ts.map +1 -1
  30. package/dist/neutral/mercator/tile/to/quadkey.d.ts +5 -0
  31. package/dist/neutral/mercator/tile/to/quadkey.d.ts.map +1 -1
  32. package/dist/neutral/mercator/tile/to/siblings.d.ts +5 -0
  33. package/dist/neutral/mercator/tile/to/siblings.d.ts.map +1 -1
  34. package/dist/neutral/mercator/tiles/equal.d.ts +6 -0
  35. package/dist/neutral/mercator/tiles/equal.d.ts.map +1 -1
  36. package/dist/neutral/mercator/tiles/from/boundingbox.d.ts +6 -0
  37. package/dist/neutral/mercator/tiles/from/boundingbox.d.ts.map +1 -1
  38. package/dist/neutral/mercator/tiles/hasSiblings.d.ts +6 -0
  39. package/dist/neutral/mercator/tiles/hasSiblings.d.ts.map +1 -1
  40. package/dist/neutral/mercator/tiles/hasTile.d.ts +6 -0
  41. package/dist/neutral/mercator/tiles/hasTile.d.ts.map +1 -1
  42. package/dist/neutral/mercator/types.d.ts +4 -0
  43. package/dist/neutral/mercator/types.d.ts.map +1 -1
  44. package/package.json +3 -3
package/README.md CHANGED
@@ -65,6 +65,8 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
65
65
 
66
66
  ***
67
67
 
68
+ Provides GeoJSON geometry and MapBox source generation from a quadkey.
69
+
68
70
  ## Constructors
69
71
 
70
72
  ### Constructor
@@ -91,16 +93,22 @@ new GeoJson(quadkey): GeoJson;
91
93
  static featureCollection(features): FeatureCollection;
92
94
  ```
93
95
 
96
+ Creates a GeoJSON FeatureCollection from an array of features.
97
+
94
98
  ### Parameters
95
99
 
96
100
  #### features
97
101
 
98
102
  `Feature`\<`Geometry`, `GeoJsonProperties`\>[]
99
103
 
104
+ The features to include
105
+
100
106
  ### Returns
101
107
 
102
108
  `FeatureCollection`
103
109
 
110
+ A GeoJSON FeatureCollection
111
+
104
112
  ***
105
113
 
106
114
  ### featuresSource()
@@ -109,16 +117,22 @@ static featureCollection(features): FeatureCollection;
109
117
  static featuresSource(data): GeoJSONSourceSpecification;
110
118
  ```
111
119
 
120
+ Creates a MapBox GeoJSON source specification from a FeatureCollection.
121
+
112
122
  ### Parameters
113
123
 
114
124
  #### data
115
125
 
116
126
  `FeatureCollection`
117
127
 
128
+ The FeatureCollection to use as the source data
129
+
118
130
  ### Returns
119
131
 
120
132
  `GeoJSONSourceSpecification`
121
133
 
134
+ A MapBox GeoJSON source specification
135
+
122
136
  ***
123
137
 
124
138
  ### geometryFeature()
@@ -127,16 +141,22 @@ static featuresSource(data): GeoJSONSourceSpecification;
127
141
  static geometryFeature(geometry): Feature;
128
142
  ```
129
143
 
144
+ Wraps a geometry object in a GeoJSON Feature.
145
+
130
146
  ### Parameters
131
147
 
132
148
  #### geometry
133
149
 
134
150
  `Geometry`
135
151
 
152
+ The geometry to wrap
153
+
136
154
  ### Returns
137
155
 
138
156
  `Feature`
139
157
 
158
+ A GeoJSON Feature containing the geometry
159
+
140
160
  ***
141
161
 
142
162
  ### center()
@@ -145,6 +165,8 @@ static geometryFeature(geometry): Feature;
145
165
  center(): LngLat;
146
166
  ```
147
167
 
168
+ Computes and caches the center point of the quadkey's bounding box as a MapBox LngLat.
169
+
148
170
  ### Returns
149
171
 
150
172
  `LngLat`
@@ -157,6 +179,8 @@ center(): LngLat;
157
179
  point(): Point;
158
180
  ```
159
181
 
182
+ Returns a GeoJSON Point geometry at the center of the quadkey's bounding box.
183
+
160
184
  ### Returns
161
185
 
162
186
  `Point`
@@ -169,6 +193,8 @@ point(): Point;
169
193
  pointFeature(): Feature;
170
194
  ```
171
195
 
196
+ Returns a GeoJSON Feature containing the center point geometry.
197
+
172
198
  ### Returns
173
199
 
174
200
  `Feature`
@@ -181,6 +207,8 @@ pointFeature(): Feature;
181
207
  pointFeatureCollection(): FeatureCollection;
182
208
  ```
183
209
 
210
+ Returns a GeoJSON FeatureCollection containing the center point feature.
211
+
184
212
  ### Returns
185
213
 
186
214
  `FeatureCollection`
@@ -193,6 +221,8 @@ pointFeatureCollection(): FeatureCollection;
193
221
  pointSource(): GeoJSONSourceSpecification;
194
222
  ```
195
223
 
224
+ Returns a MapBox GeoJSON source specification for the center point.
225
+
196
226
  ### Returns
197
227
 
198
228
  `GeoJSONSourceSpecification`
@@ -205,6 +235,8 @@ pointSource(): GeoJSONSourceSpecification;
205
235
  polygon(): Polygon;
206
236
  ```
207
237
 
238
+ Returns a GeoJSON Polygon geometry representing the quadkey's bounding box.
239
+
208
240
  ### Returns
209
241
 
210
242
  `Polygon`
@@ -217,6 +249,8 @@ polygon(): Polygon;
217
249
  polygonFeature(): Feature;
218
250
  ```
219
251
 
252
+ Returns a GeoJSON Feature containing the polygon geometry.
253
+
220
254
  ### Returns
221
255
 
222
256
  `Feature`
@@ -229,6 +263,8 @@ polygonFeature(): Feature;
229
263
  polygonFeatureCollection(): FeatureCollection;
230
264
  ```
231
265
 
266
+ Returns a GeoJSON FeatureCollection containing the polygon feature.
267
+
232
268
  ### Returns
233
269
 
234
270
  `FeatureCollection`
@@ -241,6 +277,8 @@ polygonFeatureCollection(): FeatureCollection;
241
277
  polygonSource(): GeoJSONSourceSpecification;
242
278
  ```
243
279
 
280
+ Returns a MapBox GeoJSON source specification for the polygon.
281
+
244
282
  ### Returns
245
283
 
246
284
  `GeoJSONSourceSpecification`
@@ -253,6 +291,8 @@ polygonSource(): GeoJSONSourceSpecification;
253
291
  zoom(): number;
254
292
  ```
255
293
 
294
+ Returns the zoom level derived from the quadkey length.
295
+
256
296
  ### Returns
257
297
 
258
298
  `number`
@@ -263,6 +303,8 @@ zoom(): number;
263
303
 
264
304
  ***
265
305
 
306
+ Abstract base class for managing MapBox map layers with add/remove lifecycle.
307
+
266
308
  ## Type Parameters
267
309
 
268
310
  ### T
@@ -315,16 +357,22 @@ source: string;
315
357
  update(map, show?): void;
316
358
  ```
317
359
 
360
+ Removes and re-adds the layer on the map, optionally hiding it.
361
+
318
362
  ### Parameters
319
363
 
320
364
  #### map
321
365
 
322
366
  `Map$1`
323
367
 
368
+ The MapBox map instance
369
+
324
370
  #### show?
325
371
 
326
372
  `boolean` = `true`
327
373
 
374
+ Whether to show the layer after updating (default true)
375
+
328
376
  ### Returns
329
377
 
330
378
  `void`
@@ -337,6 +385,8 @@ update(map, show?): void;
337
385
  abstract buildLayer(): T;
338
386
  ```
339
387
 
388
+ Builds the MapBox layer configuration object.
389
+
340
390
  ### Returns
341
391
 
342
392
  `T`
@@ -347,6 +397,8 @@ abstract buildLayer(): T;
347
397
 
348
398
  ***
349
399
 
400
+ A Mercator bounding box extending MapBox LngLatBounds.
401
+
350
402
  ## Extends
351
403
 
352
404
  - `LngLatBounds`
@@ -385,6 +437,8 @@ MapBox.LngLatBounds.constructor
385
437
 
386
438
  ***
387
439
 
440
+ A Mercator coordinate extending MapBox LngLat.
441
+
388
442
  ## Extends
389
443
 
390
444
  - `LngLat`
@@ -429,16 +483,22 @@ MapBox.LngLat.constructor
429
483
  function boundingBoxToBoundary(box): MercatorBoundary;
430
484
  ```
431
485
 
486
+ Converts a bounding box to an ordered boundary polygon (closed ring of corner points).
487
+
432
488
  ## Parameters
433
489
 
434
490
  ### box
435
491
 
436
492
  [`MercatorBoundingBox`](#../classes/MercatorBoundingBox)
437
493
 
494
+ The bounding box to convert
495
+
438
496
  ## Returns
439
497
 
440
498
  [`MercatorBoundary`](#../type-aliases/MercatorBoundary)
441
499
 
500
+ An array of corner points forming a closed boundary
501
+
442
502
  ### <a id="boundingBoxToCenter"></a>boundingBoxToCenter
443
503
 
444
504
  [**@xylabs/geo**](#../README)
@@ -449,20 +509,28 @@ function boundingBoxToBoundary(box): MercatorBoundary;
449
509
  function boundingBoxToCenter(boundingBox, decimal?): number[];
450
510
  ```
451
511
 
512
+ Computes the center point of a bounding box as [lng, lat], rounded to the specified decimal places.
513
+
452
514
  ## Parameters
453
515
 
454
516
  ### boundingBox
455
517
 
456
518
  [`MercatorBoundingBox`](#../classes/MercatorBoundingBox)
457
519
 
520
+ The bounding box to find the center of
521
+
458
522
  ### decimal?
459
523
 
460
524
  `number` = `6`
461
525
 
526
+ Number of decimal places for rounding (default 6)
527
+
462
528
  ## Returns
463
529
 
464
530
  `number`[]
465
531
 
532
+ A [longitude, latitude] tuple representing the center
533
+
466
534
  ### <a id="boundingBoxToPolygon"></a>boundingBoxToPolygon
467
535
 
468
536
  [**@xylabs/geo**](#../README)
@@ -473,16 +541,22 @@ function boundingBoxToCenter(boundingBox, decimal?): number[];
473
541
  function boundingBoxToPolygon(box): Polygon;
474
542
  ```
475
543
 
544
+ Converts a bounding box to a GeoJSON Polygon geometry.
545
+
476
546
  ## Parameters
477
547
 
478
548
  ### box
479
549
 
480
550
  [`MercatorBoundingBox`](#../classes/MercatorBoundingBox)
481
551
 
552
+ The bounding box to convert
553
+
482
554
  ## Returns
483
555
 
484
556
  `Polygon`
485
557
 
558
+ A GeoJSON Polygon representing the bounding box
559
+
486
560
  ### <a id="hasSiblings"></a>hasSiblings
487
561
 
488
562
  [**@xylabs/geo**](#../README)
@@ -493,20 +567,28 @@ function boundingBoxToPolygon(box): Polygon;
493
567
  function hasSiblings(tiles, tile): boolean;
494
568
  ```
495
569
 
570
+ Checks whether all four siblings of the given tile exist in the tile array.
571
+
496
572
  ## Parameters
497
573
 
498
574
  ### tiles
499
575
 
500
576
  [`MercatorTile`](#../type-aliases/MercatorTile)[]
501
577
 
578
+ The array of tiles to search
579
+
502
580
  ### tile
503
581
 
504
582
  [`MercatorTile`](#../type-aliases/MercatorTile)
505
583
 
584
+ The tile whose siblings to check for
585
+
506
586
  ## Returns
507
587
 
508
588
  `boolean`
509
589
 
590
+ True if all siblings are present in the array
591
+
510
592
  ### <a id="tileFromPoint"></a>tileFromPoint
511
593
 
512
594
  [**@xylabs/geo**](#../README)
@@ -517,20 +599,28 @@ function hasSiblings(tiles, tile): boolean;
517
599
  function tileFromPoint(point, z): MercatorTile;
518
600
  ```
519
601
 
602
+ Converts a geographic point to the integer Mercator tile containing it at the given zoom level.
603
+
520
604
  ## Parameters
521
605
 
522
606
  ### point
523
607
 
524
608
  [`MercatorLngLat`](#../classes/MercatorLngLat)
525
609
 
610
+ The geographic coordinate
611
+
526
612
  ### z
527
613
 
528
614
  `number`
529
615
 
616
+ The zoom level
617
+
530
618
  ## Returns
531
619
 
532
620
  [`MercatorTile`](#../type-aliases/MercatorTile)
533
621
 
622
+ The tile as [x, y, zoom]
623
+
534
624
  ### <a id="tileFromQuadkey"></a>tileFromQuadkey
535
625
 
536
626
  [**@xylabs/geo**](#../README)
@@ -541,16 +631,22 @@ function tileFromPoint(point, z): MercatorTile;
541
631
  function tileFromQuadkey(quadkey): MercatorTile;
542
632
  ```
543
633
 
634
+ Converts a quadkey string to a Mercator tile [x, y, zoom].
635
+
544
636
  ## Parameters
545
637
 
546
638
  ### quadkey
547
639
 
548
640
  `string`
549
641
 
642
+ The quadkey string to decode
643
+
550
644
  ## Returns
551
645
 
552
646
  [`MercatorTile`](#../type-aliases/MercatorTile)
553
647
 
648
+ The tile as [x, y, zoom]
649
+
554
650
  ### <a id="tileToBoundingBox"></a>tileToBoundingBox
555
651
 
556
652
  [**@xylabs/geo**](#../README)
@@ -561,16 +657,22 @@ function tileFromQuadkey(quadkey): MercatorTile;
561
657
  function tileToBoundingBox(tile): MercatorBoundingBox;
562
658
  ```
563
659
 
660
+ Converts a Mercator tile to its geographic bounding box.
661
+
564
662
  ## Parameters
565
663
 
566
664
  ### tile
567
665
 
568
666
  [`MercatorTile`](#../type-aliases/MercatorTile)
569
667
 
668
+ The tile as [x, y, zoom]
669
+
570
670
  ## Returns
571
671
 
572
672
  [`MercatorBoundingBox`](#../classes/MercatorBoundingBox)
573
673
 
674
+ The bounding box covering the tile's geographic extent
675
+
574
676
  ### <a id="tileToChildren"></a>tileToChildren
575
677
 
576
678
  [**@xylabs/geo**](#../README)
@@ -581,16 +683,22 @@ function tileToBoundingBox(tile): MercatorBoundingBox;
581
683
  function tileToChildren(tile): MercatorTile[];
582
684
  ```
583
685
 
686
+ Returns the four child tiles at one zoom level higher.
687
+
584
688
  ## Parameters
585
689
 
586
690
  ### tile
587
691
 
588
692
  [`MercatorTile`](#../type-aliases/MercatorTile)
589
693
 
694
+ The parent tile as [x, y, zoom]
695
+
590
696
  ## Returns
591
697
 
592
698
  [`MercatorTile`](#../type-aliases/MercatorTile)[]
593
699
 
700
+ An array of four child tiles at zoom + 1
701
+
594
702
  ### <a id="tileToGeoJson"></a>tileToGeoJson
595
703
 
596
704
  [**@xylabs/geo**](#../README)
@@ -601,16 +709,22 @@ function tileToChildren(tile): MercatorTile[];
601
709
  function tileToGeoJson(tile): Polygon;
602
710
  ```
603
711
 
712
+ Converts a Mercator tile to a GeoJSON Polygon geometry.
713
+
604
714
  ## Parameters
605
715
 
606
716
  ### tile
607
717
 
608
718
  [`MercatorTile`](#../type-aliases/MercatorTile)
609
719
 
720
+ The tile as [x, y, zoom]
721
+
610
722
  ## Returns
611
723
 
612
724
  `Polygon`
613
725
 
726
+ A GeoJSON Polygon representing the tile's geographic extent
727
+
614
728
  ### <a id="tileToParent"></a>tileToParent
615
729
 
616
730
  [**@xylabs/geo**](#../README)
@@ -621,16 +735,22 @@ function tileToGeoJson(tile): Polygon;
621
735
  function tileToParent(tile): MercatorTile;
622
736
  ```
623
737
 
738
+ Returns the parent tile at one zoom level lower.
739
+
624
740
  ## Parameters
625
741
 
626
742
  ### tile
627
743
 
628
744
  [`MercatorTile`](#../type-aliases/MercatorTile)
629
745
 
746
+ The tile as [x, y, zoom]
747
+
630
748
  ## Returns
631
749
 
632
750
  [`MercatorTile`](#../type-aliases/MercatorTile)
633
751
 
752
+ The parent tile at zoom - 1
753
+
634
754
  ### <a id="tileToPoint"></a>tileToPoint
635
755
 
636
756
  [**@xylabs/geo**](#../README)
@@ -641,16 +761,22 @@ function tileToParent(tile): MercatorTile;
641
761
  function tileToPoint(tile): MercatorLngLat;
642
762
  ```
643
763
 
764
+ Returns the center point of a Mercator tile.
765
+
644
766
  ## Parameters
645
767
 
646
768
  ### tile
647
769
 
648
770
  [`MercatorTile`](#../type-aliases/MercatorTile)
649
771
 
772
+ The tile as [x, y, zoom]
773
+
650
774
  ## Returns
651
775
 
652
776
  [`MercatorLngLat`](#../classes/MercatorLngLat)
653
777
 
778
+ The center coordinate as a MercatorLngLat
779
+
654
780
  ### <a id="tileToQuadkey"></a>tileToQuadkey
655
781
 
656
782
  [**@xylabs/geo**](#../README)
@@ -658,19 +784,25 @@ function tileToPoint(tile): MercatorLngLat;
658
784
  ***
659
785
 
660
786
  ```ts
661
- function tileToQuadkey(__namedParameters): string;
787
+ function tileToQuadkey(param0): string;
662
788
  ```
663
789
 
790
+ Converts a Mercator tile to its quadkey string representation.
791
+
664
792
  ## Parameters
665
793
 
666
- ### \_\_namedParameters
794
+ ### param0
667
795
 
668
796
  [`MercatorTile`](#../type-aliases/MercatorTile)
669
797
 
798
+ The tile as [tileX, tileY, tileZoom]
799
+
670
800
  ## Returns
671
801
 
672
802
  `string`
673
803
 
804
+ The quadkey string encoding the tile's position and zoom
805
+
674
806
  ### <a id="tileToSiblings"></a>tileToSiblings
675
807
 
676
808
  [**@xylabs/geo**](#../README)
@@ -681,16 +813,22 @@ function tileToQuadkey(__namedParameters): string;
681
813
  function tileToSiblings(tile): MercatorTile[];
682
814
  ```
683
815
 
816
+ Returns the four sibling tiles (children of the parent tile) for the given tile.
817
+
684
818
  ## Parameters
685
819
 
686
820
  ### tile
687
821
 
688
822
  [`MercatorTile`](#../type-aliases/MercatorTile)
689
823
 
824
+ The tile as [x, y, zoom]
825
+
690
826
  ## Returns
691
827
 
692
828
  [`MercatorTile`](#../type-aliases/MercatorTile)[]
693
829
 
830
+ An array of four sibling tiles at the same zoom level
831
+
694
832
  ### <a id="tilesEqual"></a>tilesEqual
695
833
 
696
834
  [**@xylabs/geo**](#../README)
@@ -698,23 +836,31 @@ function tileToSiblings(tile): MercatorTile[];
698
836
  ***
699
837
 
700
838
  ```ts
701
- function tilesEqual(__namedParameters, __namedParameters): boolean;
839
+ function tilesEqual(param0, param1): boolean;
702
840
  ```
703
841
 
842
+ Checks whether two Mercator tiles are equal by comparing their x, y, and zoom values.
843
+
704
844
  ## Parameters
705
845
 
706
- ### \_\_namedParameters
846
+ ### param0
707
847
 
708
848
  [`MercatorTile`](#../type-aliases/MercatorTile)
709
849
 
710
- ### \_\_namedParameters
850
+ The first tile as [x, y, zoom]
851
+
852
+ ### param1
711
853
 
712
854
  [`MercatorTile`](#../type-aliases/MercatorTile)
713
855
 
856
+ The second tile as [x, y, zoom]
857
+
714
858
  ## Returns
715
859
 
716
860
  `boolean`
717
861
 
862
+ True if both tiles have identical coordinates and zoom
863
+
718
864
  ### <a id="tilesFromBoundingBox"></a>tilesFromBoundingBox
719
865
 
720
866
  [**@xylabs/geo**](#../README)
@@ -725,20 +871,28 @@ function tilesEqual(__namedParameters, __namedParameters): boolean;
725
871
  function tilesFromBoundingBox(box, zoom): MercatorTile[];
726
872
  ```
727
873
 
874
+ Returns all Mercator tiles that intersect the given bounding box at the specified zoom level.
875
+
728
876
  ## Parameters
729
877
 
730
878
  ### box
731
879
 
732
880
  [`MercatorBoundingBox`](#../classes/MercatorBoundingBox)
733
881
 
882
+ The geographic bounding box
883
+
734
884
  ### zoom
735
885
 
736
886
  `number`
737
887
 
888
+ The zoom level
889
+
738
890
  ## Returns
739
891
 
740
892
  [`MercatorTile`](#../type-aliases/MercatorTile)[]
741
893
 
894
+ An array of tiles covering the bounding box
895
+
742
896
  ### <a id="tilesHasTile"></a>tilesHasTile
743
897
 
744
898
  [**@xylabs/geo**](#../README)
@@ -749,20 +903,28 @@ function tilesFromBoundingBox(box, zoom): MercatorTile[];
749
903
  function tilesHasTile(tiles, tile): boolean;
750
904
  ```
751
905
 
906
+ Checks whether a specific tile exists in the given tile array.
907
+
752
908
  ## Parameters
753
909
 
754
910
  ### tiles
755
911
 
756
912
  [`MercatorTile`](#../type-aliases/MercatorTile)[]
757
913
 
914
+ The array of tiles to search
915
+
758
916
  ### tile
759
917
 
760
918
  [`MercatorTile`](#../type-aliases/MercatorTile)
761
919
 
920
+ The tile to look for
921
+
762
922
  ## Returns
763
923
 
764
924
  `boolean`
765
925
 
926
+ True if the tile is found in the array
927
+
766
928
  ### type-aliases
767
929
 
768
930
  ### <a id="MercatorBoundary"></a>MercatorBoundary
@@ -775,6 +937,8 @@ function tilesHasTile(tiles, tile): boolean;
775
937
  type MercatorBoundary = MercatorLngLat[];
776
938
  ```
777
939
 
940
+ An ordered array of MercatorLngLat points forming a boundary.
941
+
778
942
  ### <a id="MercatorTile"></a>MercatorTile
779
943
 
780
944
  [**@xylabs/geo**](#../README)
@@ -785,6 +949,8 @@ type MercatorBoundary = MercatorLngLat[];
785
949
  type MercatorTile = readonly [number, number, number];
786
950
  ```
787
951
 
952
+ A Mercator tile represented as [x, y, zoom].
953
+
788
954
  ### variables
789
955
 
790
956
  ### <a id="d2r"></a>d2r
@@ -797,6 +963,8 @@ type MercatorTile = readonly [number, number, number];
797
963
  const d2r: number;
798
964
  ```
799
965
 
966
+ Conversion factor from degrees to radians.
967
+
800
968
  ### <a id="r2d"></a>r2d
801
969
 
802
970
  [**@xylabs/geo**](#../README)
@@ -807,6 +975,8 @@ const d2r: number;
807
975
  const r2d: number;
808
976
  ```
809
977
 
978
+ Conversion factor from radians to degrees.
979
+
810
980
 
811
981
  Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
812
982
 
@@ -1,5 +1,6 @@
1
1
  import type { Feature, FeatureCollection, Geometry, Point, Polygon } from 'geojson';
2
2
  import MapBox from 'mapbox-gl';
3
+ /** Provides GeoJSON geometry and MapBox source generation from a quadkey. */
3
4
  declare class GeoJson {
4
5
  private _lngLat?;
5
6
  private _point?;
@@ -7,18 +8,43 @@ declare class GeoJson {
7
8
  private _zoom?;
8
9
  private quadkey;
9
10
  constructor(quadkey: string);
11
+ /**
12
+ * Creates a GeoJSON FeatureCollection from an array of features.
13
+ * @param features - The features to include
14
+ * @returns A GeoJSON FeatureCollection
15
+ */
10
16
  static featureCollection(features: Feature[]): FeatureCollection;
17
+ /**
18
+ * Creates a MapBox GeoJSON source specification from a FeatureCollection.
19
+ * @param data - The FeatureCollection to use as the source data
20
+ * @returns A MapBox GeoJSON source specification
21
+ */
11
22
  static featuresSource(data: FeatureCollection): MapBox.GeoJSONSourceSpecification;
23
+ /**
24
+ * Wraps a geometry object in a GeoJSON Feature.
25
+ * @param geometry - The geometry to wrap
26
+ * @returns A GeoJSON Feature containing the geometry
27
+ */
12
28
  static geometryFeature(geometry: Geometry): Feature;
29
+ /** Computes and caches the center point of the quadkey's bounding box as a MapBox LngLat. */
13
30
  center(): MapBox.LngLat;
31
+ /** Returns a GeoJSON Point geometry at the center of the quadkey's bounding box. */
14
32
  point(): Point;
33
+ /** Returns a GeoJSON Feature containing the center point geometry. */
15
34
  pointFeature(): Feature;
35
+ /** Returns a GeoJSON FeatureCollection containing the center point feature. */
16
36
  pointFeatureCollection(): FeatureCollection;
37
+ /** Returns a MapBox GeoJSON source specification for the center point. */
17
38
  pointSource(): MapBox.GeoJSONSourceSpecification;
39
+ /** Returns a GeoJSON Polygon geometry representing the quadkey's bounding box. */
18
40
  polygon(): Polygon;
41
+ /** Returns a GeoJSON Feature containing the polygon geometry. */
19
42
  polygonFeature(): Feature;
43
+ /** Returns a GeoJSON FeatureCollection containing the polygon feature. */
20
44
  polygonFeatureCollection(): FeatureCollection;
45
+ /** Returns a MapBox GeoJSON source specification for the polygon. */
21
46
  polygonSource(): MapBox.GeoJSONSourceSpecification;
47
+ /** Returns the zoom level derived from the quadkey length. */
22
48
  zoom(): number;
23
49
  }
24
50
  export { GeoJson };
@@ -1 +1 @@
1
- {"version":3,"file":"GeoJson.d.ts","sourceRoot":"","sources":["../../src/GeoJson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EACrD,MAAM,SAAS,CAAA;AAChB,OAAO,MAAM,MAAM,WAAW,CAAA;AAM9B,cAAM,OAAO;IACX,OAAO,CAAC,OAAO,CA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