@xylabs/geo 5.0.83 → 5.0.86
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 +266 -176
- package/dist/neutral/GeoJson.d.ts +26 -0
- package/dist/neutral/GeoJson.d.ts.map +1 -1
- package/dist/neutral/LayerBase.d.ts +7 -0
- package/dist/neutral/LayerBase.d.ts.map +1 -1
- package/dist/neutral/index.mjs +30 -0
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/mercator/boundingbox/to/boundary.d.ts +5 -0
- package/dist/neutral/mercator/boundingbox/to/boundary.d.ts.map +1 -1
- package/dist/neutral/mercator/boundingbox/to/center.d.ts +6 -0
- package/dist/neutral/mercator/boundingbox/to/center.d.ts.map +1 -1
- package/dist/neutral/mercator/boundingbox/to/polygon.d.ts +5 -0
- package/dist/neutral/mercator/boundingbox/to/polygon.d.ts.map +1 -1
- package/dist/neutral/mercator/constants.d.ts +2 -0
- package/dist/neutral/mercator/constants.d.ts.map +1 -1
- package/dist/neutral/mercator/tile/from/point.d.ts +6 -0
- package/dist/neutral/mercator/tile/from/point.d.ts.map +1 -1
- package/dist/neutral/mercator/tile/from/quadkey.d.ts +5 -0
- package/dist/neutral/mercator/tile/from/quadkey.d.ts.map +1 -1
- package/dist/neutral/mercator/tile/to/boundingbox.d.ts +5 -0
- package/dist/neutral/mercator/tile/to/boundingbox.d.ts.map +1 -1
- package/dist/neutral/mercator/tile/to/children.d.ts +5 -0
- package/dist/neutral/mercator/tile/to/children.d.ts.map +1 -1
- package/dist/neutral/mercator/tile/to/geoJson.d.ts +5 -0
- package/dist/neutral/mercator/tile/to/geoJson.d.ts.map +1 -1
- package/dist/neutral/mercator/tile/to/parent.d.ts +5 -0
- package/dist/neutral/mercator/tile/to/parent.d.ts.map +1 -1
- package/dist/neutral/mercator/tile/to/point.d.ts +5 -0
- package/dist/neutral/mercator/tile/to/point.d.ts.map +1 -1
- package/dist/neutral/mercator/tile/to/quadkey.d.ts +5 -0
- package/dist/neutral/mercator/tile/to/quadkey.d.ts.map +1 -1
- package/dist/neutral/mercator/tile/to/siblings.d.ts +5 -0
- package/dist/neutral/mercator/tile/to/siblings.d.ts.map +1 -1
- package/dist/neutral/mercator/tiles/equal.d.ts +6 -0
- package/dist/neutral/mercator/tiles/equal.d.ts.map +1 -1
- package/dist/neutral/mercator/tiles/from/boundingbox.d.ts +6 -0
- package/dist/neutral/mercator/tiles/from/boundingbox.d.ts.map +1 -1
- package/dist/neutral/mercator/tiles/hasSiblings.d.ts +6 -0
- package/dist/neutral/mercator/tiles/hasSiblings.d.ts.map +1 -1
- package/dist/neutral/mercator/tiles/hasTile.d.ts +6 -0
- package/dist/neutral/mercator/tiles/hasTile.d.ts.map +1 -1
- package/dist/neutral/mercator/types.d.ts +4 -0
- package/dist/neutral/mercator/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -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,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;IAEtB,OAAO,CAAC,OAAO,CAAQ;gBAEX,OAAO,EAAE,MAAM;IAI3B;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,iBAAiB;IAOhE;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,0BAA0B;IAOjF;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO;IAQnD,6FAA6F;IAC7F,MAAM,IAAI,MAAM,CAAC,MAAM;IAUvB,oFAAoF;IACpF,KAAK,IAAI,KAAK;IAUd,sEAAsE;IACtE,YAAY,IAAI,OAAO;IAIvB,+EAA+E;IAC/E,sBAAsB,IAAI,iBAAiB;IAI3C,0EAA0E;IAC1E,WAAW,IAAI,MAAM,CAAC,0BAA0B;IAOhD,kFAAkF;IAClF,OAAO,IAAI,OAAO;IAOlB,iEAAiE;IACjE,cAAc,IAAI,OAAO;IAIzB,0EAA0E;IAC1E,wBAAwB,IAAI,iBAAiB;IAI7C,qEAAqE;IACrE,aAAa,IAAI,MAAM,CAAC,0BAA0B;IAIlD,8DAA8D;IAC9D,IAAI,IAAI,MAAM;CAIf;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type MapBox from 'mapbox-gl';
|
|
2
|
+
/** Abstract base class for managing MapBox map layers with add/remove lifecycle. */
|
|
2
3
|
export declare abstract class LayerBase<T extends MapBox.Layer> {
|
|
3
4
|
id: string;
|
|
4
5
|
source: string;
|
|
5
6
|
constructor(id: string, source: string);
|
|
7
|
+
/**
|
|
8
|
+
* Removes and re-adds the layer on the map, optionally hiding it.
|
|
9
|
+
* @param map - The MapBox map instance
|
|
10
|
+
* @param show - Whether to show the layer after updating (default true)
|
|
11
|
+
*/
|
|
6
12
|
update(map: MapBox.Map, show?: boolean): void;
|
|
13
|
+
/** Builds the MapBox layer configuration object. */
|
|
7
14
|
abstract buildLayer(): T;
|
|
8
15
|
}
|
|
9
16
|
//# sourceMappingURL=LayerBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayerBase.d.ts","sourceRoot":"","sources":["../../src/LayerBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AAEnC,8BAAsB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,KAAK;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;gBAEF,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKtC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,UAAO;IASnC,QAAQ,CAAC,UAAU,IAAI,CAAC;CACzB"}
|
|
1
|
+
{"version":3,"file":"LayerBase.d.ts","sourceRoot":"","sources":["../../src/LayerBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AAEnC,oFAAoF;AACpF,8BAAsB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,KAAK;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;gBAEF,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKtC;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,UAAO;IASnC,oDAAoD;IACpD,QAAQ,CAAC,UAAU,IAAI,CAAC;CACzB"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -212,18 +212,33 @@ var GeoJson = class _GeoJson {
|
|
|
212
212
|
constructor(quadkey) {
|
|
213
213
|
this.quadkey = quadkey;
|
|
214
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Creates a GeoJSON FeatureCollection from an array of features.
|
|
217
|
+
* @param features - The features to include
|
|
218
|
+
* @returns A GeoJSON FeatureCollection
|
|
219
|
+
*/
|
|
215
220
|
static featureCollection(features) {
|
|
216
221
|
return {
|
|
217
222
|
features,
|
|
218
223
|
type: "FeatureCollection"
|
|
219
224
|
};
|
|
220
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Creates a MapBox GeoJSON source specification from a FeatureCollection.
|
|
228
|
+
* @param data - The FeatureCollection to use as the source data
|
|
229
|
+
* @returns A MapBox GeoJSON source specification
|
|
230
|
+
*/
|
|
221
231
|
static featuresSource(data) {
|
|
222
232
|
return {
|
|
223
233
|
data,
|
|
224
234
|
type: "geojson"
|
|
225
235
|
};
|
|
226
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Wraps a geometry object in a GeoJSON Feature.
|
|
239
|
+
* @param geometry - The geometry to wrap
|
|
240
|
+
* @returns A GeoJSON Feature containing the geometry
|
|
241
|
+
*/
|
|
227
242
|
static geometryFeature(geometry) {
|
|
228
243
|
return {
|
|
229
244
|
geometry,
|
|
@@ -231,6 +246,7 @@ var GeoJson = class _GeoJson {
|
|
|
231
246
|
type: "Feature"
|
|
232
247
|
};
|
|
233
248
|
}
|
|
249
|
+
/** Computes and caches the center point of the quadkey's bounding box as a MapBox LngLat. */
|
|
234
250
|
center() {
|
|
235
251
|
if (!this._lngLat) {
|
|
236
252
|
const tile = tileFromQuadkey(this.quadkey);
|
|
@@ -240,6 +256,7 @@ var GeoJson = class _GeoJson {
|
|
|
240
256
|
}
|
|
241
257
|
return this._lngLat;
|
|
242
258
|
}
|
|
259
|
+
/** Returns a GeoJSON Point geometry at the center of the quadkey's bounding box. */
|
|
243
260
|
point() {
|
|
244
261
|
if (!this._point) {
|
|
245
262
|
this._point = {
|
|
@@ -249,33 +266,41 @@ var GeoJson = class _GeoJson {
|
|
|
249
266
|
}
|
|
250
267
|
return this._point;
|
|
251
268
|
}
|
|
269
|
+
/** Returns a GeoJSON Feature containing the center point geometry. */
|
|
252
270
|
pointFeature() {
|
|
253
271
|
return _GeoJson.geometryFeature(this.point());
|
|
254
272
|
}
|
|
273
|
+
/** Returns a GeoJSON FeatureCollection containing the center point feature. */
|
|
255
274
|
pointFeatureCollection() {
|
|
256
275
|
return _GeoJson.featureCollection([this.pointFeature()]);
|
|
257
276
|
}
|
|
277
|
+
/** Returns a MapBox GeoJSON source specification for the center point. */
|
|
258
278
|
pointSource() {
|
|
259
279
|
return {
|
|
260
280
|
data: this.pointFeatureCollection(),
|
|
261
281
|
type: "geojson"
|
|
262
282
|
};
|
|
263
283
|
}
|
|
284
|
+
/** Returns a GeoJSON Polygon geometry representing the quadkey's bounding box. */
|
|
264
285
|
polygon() {
|
|
265
286
|
if (!this._polygon) {
|
|
266
287
|
this._polygon = boundingBoxToPolygon(tileToBoundingBox(tileFromQuadkey(this.quadkey)));
|
|
267
288
|
}
|
|
268
289
|
return this._polygon;
|
|
269
290
|
}
|
|
291
|
+
/** Returns a GeoJSON Feature containing the polygon geometry. */
|
|
270
292
|
polygonFeature() {
|
|
271
293
|
return _GeoJson.geometryFeature(this.polygon());
|
|
272
294
|
}
|
|
295
|
+
/** Returns a GeoJSON FeatureCollection containing the polygon feature. */
|
|
273
296
|
polygonFeatureCollection() {
|
|
274
297
|
return _GeoJson.featureCollection([this.polygonFeature()]);
|
|
275
298
|
}
|
|
299
|
+
/** Returns a MapBox GeoJSON source specification for the polygon. */
|
|
276
300
|
polygonSource() {
|
|
277
301
|
return _GeoJson.featuresSource(this.polygonFeatureCollection());
|
|
278
302
|
}
|
|
303
|
+
/** Returns the zoom level derived from the quadkey length. */
|
|
279
304
|
zoom() {
|
|
280
305
|
this._zoom = this._zoom ?? tileFromQuadkey(this.quadkey)[2];
|
|
281
306
|
return this._zoom;
|
|
@@ -290,6 +315,11 @@ var LayerBase = class {
|
|
|
290
315
|
this.id = id;
|
|
291
316
|
this.source = source;
|
|
292
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Removes and re-adds the layer on the map, optionally hiding it.
|
|
320
|
+
* @param map - The MapBox map instance
|
|
321
|
+
* @param show - Whether to show the layer after updating (default true)
|
|
322
|
+
*/
|
|
293
323
|
update(map, show = true) {
|
|
294
324
|
if (map.getLayer(this.id)) {
|
|
295
325
|
map.removeLayer(this.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/GeoJson.ts","../../src/mercator/boundingbox/to/boundary.ts","../../src/mercator/boundingbox/to/center.ts","../../src/mercator/boundingbox/to/polygon.ts","../../src/mercator/constants.ts","../../src/mercator/tile/from/point.ts","../../src/mercator/tile/from/quadkey.ts","../../src/mercator/tile/to/boundingbox.ts","../../src/mercator/types.ts","../../src/mercator/tile/to/children.ts","../../src/mercator/tile/to/geoJson.ts","../../src/mercator/tile/to/parent.ts","../../src/mercator/tile/to/point.ts","../../src/mercator/tile/to/quadkey.ts","../../src/mercator/tile/to/siblings.ts","../../src/mercator/tiles/equal.ts","../../src/mercator/tiles/from/boundingbox.ts","../../src/mercator/tiles/hasTile.ts","../../src/mercator/tiles/hasSiblings.ts","../../src/LayerBase.ts"],"sourcesContent":["import type {\n Feature, FeatureCollection, Geometry, Point, Polygon,\n} from 'geojson'\nimport MapBox from 'mapbox-gl'\n\nimport {\n boundingBoxToCenter, boundingBoxToPolygon, tileFromQuadkey, tileToBoundingBox,\n} from './mercator/index.ts'\n\nclass GeoJson {\n private _lngLat?: MapBox.LngLat\n private _point?: Point\n private _polygon?: Polygon\n private _zoom?: number\n\n private quadkey: string\n\n constructor(quadkey: string) {\n this.quadkey = quadkey\n }\n\n static featureCollection(features: Feature[]): FeatureCollection {\n return {\n features,\n type: 'FeatureCollection',\n }\n }\n\n static featuresSource(data: FeatureCollection): MapBox.GeoJSONSourceSpecification {\n return {\n data,\n type: 'geojson',\n }\n }\n\n static geometryFeature(geometry: Geometry): Feature {\n return {\n geometry,\n properties: {},\n type: 'Feature',\n }\n }\n\n center(): MapBox.LngLat {\n if (!this._lngLat) {\n const tile = tileFromQuadkey(this.quadkey)\n const bb = tileToBoundingBox(tile)\n const point = boundingBoxToCenter(bb)\n this._lngLat = new MapBox.LngLat(point[0], point[1])\n }\n return this._lngLat\n }\n\n point(): Point {\n if (!this._point) {\n this._point = {\n coordinates: this.center().toArray(),\n type: 'Point',\n }\n }\n return this._point\n }\n\n pointFeature(): Feature {\n return GeoJson.geometryFeature(this.point())\n }\n\n pointFeatureCollection(): FeatureCollection {\n return GeoJson.featureCollection([this.pointFeature()])\n }\n\n pointSource(): MapBox.GeoJSONSourceSpecification {\n return {\n data: this.pointFeatureCollection(),\n type: 'geojson',\n }\n }\n\n polygon(): Polygon {\n if (!this._polygon) {\n this._polygon = boundingBoxToPolygon(tileToBoundingBox(tileFromQuadkey(this.quadkey))) as Polygon\n }\n return this._polygon\n }\n\n polygonFeature(): Feature {\n return GeoJson.geometryFeature(this.polygon())\n }\n\n polygonFeatureCollection(): FeatureCollection {\n return GeoJson.featureCollection([this.polygonFeature()])\n }\n\n polygonSource(): MapBox.GeoJSONSourceSpecification {\n return GeoJson.featuresSource(this.polygonFeatureCollection())\n }\n\n zoom(): number {\n this._zoom = this._zoom ?? tileFromQuadkey(this.quadkey)[2]\n return this._zoom\n }\n}\n\nexport { GeoJson }\n","import type { MercatorBoundary, MercatorBoundingBox } from '../../types.ts'\n\nexport const boundingBoxToBoundary = (box: MercatorBoundingBox): MercatorBoundary => {\n return [box.getNorthWest(), box.getNorthEast(), box.getSouthEast(), box.getSouthWest(), box.getNorthWest()]\n}\n","import type { MercatorBoundingBox } from '../../types.ts'\n\nexport const boundingBoxToCenter = (boundingBox: MercatorBoundingBox, decimal = 6) => {\n const west = boundingBox.getWest()\n const south = boundingBox.getSouth()\n const east = boundingBox.getEast()\n const north = boundingBox.getNorth()\n let lng = (west - east) / 2 + east\n let lat = (south - north) / 2 + north\n if (decimal !== undefined && decimal !== null) {\n lng = Number(lng.toFixed(decimal))\n lat = Number(lat.toFixed(decimal))\n }\n return [lng, lat]\n}\n","import type { Polygon } from 'geojson'\n\nimport type { MercatorBoundingBox, MercatorLngLat } from '../../types.ts'\nimport { boundingBoxToBoundary } from './boundary.ts'\n\nexport const boundingBoxToPolygon = (box: MercatorBoundingBox): Polygon => {\n const boundry = boundingBoxToBoundary(box)\n return {\n coordinates: [boundry.map((lnglng: MercatorLngLat) => lnglng.toArray())],\n type: 'Polygon',\n }\n}\n","const d2r = Math.PI / 180\nconst r2d = 180 / Math.PI\n\nexport { d2r, r2d }\n","import { d2r } from '../../constants.ts'\nimport type { MercatorLngLat, MercatorTile } from '../../types.ts'\n\nconst pointToTileFraction = (point: MercatorLngLat, z: number): MercatorTile => {\n const sin = Math.sin(point.lat * d2r)\n const z2 = Math.pow(2, z)\n let x = z2 * (point.lng / 360 + 0.5)\n const y = z2 * (0.5 - (0.25 * Math.log((1 + sin) / (1 - sin))) / Math.PI)\n\n // Wrap Tile X\n x = x % z2\n if (x < 0) x = x + z2\n return [x, y, z]\n}\n\nconst tileFromPoint = (point: MercatorLngLat, z: number): MercatorTile => {\n const [tileX, tileY, tileZoom] = pointToTileFraction(point, z)\n const x = Math.max(Math.floor(tileX), 0)\n const y = Math.max(Math.floor(tileY), 0)\n return [x, y, tileZoom]\n}\n\nexport { tileFromPoint }\n","import type { MercatorTile } from '../../types.ts'\n\nconst tileFromQuadkey = (quadkey: string): MercatorTile => {\n let x = 0\n let y = 0\n const z = quadkey.length\n\n for (let i = z; i > 0; i--) {\n const mask = 1 << (i - 1)\n const q = +quadkey[z - i]\n if (q === 1) x |= mask\n if (q === 2) y |= mask\n if (q === 3) {\n x |= mask\n y |= mask\n }\n }\n return [x, y, z]\n}\n\nexport { tileFromQuadkey }\n","import MapBox from 'mapbox-gl'\n\nimport { r2d } from '../../constants.ts'\nimport type { MercatorTile } from '../../types.ts'\nimport { MercatorBoundingBox } from '../../types.ts'\n\nconst toLongitude = (x: number, z: number): number => {\n return (x / Math.pow(2, z)) * 360 - 180\n}\n\nconst toLatitude = (y: number, z: number): number => {\n const n = Math.PI - (2 * Math.PI * y) / Math.pow(2, z)\n return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)))\n}\n\nconst tileToBoundingBox = (tile: MercatorTile): MercatorBoundingBox => {\n const e = toLongitude(tile[0] + 1, tile[2])\n const w = toLongitude(tile[0], tile[2])\n const s = toLatitude(tile[1] + 1, tile[2])\n const n = toLatitude(tile[1], tile[2])\n return new MercatorBoundingBox(new MapBox.LngLat(w, s), new MapBox.LngLat(e, n))\n}\n\nexport { tileToBoundingBox }\n","import MapBox from 'mapbox-gl'\n\ntype MercatorTile = readonly [x: number, y: number, zoom: number]\ntype MercatorBoundary = MercatorLngLat[]\nclass MercatorBoundingBox extends MapBox.LngLatBounds {}\nclass MercatorLngLat extends MapBox.LngLat {}\n\nexport { MercatorBoundingBox, MercatorLngLat }\nexport type { MercatorBoundary, MercatorTile }\n","import type { MercatorTile } from '../../types.ts'\n\nconst tileToChildren = (tile: MercatorTile): MercatorTile[] => {\n return [\n [tile[0] * 2, tile[1] * 2, tile[2] + 1],\n [tile[0] * 2 + 1, tile[1] * 2, tile[2] + 1],\n [tile[0] * 2 + 1, tile[1] * 2 + 1, tile[2] + 1],\n [tile[0] * 2, tile[1] * 2 + 1, tile[2] + 1],\n ]\n}\n\nexport { tileToChildren }\n","import type { Polygon, Position } from 'geojson'\n\nimport type { MercatorTile } from '../../types.ts'\nimport { tileToBoundingBox } from './boundingbox.ts'\n\nconst tileToGeoJson = (tile: MercatorTile): Polygon => {\n const box = tileToBoundingBox(tile)\n const poly: Polygon = {\n coordinates: [\n [\n box.getNorthWest().toArray() as Position,\n box.getNorthEast().toArray() as Position,\n box.getSouthEast().toArray() as Position,\n box.getSouthWest().toArray() as Position,\n box.getNorthWest().toArray() as Position,\n ],\n ],\n type: 'Polygon',\n }\n return poly\n}\n\nexport { tileToGeoJson }\n","import type { MercatorTile } from '../../types.ts'\n\nconst tileToParent = (tile: MercatorTile): MercatorTile => {\n return [tile[0] >> 1, tile[1] >> 1, tile[2] - 1]\n}\n\nexport { tileToParent }\n","import type { MercatorLngLat, MercatorTile } from '../../types.ts'\nimport { tileToBoundingBox } from './boundingbox.ts'\n\nconst tileToPoint = (tile: MercatorTile): MercatorLngLat => {\n const boundingBox = tileToBoundingBox(tile)\n boundingBox.getCenter()\n return boundingBox.getCenter()\n}\n\nexport { tileToPoint }\n","import type { MercatorTile } from '../../types.ts'\n\nconst tileToQuadkey = ([tileX, tileY, tileZoom]: MercatorTile): string => {\n let index = ''\n for (let z = tileZoom; z > 0; z--) {\n let b = 0\n const mask = 1 << (z - 1)\n if ((tileX & mask) !== 0) b++\n if ((tileY & mask) !== 0) b += 2\n index += b.toString()\n }\n return index\n}\n\nexport { tileToQuadkey }\n","import type { MercatorTile } from '../../types.ts'\nimport { tileToChildren } from './children.ts'\nimport { tileToParent } from './parent.ts'\n\nconst tileToSiblings = (tile: MercatorTile): MercatorTile[] => {\n return tileToChildren(tileToParent(tile))\n}\n\nexport { tileToSiblings }\n","import type { MercatorTile } from '../types.ts'\n\nexport const tilesEqual = /* @__PURE__ */ ([x1, y1, zoom1]: MercatorTile, [x2, y2, zoom2]: MercatorTile): boolean => {\n return x1 === x2 && y1 === y2 && zoom1 === zoom2\n}\n","import { tileFromPoint } from '../../tile/index.ts'\nimport type { MercatorBoundingBox, MercatorTile } from '../../types.ts'\n\nconst tilesFromBoundingBox = (box: MercatorBoundingBox, zoom: number): MercatorTile[] => {\n const nw = tileFromPoint(box.getNorthWest(), zoom)\n const se = tileFromPoint(box.getSouthEast(), zoom)\n const size = Math.pow(2, zoom)\n\n let minX = nw[0]\n let maxX = se[0]\n let minY = nw[1]\n let maxY = se[1]\n\n // in case of horizontal wrapping\n if (minX >= maxX) {\n maxX = maxX + size\n }\n\n if (zoom < 4) {\n minX = 0\n maxX = size - 1\n minY = 0\n maxY = size - 1\n }\n\n const result: MercatorTile[] = []\n\n for (let x = minX; x <= maxX; x++) {\n for (let y = minY; y <= maxY; y++) {\n result.push([x % size, y, zoom])\n }\n }\n\n return result\n}\n\nexport { tilesFromBoundingBox }\n","import type { MercatorTile } from '../types.ts'\nimport { tilesEqual } from './equal.ts'\n\nexport const tilesHasTile = (tiles: MercatorTile[], tile: MercatorTile) => {\n for (const tileToCheck of tiles) {\n if (tilesEqual(tileToCheck, tile)) return true\n }\n return false\n}\n","import { tileToSiblings } from '../tile/index.ts'\nimport type { MercatorTile } from '../types.ts'\nimport { tilesHasTile } from './hasTile.ts'\n\nexport const hasSiblings = (tiles: MercatorTile[], tile: MercatorTile) => {\n const siblings = tileToSiblings(tile)\n for (const sibling of siblings) {\n if (!tilesHasTile(tiles, sibling)) return false\n }\n return true\n}\n","import type MapBox from 'mapbox-gl'\n\nexport abstract class LayerBase<T extends MapBox.Layer> {\n id: string\n source: string\n\n constructor(id: string, source: string) {\n this.id = id\n this.source = source\n }\n\n update(map: MapBox.Map, show = true) {\n if (map.getLayer(this.id)) {\n map.removeLayer(this.id)\n }\n if (show) {\n map.addLayer(this.buildLayer())\n }\n }\n\n abstract buildLayer(): T\n}\n"],"mappings":";AAGA,OAAOA,aAAY;;;ACDZ,IAAM,wBAAwB,CAAC,QAA+C;AACnF,SAAO,CAAC,IAAI,aAAa,GAAG,IAAI,aAAa,GAAG,IAAI,aAAa,GAAG,IAAI,aAAa,GAAG,IAAI,aAAa,CAAC;AAC5G;;;ACFO,IAAM,sBAAsB,CAAC,aAAkC,UAAU,MAAM;AACpF,QAAM,OAAO,YAAY,QAAQ;AACjC,QAAM,QAAQ,YAAY,SAAS;AACnC,QAAM,OAAO,YAAY,QAAQ;AACjC,QAAM,QAAQ,YAAY,SAAS;AACnC,MAAI,OAAO,OAAO,QAAQ,IAAI;AAC9B,MAAI,OAAO,QAAQ,SAAS,IAAI;AAChC,MAAI,YAAY,UAAa,YAAY,MAAM;AAC7C,UAAM,OAAO,IAAI,QAAQ,OAAO,CAAC;AACjC,UAAM,OAAO,IAAI,QAAQ,OAAO,CAAC;AAAA,EACnC;AACA,SAAO,CAAC,KAAK,GAAG;AAClB;;;ACTO,IAAM,uBAAuB,CAAC,QAAsC;AACzE,QAAM,UAAU,sBAAsB,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AAAA,EAC/D;AAAA,EAEA,OAAe;AACb,SAAK,QAAQ,KAAK,SAAS,gBAAgB,KAAK,OAAO,EAAE,CAAC;AAC1D,WAAO,KAAK;AAAA,EACd;AACF;;;AmBnGO,IAAe,YAAf,MAAiD;AAAA,EACtD;AAAA,EACA;AAAA,EAEA,YAAY,IAAY,QAAgB;AACtC,SAAK,KAAK;AACV,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,OAAO,KAAiB,OAAO,MAAM;AACnC,QAAI,IAAI,SAAS,KAAK,EAAE,GAAG;AACzB,UAAI,YAAY,KAAK,EAAE;AAAA,IACzB;AACA,QAAI,MAAM;AACR,UAAI,SAAS,KAAK,WAAW,CAAC;AAAA,IAChC;AAAA,EACF;AAGF;","names":["MapBox","MapBox","MapBox","MapBox"]}
|
|
1
|
+
{"version":3,"sources":["../../src/GeoJson.ts","../../src/mercator/boundingbox/to/boundary.ts","../../src/mercator/boundingbox/to/center.ts","../../src/mercator/boundingbox/to/polygon.ts","../../src/mercator/constants.ts","../../src/mercator/tile/from/point.ts","../../src/mercator/tile/from/quadkey.ts","../../src/mercator/tile/to/boundingbox.ts","../../src/mercator/types.ts","../../src/mercator/tile/to/children.ts","../../src/mercator/tile/to/geoJson.ts","../../src/mercator/tile/to/parent.ts","../../src/mercator/tile/to/point.ts","../../src/mercator/tile/to/quadkey.ts","../../src/mercator/tile/to/siblings.ts","../../src/mercator/tiles/equal.ts","../../src/mercator/tiles/from/boundingbox.ts","../../src/mercator/tiles/hasTile.ts","../../src/mercator/tiles/hasSiblings.ts","../../src/LayerBase.ts"],"sourcesContent":["import type {\n Feature, FeatureCollection, Geometry, Point, Polygon,\n} from 'geojson'\nimport MapBox from 'mapbox-gl'\n\nimport {\n boundingBoxToCenter, boundingBoxToPolygon, tileFromQuadkey, tileToBoundingBox,\n} from './mercator/index.ts'\n\n/** Provides GeoJSON geometry and MapBox source generation from a quadkey. */\nclass GeoJson {\n private _lngLat?: MapBox.LngLat\n private _point?: Point\n private _polygon?: Polygon\n private _zoom?: number\n\n private quadkey: string\n\n constructor(quadkey: string) {\n this.quadkey = quadkey\n }\n\n /**\n * Creates a GeoJSON FeatureCollection from an array of features.\n * @param features - The features to include\n * @returns A GeoJSON FeatureCollection\n */\n static featureCollection(features: Feature[]): FeatureCollection {\n return {\n features,\n type: 'FeatureCollection',\n }\n }\n\n /**\n * Creates a MapBox GeoJSON source specification from a FeatureCollection.\n * @param data - The FeatureCollection to use as the source data\n * @returns A MapBox GeoJSON source specification\n */\n static featuresSource(data: FeatureCollection): MapBox.GeoJSONSourceSpecification {\n return {\n data,\n type: 'geojson',\n }\n }\n\n /**\n * Wraps a geometry object in a GeoJSON Feature.\n * @param geometry - The geometry to wrap\n * @returns A GeoJSON Feature containing the geometry\n */\n static geometryFeature(geometry: Geometry): Feature {\n return {\n geometry,\n properties: {},\n type: 'Feature',\n }\n }\n\n /** Computes and caches the center point of the quadkey's bounding box as a MapBox LngLat. */\n center(): MapBox.LngLat {\n if (!this._lngLat) {\n const tile = tileFromQuadkey(this.quadkey)\n const bb = tileToBoundingBox(tile)\n const point = boundingBoxToCenter(bb)\n this._lngLat = new MapBox.LngLat(point[0], point[1])\n }\n return this._lngLat\n }\n\n /** Returns a GeoJSON Point geometry at the center of the quadkey's bounding box. */\n point(): Point {\n if (!this._point) {\n this._point = {\n coordinates: this.center().toArray(),\n type: 'Point',\n }\n }\n return this._point\n }\n\n /** Returns a GeoJSON Feature containing the center point geometry. */\n pointFeature(): Feature {\n return GeoJson.geometryFeature(this.point())\n }\n\n /** Returns a GeoJSON FeatureCollection containing the center point feature. */\n pointFeatureCollection(): FeatureCollection {\n return GeoJson.featureCollection([this.pointFeature()])\n }\n\n /** Returns a MapBox GeoJSON source specification for the center point. */\n pointSource(): MapBox.GeoJSONSourceSpecification {\n return {\n data: this.pointFeatureCollection(),\n type: 'geojson',\n }\n }\n\n /** Returns a GeoJSON Polygon geometry representing the quadkey's bounding box. */\n polygon(): Polygon {\n if (!this._polygon) {\n this._polygon = boundingBoxToPolygon(tileToBoundingBox(tileFromQuadkey(this.quadkey))) as Polygon\n }\n return this._polygon\n }\n\n /** Returns a GeoJSON Feature containing the polygon geometry. */\n polygonFeature(): Feature {\n return GeoJson.geometryFeature(this.polygon())\n }\n\n /** Returns a GeoJSON FeatureCollection containing the polygon feature. */\n polygonFeatureCollection(): FeatureCollection {\n return GeoJson.featureCollection([this.polygonFeature()])\n }\n\n /** Returns a MapBox GeoJSON source specification for the polygon. */\n polygonSource(): MapBox.GeoJSONSourceSpecification {\n return GeoJson.featuresSource(this.polygonFeatureCollection())\n }\n\n /** Returns the zoom level derived from the quadkey length. */\n zoom(): number {\n this._zoom = this._zoom ?? tileFromQuadkey(this.quadkey)[2]\n return this._zoom\n }\n}\n\nexport { GeoJson }\n","import type { MercatorBoundary, MercatorBoundingBox } from '../../types.ts'\n\n/**\n * Converts a bounding box to an ordered boundary polygon (closed ring of corner points).\n * @param box - The bounding box to convert\n * @returns An array of corner points forming a closed boundary\n */\nexport const boundingBoxToBoundary = (box: MercatorBoundingBox): MercatorBoundary => {\n return [box.getNorthWest(), box.getNorthEast(), box.getSouthEast(), box.getSouthWest(), box.getNorthWest()]\n}\n","import type { MercatorBoundingBox } from '../../types.ts'\n\n/**\n * Computes the center point of a bounding box as [lng, lat], rounded to the specified decimal places.\n * @param boundingBox - The bounding box to find the center of\n * @param decimal - Number of decimal places for rounding (default 6)\n * @returns A [longitude, latitude] tuple representing the center\n */\nexport const boundingBoxToCenter = (boundingBox: MercatorBoundingBox, decimal = 6) => {\n const west = boundingBox.getWest()\n const south = boundingBox.getSouth()\n const east = boundingBox.getEast()\n const north = boundingBox.getNorth()\n let lng = (west - east) / 2 + east\n let lat = (south - north) / 2 + north\n if (decimal !== undefined && decimal !== null) {\n lng = Number(lng.toFixed(decimal))\n lat = Number(lat.toFixed(decimal))\n }\n return [lng, lat]\n}\n","import type { Polygon } from 'geojson'\n\nimport type { MercatorBoundingBox, MercatorLngLat } from '../../types.ts'\nimport { boundingBoxToBoundary } from './boundary.ts'\n\n/**\n * Converts a bounding box to a GeoJSON Polygon geometry.\n * @param box - The bounding box to convert\n * @returns A GeoJSON Polygon representing the bounding box\n */\nexport const boundingBoxToPolygon = (box: MercatorBoundingBox): Polygon => {\n const boundry = boundingBoxToBoundary(box)\n return {\n coordinates: [boundry.map((lnglng: MercatorLngLat) => lnglng.toArray())],\n type: 'Polygon',\n }\n}\n","/** Conversion factor from degrees to radians. */\nconst d2r = Math.PI / 180\n/** Conversion factor from radians to degrees. */\nconst r2d = 180 / Math.PI\n\nexport { d2r, r2d }\n","import { d2r } from '../../constants.ts'\nimport type { MercatorLngLat, MercatorTile } from '../../types.ts'\n\n/**\n * Converts a geographic point to fractional tile coordinates at the given zoom level.\n * @param point - The geographic coordinate\n * @param z - The zoom level\n * @returns A tile with fractional x and y values\n */\nconst pointToTileFraction = (point: MercatorLngLat, z: number): MercatorTile => {\n const sin = Math.sin(point.lat * d2r)\n const z2 = Math.pow(2, z)\n let x = z2 * (point.lng / 360 + 0.5)\n const y = z2 * (0.5 - (0.25 * Math.log((1 + sin) / (1 - sin))) / Math.PI)\n\n // Wrap Tile X\n x = x % z2\n if (x < 0) x = x + z2\n return [x, y, z]\n}\n\n/**\n * Converts a geographic point to the integer Mercator tile containing it at the given zoom level.\n * @param point - The geographic coordinate\n * @param z - The zoom level\n * @returns The tile as [x, y, zoom]\n */\nconst tileFromPoint = (point: MercatorLngLat, z: number): MercatorTile => {\n const [tileX, tileY, tileZoom] = pointToTileFraction(point, z)\n const x = Math.max(Math.floor(tileX), 0)\n const y = Math.max(Math.floor(tileY), 0)\n return [x, y, tileZoom]\n}\n\nexport { tileFromPoint }\n","import type { MercatorTile } from '../../types.ts'\n\n/**\n * Converts a quadkey string to a Mercator tile [x, y, zoom].\n * @param quadkey - The quadkey string to decode\n * @returns The tile as [x, y, zoom]\n */\nconst tileFromQuadkey = (quadkey: string): MercatorTile => {\n let x = 0\n let y = 0\n const z = quadkey.length\n\n for (let i = z; i > 0; i--) {\n const mask = 1 << (i - 1)\n const q = +quadkey[z - i]\n if (q === 1) x |= mask\n if (q === 2) y |= mask\n if (q === 3) {\n x |= mask\n y |= mask\n }\n }\n return [x, y, z]\n}\n\nexport { tileFromQuadkey }\n","import MapBox from 'mapbox-gl'\n\nimport { r2d } from '../../constants.ts'\nimport type { MercatorTile } from '../../types.ts'\nimport { MercatorBoundingBox } from '../../types.ts'\n\nconst toLongitude = (x: number, z: number): number => {\n return (x / Math.pow(2, z)) * 360 - 180\n}\n\nconst toLatitude = (y: number, z: number): number => {\n const n = Math.PI - (2 * Math.PI * y) / Math.pow(2, z)\n return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)))\n}\n\n/**\n * Converts a Mercator tile to its geographic bounding box.\n * @param tile - The tile as [x, y, zoom]\n * @returns The bounding box covering the tile's geographic extent\n */\nconst tileToBoundingBox = (tile: MercatorTile): MercatorBoundingBox => {\n const e = toLongitude(tile[0] + 1, tile[2])\n const w = toLongitude(tile[0], tile[2])\n const s = toLatitude(tile[1] + 1, tile[2])\n const n = toLatitude(tile[1], tile[2])\n return new MercatorBoundingBox(new MapBox.LngLat(w, s), new MapBox.LngLat(e, n))\n}\n\nexport { tileToBoundingBox }\n","import MapBox from 'mapbox-gl'\n\n/** A Mercator tile represented as [x, y, zoom]. */\ntype MercatorTile = readonly [x: number, y: number, zoom: number]\n/** An ordered array of MercatorLngLat points forming a boundary. */\ntype MercatorBoundary = MercatorLngLat[]\n/** A Mercator bounding box extending MapBox LngLatBounds. */\nclass MercatorBoundingBox extends MapBox.LngLatBounds {}\n/** A Mercator coordinate extending MapBox LngLat. */\nclass MercatorLngLat extends MapBox.LngLat {}\n\nexport { MercatorBoundingBox, MercatorLngLat }\nexport type { MercatorBoundary, MercatorTile }\n","import type { MercatorTile } from '../../types.ts'\n\n/**\n * Returns the four child tiles at one zoom level higher.\n * @param tile - The parent tile as [x, y, zoom]\n * @returns An array of four child tiles at zoom + 1\n */\nconst tileToChildren = (tile: MercatorTile): MercatorTile[] => {\n return [\n [tile[0] * 2, tile[1] * 2, tile[2] + 1],\n [tile[0] * 2 + 1, tile[1] * 2, tile[2] + 1],\n [tile[0] * 2 + 1, tile[1] * 2 + 1, tile[2] + 1],\n [tile[0] * 2, tile[1] * 2 + 1, tile[2] + 1],\n ]\n}\n\nexport { tileToChildren }\n","import type { Polygon, Position } from 'geojson'\n\nimport type { MercatorTile } from '../../types.ts'\nimport { tileToBoundingBox } from './boundingbox.ts'\n\n/**\n * Converts a Mercator tile to a GeoJSON Polygon geometry.\n * @param tile - The tile as [x, y, zoom]\n * @returns A GeoJSON Polygon representing the tile's geographic extent\n */\nconst tileToGeoJson = (tile: MercatorTile): Polygon => {\n const box = tileToBoundingBox(tile)\n const poly: Polygon = {\n coordinates: [\n [\n box.getNorthWest().toArray() as Position,\n box.getNorthEast().toArray() as Position,\n box.getSouthEast().toArray() as Position,\n box.getSouthWest().toArray() as Position,\n box.getNorthWest().toArray() as Position,\n ],\n ],\n type: 'Polygon',\n }\n return poly\n}\n\nexport { tileToGeoJson }\n","import type { MercatorTile } from '../../types.ts'\n\n/**\n * Returns the parent tile at one zoom level lower.\n * @param tile - The tile as [x, y, zoom]\n * @returns The parent tile at zoom - 1\n */\nconst tileToParent = (tile: MercatorTile): MercatorTile => {\n return [tile[0] >> 1, tile[1] >> 1, tile[2] - 1]\n}\n\nexport { tileToParent }\n","import type { MercatorLngLat, MercatorTile } from '../../types.ts'\nimport { tileToBoundingBox } from './boundingbox.ts'\n\n/**\n * Returns the center point of a Mercator tile.\n * @param tile - The tile as [x, y, zoom]\n * @returns The center coordinate as a MercatorLngLat\n */\nconst tileToPoint = (tile: MercatorTile): MercatorLngLat => {\n const boundingBox = tileToBoundingBox(tile)\n boundingBox.getCenter()\n return boundingBox.getCenter()\n}\n\nexport { tileToPoint }\n","import type { MercatorTile } from '../../types.ts'\n\n/**\n * Converts a Mercator tile to its quadkey string representation.\n * @param param0 - The tile as [tileX, tileY, tileZoom]\n * @returns The quadkey string encoding the tile's position and zoom\n */\nconst tileToQuadkey = ([tileX, tileY, tileZoom]: MercatorTile): string => {\n let index = ''\n for (let z = tileZoom; z > 0; z--) {\n let b = 0\n const mask = 1 << (z - 1)\n if ((tileX & mask) !== 0) b++\n if ((tileY & mask) !== 0) b += 2\n index += b.toString()\n }\n return index\n}\n\nexport { tileToQuadkey }\n","import type { MercatorTile } from '../../types.ts'\nimport { tileToChildren } from './children.ts'\nimport { tileToParent } from './parent.ts'\n\n/**\n * Returns the four sibling tiles (children of the parent tile) for the given tile.\n * @param tile - The tile as [x, y, zoom]\n * @returns An array of four sibling tiles at the same zoom level\n */\nconst tileToSiblings = (tile: MercatorTile): MercatorTile[] => {\n return tileToChildren(tileToParent(tile))\n}\n\nexport { tileToSiblings }\n","import type { MercatorTile } from '../types.ts'\n\n/**\n * Checks whether two Mercator tiles are equal by comparing their x, y, and zoom values.\n * @param param0 - The first tile as [x, y, zoom]\n * @param param1 - The second tile as [x, y, zoom]\n * @returns True if both tiles have identical coordinates and zoom\n */\nexport const tilesEqual = /* @__PURE__ */ ([x1, y1, zoom1]: MercatorTile, [x2, y2, zoom2]: MercatorTile): boolean => {\n return x1 === x2 && y1 === y2 && zoom1 === zoom2\n}\n","import { tileFromPoint } from '../../tile/index.ts'\nimport type { MercatorBoundingBox, MercatorTile } from '../../types.ts'\n\n/**\n * Returns all Mercator tiles that intersect the given bounding box at the specified zoom level.\n * @param box - The geographic bounding box\n * @param zoom - The zoom level\n * @returns An array of tiles covering the bounding box\n */\nconst tilesFromBoundingBox = (box: MercatorBoundingBox, zoom: number): MercatorTile[] => {\n const nw = tileFromPoint(box.getNorthWest(), zoom)\n const se = tileFromPoint(box.getSouthEast(), zoom)\n const size = Math.pow(2, zoom)\n\n let minX = nw[0]\n let maxX = se[0]\n let minY = nw[1]\n let maxY = se[1]\n\n // in case of horizontal wrapping\n if (minX >= maxX) {\n maxX = maxX + size\n }\n\n if (zoom < 4) {\n minX = 0\n maxX = size - 1\n minY = 0\n maxY = size - 1\n }\n\n const result: MercatorTile[] = []\n\n for (let x = minX; x <= maxX; x++) {\n for (let y = minY; y <= maxY; y++) {\n result.push([x % size, y, zoom])\n }\n }\n\n return result\n}\n\nexport { tilesFromBoundingBox }\n","import type { MercatorTile } from '../types.ts'\nimport { tilesEqual } from './equal.ts'\n\n/**\n * Checks whether a specific tile exists in the given tile array.\n * @param tiles - The array of tiles to search\n * @param tile - The tile to look for\n * @returns True if the tile is found in the array\n */\nexport const tilesHasTile = (tiles: MercatorTile[], tile: MercatorTile) => {\n for (const tileToCheck of tiles) {\n if (tilesEqual(tileToCheck, tile)) return true\n }\n return false\n}\n","import { tileToSiblings } from '../tile/index.ts'\nimport type { MercatorTile } from '../types.ts'\nimport { tilesHasTile } from './hasTile.ts'\n\n/**\n * Checks whether all four siblings of the given tile exist in the tile array.\n * @param tiles - The array of tiles to search\n * @param tile - The tile whose siblings to check for\n * @returns True if all siblings are present in the array\n */\nexport const hasSiblings = (tiles: MercatorTile[], tile: MercatorTile) => {\n const siblings = tileToSiblings(tile)\n for (const sibling of siblings) {\n if (!tilesHasTile(tiles, sibling)) return false\n }\n return true\n}\n","import type MapBox from 'mapbox-gl'\n\n/** Abstract base class for managing MapBox map layers with add/remove lifecycle. */\nexport abstract class LayerBase<T extends MapBox.Layer> {\n id: string\n source: string\n\n constructor(id: string, source: string) {\n this.id = id\n this.source = source\n }\n\n /**\n * Removes and re-adds the layer on the map, optionally hiding it.\n * @param map - The MapBox map instance\n * @param show - Whether to show the layer after updating (default true)\n */\n update(map: MapBox.Map, show = true) {\n if (map.getLayer(this.id)) {\n map.removeLayer(this.id)\n }\n if (show) {\n map.addLayer(this.buildLayer())\n }\n }\n\n /** Builds the MapBox layer configuration object. */\n abstract buildLayer(): T\n}\n"],"mappings":";AAGA,OAAOA,aAAY;;;ACIZ,IAAM,wBAAwB,CAAC,QAA+C;AACnF,SAAO,CAAC,IAAI,aAAa,GAAG,IAAI,aAAa,GAAG,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 -1,3 +1,8 @@
|
|
|
1
1
|
import type { MercatorBoundary, MercatorBoundingBox } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a bounding box to an ordered boundary polygon (closed ring of corner points).
|
|
4
|
+
* @param box - The bounding box to convert
|
|
5
|
+
* @returns An array of corner points forming a closed boundary
|
|
6
|
+
*/
|
|
2
7
|
export declare const boundingBoxToBoundary: (box: MercatorBoundingBox) => MercatorBoundary;
|
|
3
8
|
//# sourceMappingURL=boundary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/boundingbox/to/boundary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAE3E,eAAO,MAAM,qBAAqB,GAAI,KAAK,mBAAmB,KAAG,gBAEhE,CAAA"}
|
|
1
|
+
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/boundingbox/to/boundary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAE3E;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,KAAK,mBAAmB,KAAG,gBAEhE,CAAA"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { MercatorBoundingBox } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Computes the center point of a bounding box as [lng, lat], rounded to the specified decimal places.
|
|
4
|
+
* @param boundingBox - The bounding box to find the center of
|
|
5
|
+
* @param decimal - Number of decimal places for rounding (default 6)
|
|
6
|
+
* @returns A [longitude, latitude] tuple representing the center
|
|
7
|
+
*/
|
|
2
8
|
export declare const boundingBoxToCenter: (boundingBox: MercatorBoundingBox, decimal?: number) => number[];
|
|
3
9
|
//# sourceMappingURL=center.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"center.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/boundingbox/to/center.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,eAAO,MAAM,mBAAmB,GAAI,aAAa,mBAAmB,EAAE,gBAAW,aAYhF,CAAA"}
|
|
1
|
+
{"version":3,"file":"center.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/boundingbox/to/center.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,aAAa,mBAAmB,EAAE,gBAAW,aAYhF,CAAA"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { Polygon } from 'geojson';
|
|
2
2
|
import type { MercatorBoundingBox } from '../../types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a bounding box to a GeoJSON Polygon geometry.
|
|
5
|
+
* @param box - The bounding box to convert
|
|
6
|
+
* @returns A GeoJSON Polygon representing the bounding box
|
|
7
|
+
*/
|
|
3
8
|
export declare const boundingBoxToPolygon: (box: MercatorBoundingBox) => Polygon;
|
|
4
9
|
//# sourceMappingURL=polygon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/boundingbox/to/polygon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,gBAAgB,CAAA;AAGzE,eAAO,MAAM,oBAAoB,GAAI,KAAK,mBAAmB,KAAG,OAM/D,CAAA"}
|
|
1
|
+
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/boundingbox/to/polygon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,gBAAgB,CAAA;AAGzE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,mBAAmB,KAAG,OAM/D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/mercator/constants.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,GAAG,QAAgB,CAAA;AACzB,QAAA,MAAM,GAAG,QAAgB,CAAA;AAEzB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/mercator/constants.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,QAAA,MAAM,GAAG,QAAgB,CAAA;AACzB,iDAAiD;AACjD,QAAA,MAAM,GAAG,QAAgB,CAAA;AAEzB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { MercatorLngLat, MercatorTile } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a geographic point to the integer Mercator tile containing it at the given zoom level.
|
|
4
|
+
* @param point - The geographic coordinate
|
|
5
|
+
* @param z - The zoom level
|
|
6
|
+
* @returns The tile as [x, y, zoom]
|
|
7
|
+
*/
|
|
2
8
|
declare const tileFromPoint: (point: MercatorLngLat, z: number) => MercatorTile;
|
|
3
9
|
export { tileFromPoint };
|
|
4
10
|
//# sourceMappingURL=point.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/from/point.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/from/point.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAoBlE;;;;;GAKG;AACH,QAAA,MAAM,aAAa,GAAI,OAAO,cAAc,EAAE,GAAG,MAAM,KAAG,YAKzD,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { MercatorTile } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a quadkey string to a Mercator tile [x, y, zoom].
|
|
4
|
+
* @param quadkey - The quadkey string to decode
|
|
5
|
+
* @returns The tile as [x, y, zoom]
|
|
6
|
+
*/
|
|
2
7
|
declare const tileFromQuadkey: (quadkey: string) => MercatorTile;
|
|
3
8
|
export { tileFromQuadkey };
|
|
4
9
|
//# sourceMappingURL=quadkey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quadkey.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/from/quadkey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,QAAA,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,YAgB1C,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"quadkey.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/from/quadkey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;GAIG;AACH,QAAA,MAAM,eAAe,GAAI,SAAS,MAAM,KAAG,YAgB1C,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { MercatorTile } from '../../types.ts';
|
|
2
2
|
import { MercatorBoundingBox } from '../../types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a Mercator tile to its geographic bounding box.
|
|
5
|
+
* @param tile - The tile as [x, y, zoom]
|
|
6
|
+
* @returns The bounding box covering the tile's geographic extent
|
|
7
|
+
*/
|
|
3
8
|
declare const tileToBoundingBox: (tile: MercatorTile) => MercatorBoundingBox;
|
|
4
9
|
export { tileToBoundingBox };
|
|
5
10
|
//# sourceMappingURL=boundingbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundingbox.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/boundingbox.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAWpD,QAAA,MAAM,iBAAiB,GAAI,MAAM,YAAY,KAAG,mBAM/C,CAAA;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"boundingbox.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/boundingbox.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAWpD;;;;GAIG;AACH,QAAA,MAAM,iBAAiB,GAAI,MAAM,YAAY,KAAG,mBAM/C,CAAA;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { MercatorTile } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the four child tiles at one zoom level higher.
|
|
4
|
+
* @param tile - The parent tile as [x, y, zoom]
|
|
5
|
+
* @returns An array of four child tiles at zoom + 1
|
|
6
|
+
*/
|
|
2
7
|
declare const tileToChildren: (tile: MercatorTile) => MercatorTile[];
|
|
3
8
|
export { tileToChildren };
|
|
4
9
|
//# sourceMappingURL=children.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"children.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/children.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,QAAA,MAAM,cAAc,GAAI,MAAM,YAAY,KAAG,YAAY,EAOxD,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"children.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/children.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;GAIG;AACH,QAAA,MAAM,cAAc,GAAI,MAAM,YAAY,KAAG,YAAY,EAOxD,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Polygon } from 'geojson';
|
|
2
2
|
import type { MercatorTile } from '../../types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a Mercator tile to a GeoJSON Polygon geometry.
|
|
5
|
+
* @param tile - The tile as [x, y, zoom]
|
|
6
|
+
* @returns A GeoJSON Polygon representing the tile's geographic extent
|
|
7
|
+
*/
|
|
3
8
|
declare const tileToGeoJson: (tile: MercatorTile) => Polygon;
|
|
4
9
|
export { tileToGeoJson };
|
|
5
10
|
//# sourceMappingURL=geoJson.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geoJson.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/geoJson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAY,MAAM,SAAS,CAAA;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAGlD,QAAA,MAAM,aAAa,GAAI,MAAM,YAAY,KAAG,OAe3C,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"geoJson.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/geoJson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAY,MAAM,SAAS,CAAA;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAGlD;;;;GAIG;AACH,QAAA,MAAM,aAAa,GAAI,MAAM,YAAY,KAAG,OAe3C,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { MercatorTile } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the parent tile at one zoom level lower.
|
|
4
|
+
* @param tile - The tile as [x, y, zoom]
|
|
5
|
+
* @returns The parent tile at zoom - 1
|
|
6
|
+
*/
|
|
2
7
|
declare const tileToParent: (tile: MercatorTile) => MercatorTile;
|
|
3
8
|
export { tileToParent };
|
|
4
9
|
//# sourceMappingURL=parent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parent.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/parent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,QAAA,MAAM,YAAY,GAAI,MAAM,YAAY,KAAG,YAE1C,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"parent.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/parent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;GAIG;AACH,QAAA,MAAM,YAAY,GAAI,MAAM,YAAY,KAAG,YAE1C,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { MercatorLngLat, MercatorTile } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the center point of a Mercator tile.
|
|
4
|
+
* @param tile - The tile as [x, y, zoom]
|
|
5
|
+
* @returns The center coordinate as a MercatorLngLat
|
|
6
|
+
*/
|
|
2
7
|
declare const tileToPoint: (tile: MercatorTile) => MercatorLngLat;
|
|
3
8
|
export { tileToPoint };
|
|
4
9
|
//# sourceMappingURL=point.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/point.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAGlE,QAAA,MAAM,WAAW,GAAI,MAAM,YAAY,KAAG,cAIzC,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/point.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAGlE;;;;GAIG;AACH,QAAA,MAAM,WAAW,GAAI,MAAM,YAAY,KAAG,cAIzC,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { MercatorTile } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a Mercator tile to its quadkey string representation.
|
|
4
|
+
* @param param0 - The tile as [tileX, tileY, tileZoom]
|
|
5
|
+
* @returns The quadkey string encoding the tile's position and zoom
|
|
6
|
+
*/
|
|
2
7
|
declare const tileToQuadkey: ([tileX, tileY, tileZoom]: MercatorTile) => string;
|
|
3
8
|
export { tileToQuadkey };
|
|
4
9
|
//# sourceMappingURL=quadkey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quadkey.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/quadkey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,QAAA,MAAM,aAAa,GAAI,0BAA0B,YAAY,KAAG,MAU/D,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"quadkey.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/quadkey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;GAIG;AACH,QAAA,MAAM,aAAa,GAAI,0BAA0B,YAAY,KAAG,MAU/D,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { MercatorTile } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the four sibling tiles (children of the parent tile) for the given tile.
|
|
4
|
+
* @param tile - The tile as [x, y, zoom]
|
|
5
|
+
* @returns An array of four sibling tiles at the same zoom level
|
|
6
|
+
*/
|
|
2
7
|
declare const tileToSiblings: (tile: MercatorTile) => MercatorTile[];
|
|
3
8
|
export { tileToSiblings };
|
|
4
9
|
//# sourceMappingURL=siblings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siblings.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/siblings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAIlD,QAAA,MAAM,cAAc,GAAI,MAAM,YAAY,KAAG,YAAY,EAExD,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"siblings.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tile/to/siblings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAIlD;;;;GAIG;AACH,QAAA,MAAM,cAAc,GAAI,MAAM,YAAY,KAAG,YAAY,EAExD,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { MercatorTile } from '../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether two Mercator tiles are equal by comparing their x, y, and zoom values.
|
|
4
|
+
* @param param0 - The first tile as [x, y, zoom]
|
|
5
|
+
* @param param1 - The second tile as [x, y, zoom]
|
|
6
|
+
* @returns True if both tiles have identical coordinates and zoom
|
|
7
|
+
*/
|
|
2
8
|
export declare const tilesEqual: ([x1, y1, zoom1]: MercatorTile, [x2, y2, zoom2]: MercatorTile) => boolean;
|
|
3
9
|
//# sourceMappingURL=equal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equal.d.ts","sourceRoot":"","sources":["../../../../src/mercator/tiles/equal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,eAAO,MAAM,UAAU,GAAoB,iBAAiB,YAAY,EAAE,iBAAiB,YAAY,KAAG,OAEzG,CAAA"}
|
|
1
|
+
{"version":3,"file":"equal.d.ts","sourceRoot":"","sources":["../../../../src/mercator/tiles/equal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAoB,iBAAiB,YAAY,EAAE,iBAAiB,YAAY,KAAG,OAEzG,CAAA"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { MercatorBoundingBox, MercatorTile } from '../../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Returns all Mercator tiles that intersect the given bounding box at the specified zoom level.
|
|
4
|
+
* @param box - The geographic bounding box
|
|
5
|
+
* @param zoom - The zoom level
|
|
6
|
+
* @returns An array of tiles covering the bounding box
|
|
7
|
+
*/
|
|
2
8
|
declare const tilesFromBoundingBox: (box: MercatorBoundingBox, zoom: number) => MercatorTile[];
|
|
3
9
|
export { tilesFromBoundingBox };
|
|
4
10
|
//# sourceMappingURL=boundingbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundingbox.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tiles/from/boundingbox.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAEvE,QAAA,MAAM,oBAAoB,GAAI,KAAK,mBAAmB,EAAE,MAAM,MAAM,KAAG,YAAY,EA+BlF,CAAA;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"boundingbox.d.ts","sourceRoot":"","sources":["../../../../../src/mercator/tiles/from/boundingbox.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAEvE;;;;;GAKG;AACH,QAAA,MAAM,oBAAoB,GAAI,KAAK,mBAAmB,EAAE,MAAM,MAAM,KAAG,YAAY,EA+BlF,CAAA;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { MercatorTile } from '../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether all four siblings of the given tile exist in the tile array.
|
|
4
|
+
* @param tiles - The array of tiles to search
|
|
5
|
+
* @param tile - The tile whose siblings to check for
|
|
6
|
+
* @returns True if all siblings are present in the array
|
|
7
|
+
*/
|
|
2
8
|
export declare const hasSiblings: (tiles: MercatorTile[], tile: MercatorTile) => boolean;
|
|
3
9
|
//# sourceMappingURL=hasSiblings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasSiblings.d.ts","sourceRoot":"","sources":["../../../../src/mercator/tiles/hasSiblings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,eAAO,MAAM,WAAW,GAAI,OAAO,YAAY,EAAE,EAAE,MAAM,YAAY,YAMpE,CAAA"}
|
|
1
|
+
{"version":3,"file":"hasSiblings.d.ts","sourceRoot":"","sources":["../../../../src/mercator/tiles/hasSiblings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,YAAY,EAAE,EAAE,MAAM,YAAY,YAMpE,CAAA"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { MercatorTile } from '../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether a specific tile exists in the given tile array.
|
|
4
|
+
* @param tiles - The array of tiles to search
|
|
5
|
+
* @param tile - The tile to look for
|
|
6
|
+
* @returns True if the tile is found in the array
|
|
7
|
+
*/
|
|
2
8
|
export declare const tilesHasTile: (tiles: MercatorTile[], tile: MercatorTile) => boolean;
|
|
3
9
|
//# sourceMappingURL=hasTile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasTile.d.ts","sourceRoot":"","sources":["../../../../src/mercator/tiles/hasTile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,eAAO,MAAM,YAAY,GAAI,OAAO,YAAY,EAAE,EAAE,MAAM,YAAY,YAKrE,CAAA"}
|
|
1
|
+
{"version":3,"file":"hasTile.d.ts","sourceRoot":"","sources":["../../../../src/mercator/tiles/hasTile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,YAAY,EAAE,EAAE,MAAM,YAAY,YAKrE,CAAA"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import MapBox from 'mapbox-gl';
|
|
2
|
+
/** A Mercator tile represented as [x, y, zoom]. */
|
|
2
3
|
type MercatorTile = readonly [x: number, y: number, zoom: number];
|
|
4
|
+
/** An ordered array of MercatorLngLat points forming a boundary. */
|
|
3
5
|
type MercatorBoundary = MercatorLngLat[];
|
|
6
|
+
/** A Mercator bounding box extending MapBox LngLatBounds. */
|
|
4
7
|
declare class MercatorBoundingBox extends MapBox.LngLatBounds {
|
|
5
8
|
}
|
|
9
|
+
/** A Mercator coordinate extending MapBox LngLat. */
|
|
6
10
|
declare class MercatorLngLat extends MapBox.LngLat {
|
|
7
11
|
}
|
|
8
12
|
export { MercatorBoundingBox, MercatorLngLat };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/mercator/types.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,WAAW,CAAA;AAE9B,KAAK,YAAY,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AACjE,KAAK,gBAAgB,GAAG,cAAc,EAAE,CAAA;AACxC,cAAM,mBAAoB,SAAQ,MAAM,CAAC,YAAY;CAAG;AACxD,cAAM,cAAe,SAAQ,MAAM,CAAC,MAAM;CAAG;AAE7C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,CAAA;AAC9C,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/mercator/types.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,WAAW,CAAA;AAE9B,mDAAmD;AACnD,KAAK,YAAY,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AACjE,oEAAoE;AACpE,KAAK,gBAAgB,GAAG,cAAc,EAAE,CAAA;AACxC,6DAA6D;AAC7D,cAAM,mBAAoB,SAAQ,MAAM,CAAC,YAAY;CAAG;AACxD,qDAAqD;AACrD,cAAM,cAAe,SAAQ,MAAM,CAAC,MAAM;CAAG;AAE7C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,CAAA;AAC9C,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/geo",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.86",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xylabs",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"mapbox-gl": "~3.19.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
49
|
-
"@xylabs/tsconfig": "~7.4.
|
|
48
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.16",
|
|
49
|
+
"@xylabs/tsconfig": "~7.4.16",
|
|
50
50
|
"typescript": "~5.9.3",
|
|
51
51
|
"vitest": "~4.0.18"
|
|
52
52
|
},
|