You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@xylabs/geo

Package Overview
Dependencies
Maintainers
5
Versions
250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/geo - npm Package Compare versions

Comparing version
5.0.83
to
5.0.84
+26
-0
dist/neutral/GeoJson.d.ts
import type { Feature, FeatureCollection, Geometry, Point, Polygon } from 'geojson';
import MapBox from 'mapbox-gl';
/** Provides GeoJSON geometry and MapBox source generation from a quadkey. */
declare class GeoJson {

@@ -10,14 +11,39 @@ private _lngLat?;

constructor(quadkey: string);
/**
* Creates a GeoJSON FeatureCollection from an array of features.
* @param features - The features to include
* @returns A GeoJSON FeatureCollection
*/
static featureCollection(features: Feature[]): FeatureCollection;
/**
* Creates a MapBox GeoJSON source specification from a FeatureCollection.
* @param data - The FeatureCollection to use as the source data
* @returns A MapBox GeoJSON source specification
*/
static featuresSource(data: FeatureCollection): MapBox.GeoJSONSourceSpecification;
/**
* Wraps a geometry object in a GeoJSON Feature.
* @param geometry - The geometry to wrap
* @returns A GeoJSON Feature containing the geometry
*/
static geometryFeature(geometry: Geometry): Feature;
/** Computes and caches the center point of the quadkey's bounding box as a MapBox LngLat. */
center(): MapBox.LngLat;
/** Returns a GeoJSON Point geometry at the center of the quadkey's bounding box. */
point(): Point;
/** Returns a GeoJSON Feature containing the center point geometry. */
pointFeature(): Feature;
/** Returns a GeoJSON FeatureCollection containing the center point feature. */
pointFeatureCollection(): FeatureCollection;
/** Returns a MapBox GeoJSON source specification for the center point. */
pointSource(): MapBox.GeoJSONSourceSpecification;
/** Returns a GeoJSON Polygon geometry representing the quadkey's bounding box. */
polygon(): Polygon;
/** Returns a GeoJSON Feature containing the polygon geometry. */
polygonFeature(): Feature;
/** Returns a GeoJSON FeatureCollection containing the polygon feature. */
polygonFeatureCollection(): FeatureCollection;
/** Returns a MapBox GeoJSON source specification for the polygon. */
polygonSource(): MapBox.GeoJSONSourceSpecification;
/** Returns the zoom level derived from the quadkey length. */
zoom(): number;

@@ -24,0 +50,0 @@ }

+1
-1

@@ -1,1 +0,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,CAAC,CAAe;IAC/B,OAAO,CAAC,MAAM,CAAC,CAAO;IACtB,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAC,CAAQ;IAEtB,OAAO,CAAC,OAAO,CAAQ;gBAEX,OAAO,EAAE,MAAM;IAI3B,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,iBAAiB;IAOhE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,0BAA0B;IAOjF,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO;IAQnD,MAAM,IAAI,MAAM,CAAC,MAAM;IAUvB,KAAK,IAAI,KAAK;IAUd,YAAY,IAAI,OAAO;IAIvB,sBAAsB,IAAI,iBAAiB;IAI3C,WAAW,IAAI,MAAM,CAAC,0BAA0B;IAOhD,OAAO,IAAI,OAAO;IAOlB,cAAc,IAAI,OAAO;IAIzB,wBAAwB,IAAI,iBAAiB;IAI7C,aAAa,IAAI,MAAM,CAAC,0BAA0B;IAIlD,IAAI,IAAI,MAAM;CAIf;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
{"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,6EAA6E;AAC7E,cAAM,OAAO;IACX,OAAO,CAAC,OAAO,CAAC,CAAe;IAC/B,OAAO,CAAC,MAAM,CAAC,CAAO;IACtB,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAC,CAAQ;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"}

@@ -215,2 +215,7 @@ // src/GeoJson.ts

}
/**
* Creates a GeoJSON FeatureCollection from an array of features.
* @param features - The features to include
* @returns A GeoJSON FeatureCollection
*/
static featureCollection(features) {

@@ -222,2 +227,7 @@ return {

}
/**
* Creates a MapBox GeoJSON source specification from a FeatureCollection.
* @param data - The FeatureCollection to use as the source data
* @returns A MapBox GeoJSON source specification
*/
static featuresSource(data) {

@@ -229,2 +239,7 @@ return {

}
/**
* Wraps a geometry object in a GeoJSON Feature.
* @param geometry - The geometry to wrap
* @returns A GeoJSON Feature containing the geometry
*/
static geometryFeature(geometry) {

@@ -237,2 +252,3 @@ return {

}
/** Computes and caches the center point of the quadkey's bounding box as a MapBox LngLat. */
center() {

@@ -247,2 +263,3 @@ if (!this._lngLat) {

}
/** Returns a GeoJSON Point geometry at the center of the quadkey's bounding box. */
point() {

@@ -257,8 +274,11 @@ if (!this._point) {

}
/** Returns a GeoJSON Feature containing the center point geometry. */
pointFeature() {
return _GeoJson.geometryFeature(this.point());
}
/** Returns a GeoJSON FeatureCollection containing the center point feature. */
pointFeatureCollection() {
return _GeoJson.featureCollection([this.pointFeature()]);
}
/** Returns a MapBox GeoJSON source specification for the center point. */
pointSource() {

@@ -270,2 +290,3 @@ return {

}
/** Returns a GeoJSON Polygon geometry representing the quadkey's bounding box. */
polygon() {

@@ -277,11 +298,15 @@ if (!this._polygon) {

}
/** Returns a GeoJSON Feature containing the polygon geometry. */
polygonFeature() {
return _GeoJson.geometryFeature(this.polygon());
}
/** Returns a GeoJSON FeatureCollection containing the polygon feature. */
polygonFeatureCollection() {
return _GeoJson.featureCollection([this.polygonFeature()]);
}
/** Returns a MapBox GeoJSON source specification for the polygon. */
polygonSource() {
return _GeoJson.featuresSource(this.polygonFeatureCollection());
}
/** Returns the zoom level derived from the quadkey length. */
zoom() {

@@ -301,2 +326,7 @@ this._zoom = this._zoom ?? tileFromQuadkey(this.quadkey)[2];

}
/**
* Removes and re-adds the layer on the map, optionally hiding it.
* @param map - The MapBox map instance
* @param show - Whether to show the layer after updating (default true)
*/
update(map, show = true) {

@@ -303,0 +333,0 @@ if (map.getLayer(this.id)) {

@@ -1,1 +0,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,GAAG;AACzC,SAAO;AAAA,IACL,aAAa,CAAC,QAAQ,IAAI,CAAC,WAA2B,OAAO,QAAQ,CAAC,CAAC;AAAA,IACvE,MAAM;AAAA,EACR;AACF;;;ACXA,IAAM,MAAM,KAAK,KAAK;AACtB,IAAM,MAAM,MAAM,KAA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,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"]}
{"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,IAAI,aAAa,GAAG,IAAI,aAAa,GAAG,IAAI,aAAa,CAAC;AAC5G;;;ACDO,IAAM,sBAAsB,CAAC,aAAkC,UAAU,MAAM;AACpF,QAAM,OAAO,YAAY,QAAQ;AACjC,QAAM,QAAQ,YAAY,SAAS;AACnC,QAAM,OAAO,YAAY,QA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AAO;AAAA,MACL,MAAM,KAAK,uBAAuB;AAAA,MAClC,MAAM;AAAA,IACR;AAAA,EACF;AAAA;AAAA,EAGA,UAAmB;AACjB,QAAI,CAAC,KAAK,UAAU;AAClB,WAAK,WAAW,qBAAqB,kBAAkB,gBAAgB,KAAK,OAAO,CAAC,CAAC;AAAA,IACvF;AACA,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,iBAA0B;AACxB,WAAO,SAAQ,gBAAgB,KAAK,QAAQ,CAAC;AAAA,EAC/C;AAAA;AAAA,EAGA,2BAA8C;AAC5C,WAAO,SAAQ,kBAAkB,CAAC,KAAK,eAAe,CAAC,CAAC;AAAA,EAC1D;AAAA;AAAA,EAGA,gBAAmD;AACjD,WAAO,SAAQ,eAAe,KAAK,yBAAyB,CAAC;AAAA,EAC/D;AAAA;AAAA,EAGA,OAAe;AACb,SAAK,QAAQ,KAAK,SAAS,gBAAgB,KAAK,OAAO,EAAE,CAAC;AAC1D,WAAO,KAAK;AAAA,EACd;AACF;;;AmB5HO,IAAe,YAAf,MAAiD;AAAA,EACtD;AAAA,EACA;AAAA,EAEA,YAAY,IAAY,QAAgB;AACtC,SAAK,KAAK;AACV,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,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;AAIF;","names":["MapBox","MapBox","MapBox","MapBox"]}
import type MapBox from 'mapbox-gl';
/** Abstract base class for managing MapBox map layers with add/remove lifecycle. */
export declare abstract class LayerBase<T extends MapBox.Layer> {

@@ -6,5 +7,11 @@ id: string;

constructor(id: string, source: string);
/**
* Removes and re-adds the layer on the map, optionally hiding it.
* @param map - The MapBox map instance
* @param show - Whether to show the layer after updating (default true)
*/
update(map: MapBox.Map, show?: boolean): void;
/** Builds the MapBox layer configuration object. */
abstract buildLayer(): T;
}
//# sourceMappingURL=LayerBase.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorBoundary, MercatorBoundingBox } from '../../types.ts';
/**
* Converts a bounding box to an ordered boundary polygon (closed ring of corner points).
* @param box - The bounding box to convert
* @returns An array of corner points forming a closed boundary
*/
export declare const boundingBoxToBoundary: (box: MercatorBoundingBox) => MercatorBoundary;
//# sourceMappingURL=boundary.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorBoundingBox } from '../../types.ts';
/**
* Computes the center point of a bounding box as [lng, lat], rounded to the specified decimal places.
* @param boundingBox - The bounding box to find the center of
* @param decimal - Number of decimal places for rounding (default 6)
* @returns A [longitude, latitude] tuple representing the center
*/
export declare const boundingBoxToCenter: (boundingBox: MercatorBoundingBox, decimal?: number) => number[];
//# sourceMappingURL=center.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { Polygon } from 'geojson';
import type { MercatorBoundingBox } from '../../types.ts';
/**
* Converts a bounding box to a GeoJSON Polygon geometry.
* @param box - The bounding box to convert
* @returns A GeoJSON Polygon representing the bounding box
*/
export declare const boundingBoxToPolygon: (box: MercatorBoundingBox) => Polygon;
//# sourceMappingURL=polygon.d.ts.map

@@ -1,1 +0,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"}
{"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"}

@@ -0,4 +1,6 @@

/** Conversion factor from degrees to radians. */
declare const d2r: number;
/** Conversion factor from radians to degrees. */
declare const r2d: number;
export { d2r, r2d };
//# sourceMappingURL=constants.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorLngLat, MercatorTile } from '../../types.ts';
/**
* Converts a geographic point to the integer Mercator tile containing it at the given zoom level.
* @param point - The geographic coordinate
* @param z - The zoom level
* @returns The tile as [x, y, zoom]
*/
declare const tileFromPoint: (point: MercatorLngLat, z: number) => MercatorTile;
export { tileFromPoint };
//# sourceMappingURL=point.d.ts.map

@@ -1,1 +0,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;AAclE,QAAA,MAAM,aAAa,GAAI,OAAO,cAAc,EAAE,GAAG,MAAM,KAAG,YAKzD,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
{"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"}
import type { MercatorTile } from '../../types.ts';
/**
* Converts a quadkey string to a Mercator tile [x, y, zoom].
* @param quadkey - The quadkey string to decode
* @returns The tile as [x, y, zoom]
*/
declare const tileFromQuadkey: (quadkey: string) => MercatorTile;
export { tileFromQuadkey };
//# sourceMappingURL=quadkey.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorTile } from '../../types.ts';
import { MercatorBoundingBox } from '../../types.ts';
/**
* Converts a Mercator tile to its geographic bounding box.
* @param tile - The tile as [x, y, zoom]
* @returns The bounding box covering the tile's geographic extent
*/
declare const tileToBoundingBox: (tile: MercatorTile) => MercatorBoundingBox;
export { tileToBoundingBox };
//# sourceMappingURL=boundingbox.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorTile } from '../../types.ts';
/**
* Returns the four child tiles at one zoom level higher.
* @param tile - The parent tile as [x, y, zoom]
* @returns An array of four child tiles at zoom + 1
*/
declare const tileToChildren: (tile: MercatorTile) => MercatorTile[];
export { tileToChildren };
//# sourceMappingURL=children.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { Polygon } from 'geojson';
import type { MercatorTile } from '../../types.ts';
/**
* Converts a Mercator tile to a GeoJSON Polygon geometry.
* @param tile - The tile as [x, y, zoom]
* @returns A GeoJSON Polygon representing the tile's geographic extent
*/
declare const tileToGeoJson: (tile: MercatorTile) => Polygon;
export { tileToGeoJson };
//# sourceMappingURL=geoJson.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorTile } from '../../types.ts';
/**
* Returns the parent tile at one zoom level lower.
* @param tile - The tile as [x, y, zoom]
* @returns The parent tile at zoom - 1
*/
declare const tileToParent: (tile: MercatorTile) => MercatorTile;
export { tileToParent };
//# sourceMappingURL=parent.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorLngLat, MercatorTile } from '../../types.ts';
/**
* Returns the center point of a Mercator tile.
* @param tile - The tile as [x, y, zoom]
* @returns The center coordinate as a MercatorLngLat
*/
declare const tileToPoint: (tile: MercatorTile) => MercatorLngLat;
export { tileToPoint };
//# sourceMappingURL=point.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorTile } from '../../types.ts';
/**
* Converts a Mercator tile to its quadkey string representation.
* @param param0 - The tile as [tileX, tileY, tileZoom]
* @returns The quadkey string encoding the tile's position and zoom
*/
declare const tileToQuadkey: ([tileX, tileY, tileZoom]: MercatorTile) => string;
export { tileToQuadkey };
//# sourceMappingURL=quadkey.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorTile } from '../../types.ts';
/**
* Returns the four sibling tiles (children of the parent tile) for the given tile.
* @param tile - The tile as [x, y, zoom]
* @returns An array of four sibling tiles at the same zoom level
*/
declare const tileToSiblings: (tile: MercatorTile) => MercatorTile[];
export { tileToSiblings };
//# sourceMappingURL=siblings.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorTile } from '../types.ts';
/**
* Checks whether two Mercator tiles are equal by comparing their x, y, and zoom values.
* @param param0 - The first tile as [x, y, zoom]
* @param param1 - The second tile as [x, y, zoom]
* @returns True if both tiles have identical coordinates and zoom
*/
export declare const tilesEqual: ([x1, y1, zoom1]: MercatorTile, [x2, y2, zoom2]: MercatorTile) => boolean;
//# sourceMappingURL=equal.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorBoundingBox, MercatorTile } from '../../types.ts';
/**
* Returns all Mercator tiles that intersect the given bounding box at the specified zoom level.
* @param box - The geographic bounding box
* @param zoom - The zoom level
* @returns An array of tiles covering the bounding box
*/
declare const tilesFromBoundingBox: (box: MercatorBoundingBox, zoom: number) => MercatorTile[];
export { tilesFromBoundingBox };
//# sourceMappingURL=boundingbox.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorTile } from '../types.ts';
/**
* Checks whether all four siblings of the given tile exist in the tile array.
* @param tiles - The array of tiles to search
* @param tile - The tile whose siblings to check for
* @returns True if all siblings are present in the array
*/
export declare const hasSiblings: (tiles: MercatorTile[], tile: MercatorTile) => boolean;
//# sourceMappingURL=hasSiblings.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import type { MercatorTile } from '../types.ts';
/**
* Checks whether a specific tile exists in the given tile array.
* @param tiles - The array of tiles to search
* @param tile - The tile to look for
* @returns True if the tile is found in the array
*/
export declare const tilesHasTile: (tiles: MercatorTile[], tile: MercatorTile) => boolean;
//# sourceMappingURL=hasTile.d.ts.map

@@ -1,1 +0,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"}
{"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"}
import MapBox from 'mapbox-gl';
/** A Mercator tile represented as [x, y, zoom]. */
type MercatorTile = readonly [x: number, y: number, zoom: number];
/** An ordered array of MercatorLngLat points forming a boundary. */
type MercatorBoundary = MercatorLngLat[];
/** A Mercator bounding box extending MapBox LngLatBounds. */
declare class MercatorBoundingBox extends MapBox.LngLatBounds {
}
/** A Mercator coordinate extending MapBox LngLat. */
declare class MercatorLngLat extends MapBox.LngLat {

@@ -7,0 +11,0 @@ }

@@ -1,1 +0,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"}
{"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"}
{
"name": "@xylabs/geo",
"version": "5.0.83",
"version": "5.0.84",
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",

@@ -48,4 +48,4 @@ "keywords": [

"devDependencies": {
"@xylabs/ts-scripts-yarn3": "~7.4.11",
"@xylabs/tsconfig": "~7.4.11",
"@xylabs/ts-scripts-yarn3": "~7.4.13",
"@xylabs/tsconfig": "~7.4.13",
"typescript": "~5.9.3",

@@ -52,0 +52,0 @@ "vitest": "~4.0.18"

+175
-5

@@ -68,2 +68,4 @@ # @xylabs/geo

Provides GeoJSON geometry and MapBox source generation from a quadkey.
## Constructors

@@ -95,2 +97,4 @@

Creates a GeoJSON FeatureCollection from an array of features.
### Parameters

@@ -102,2 +106,4 @@

The features to include
### Returns

@@ -107,2 +113,4 @@

A GeoJSON FeatureCollection
***

@@ -116,2 +124,4 @@

Creates a MapBox GeoJSON source specification from a FeatureCollection.
### Parameters

@@ -123,2 +133,4 @@

The FeatureCollection to use as the source data
### Returns

@@ -128,2 +140,4 @@

A MapBox GeoJSON source specification
***

@@ -137,2 +151,4 @@

Wraps a geometry object in a GeoJSON Feature.
### Parameters

@@ -144,2 +160,4 @@

The geometry to wrap
### Returns

@@ -149,2 +167,4 @@

A GeoJSON Feature containing the geometry
***

@@ -158,2 +178,4 @@

Computes and caches the center point of the quadkey's bounding box as a MapBox LngLat.
### Returns

@@ -171,2 +193,4 @@

Returns a GeoJSON Point geometry at the center of the quadkey's bounding box.
### Returns

@@ -184,2 +208,4 @@

Returns a GeoJSON Feature containing the center point geometry.
### Returns

@@ -197,2 +223,4 @@

Returns a GeoJSON FeatureCollection containing the center point feature.
### Returns

@@ -210,2 +238,4 @@

Returns a MapBox GeoJSON source specification for the center point.
### Returns

@@ -223,2 +253,4 @@

Returns a GeoJSON Polygon geometry representing the quadkey's bounding box.
### Returns

@@ -236,2 +268,4 @@

Returns a GeoJSON Feature containing the polygon geometry.
### Returns

@@ -249,2 +283,4 @@

Returns a GeoJSON FeatureCollection containing the polygon feature.
### Returns

@@ -262,2 +298,4 @@

Returns a MapBox GeoJSON source specification for the polygon.
### Returns

@@ -275,2 +313,4 @@

Returns the zoom level derived from the quadkey length.
### Returns

@@ -286,2 +326,4 @@

Abstract base class for managing MapBox map layers with add/remove lifecycle.
## Type Parameters

@@ -339,2 +381,4 @@

Removes and re-adds the layer on the map, optionally hiding it.
### Parameters

@@ -346,2 +390,4 @@

The MapBox map instance
#### show?

@@ -351,2 +397,4 @@

Whether to show the layer after updating (default true)
### Returns

@@ -364,2 +412,4 @@

Builds the MapBox layer configuration object.
### Returns

@@ -375,2 +425,4 @@

A Mercator bounding box extending MapBox LngLatBounds.
## Extends

@@ -414,2 +466,4 @@

A Mercator coordinate extending MapBox LngLat.
## Extends

@@ -459,2 +513,4 @@

Converts a bounding box to an ordered boundary polygon (closed ring of corner points).
## Parameters

@@ -466,2 +522,4 @@

The bounding box to convert
## Returns

@@ -471,2 +529,4 @@

An array of corner points forming a closed boundary
### <a id="boundingBoxToCenter"></a>boundingBoxToCenter

@@ -482,2 +542,4 @@

Computes the center point of a bounding box as [lng, lat], rounded to the specified decimal places.
## Parameters

@@ -489,2 +551,4 @@

The bounding box to find the center of
### decimal?

@@ -494,2 +558,4 @@

Number of decimal places for rounding (default 6)
## Returns

@@ -499,2 +565,4 @@

A [longitude, latitude] tuple representing the center
### <a id="boundingBoxToPolygon"></a>boundingBoxToPolygon

@@ -510,2 +578,4 @@

Converts a bounding box to a GeoJSON Polygon geometry.
## Parameters

@@ -517,2 +587,4 @@

The bounding box to convert
## Returns

@@ -522,2 +594,4 @@

A GeoJSON Polygon representing the bounding box
### <a id="hasSiblings"></a>hasSiblings

@@ -533,2 +607,4 @@

Checks whether all four siblings of the given tile exist in the tile array.
## Parameters

@@ -540,2 +616,4 @@

The array of tiles to search
### tile

@@ -545,2 +623,4 @@

The tile whose siblings to check for
## Returns

@@ -550,2 +630,4 @@

True if all siblings are present in the array
### <a id="tileFromPoint"></a>tileFromPoint

@@ -561,2 +643,4 @@

Converts a geographic point to the integer Mercator tile containing it at the given zoom level.
## Parameters

@@ -568,2 +652,4 @@

The geographic coordinate
### z

@@ -573,2 +659,4 @@

The zoom level
## Returns

@@ -578,2 +666,4 @@

The tile as [x, y, zoom]
### <a id="tileFromQuadkey"></a>tileFromQuadkey

@@ -589,2 +679,4 @@

Converts a quadkey string to a Mercator tile [x, y, zoom].
## Parameters

@@ -596,2 +688,4 @@

The quadkey string to decode
## Returns

@@ -601,2 +695,4 @@

The tile as [x, y, zoom]
### <a id="tileToBoundingBox"></a>tileToBoundingBox

@@ -612,2 +708,4 @@

Converts a Mercator tile to its geographic bounding box.
## Parameters

@@ -619,2 +717,4 @@

The tile as [x, y, zoom]
## Returns

@@ -624,2 +724,4 @@

The bounding box covering the tile's geographic extent
### <a id="tileToChildren"></a>tileToChildren

@@ -635,2 +737,4 @@

Returns the four child tiles at one zoom level higher.
## Parameters

@@ -642,2 +746,4 @@

The parent tile as [x, y, zoom]
## Returns

@@ -647,2 +753,4 @@

An array of four child tiles at zoom + 1
### <a id="tileToGeoJson"></a>tileToGeoJson

@@ -658,2 +766,4 @@

Converts a Mercator tile to a GeoJSON Polygon geometry.
## Parameters

@@ -665,2 +775,4 @@

The tile as [x, y, zoom]
## Returns

@@ -670,2 +782,4 @@

A GeoJSON Polygon representing the tile's geographic extent
### <a id="tileToParent"></a>tileToParent

@@ -681,2 +795,4 @@

Returns the parent tile at one zoom level lower.
## Parameters

@@ -688,2 +804,4 @@

The tile as [x, y, zoom]
## Returns

@@ -693,2 +811,4 @@

The parent tile at zoom - 1
### <a id="tileToPoint"></a>tileToPoint

@@ -704,2 +824,4 @@

Returns the center point of a Mercator tile.
## Parameters

@@ -711,2 +833,4 @@

The tile as [x, y, zoom]
## Returns

@@ -716,2 +840,4 @@

The center coordinate as a MercatorLngLat
### <a id="tileToQuadkey"></a>tileToQuadkey

@@ -724,11 +850,15 @@

```ts
function tileToQuadkey(__namedParameters): string;
function tileToQuadkey(param0): string;
```
Converts a Mercator tile to its quadkey string representation.
## Parameters
### \_\_namedParameters
### param0
[`MercatorTile`](#../type-aliases/MercatorTile)
The tile as [tileX, tileY, tileZoom]
## Returns

@@ -738,2 +868,4 @@

The quadkey string encoding the tile's position and zoom
### <a id="tileToSiblings"></a>tileToSiblings

@@ -749,2 +881,4 @@

Returns the four sibling tiles (children of the parent tile) for the given tile.
## Parameters

@@ -756,2 +890,4 @@

The tile as [x, y, zoom]
## Returns

@@ -761,2 +897,4 @@

An array of four sibling tiles at the same zoom level
### <a id="tilesEqual"></a>tilesEqual

@@ -769,15 +907,21 @@

```ts
function tilesEqual(__namedParameters, __namedParameters): boolean;
function tilesEqual(param0, param1): boolean;
```
Checks whether two Mercator tiles are equal by comparing their x, y, and zoom values.
## Parameters
### \_\_namedParameters
### param0
[`MercatorTile`](#../type-aliases/MercatorTile)
### \_\_namedParameters
The first tile as [x, y, zoom]
### param1
[`MercatorTile`](#../type-aliases/MercatorTile)
The second tile as [x, y, zoom]
## Returns

@@ -787,2 +931,4 @@

True if both tiles have identical coordinates and zoom
### <a id="tilesFromBoundingBox"></a>tilesFromBoundingBox

@@ -798,2 +944,4 @@

Returns all Mercator tiles that intersect the given bounding box at the specified zoom level.
## Parameters

@@ -805,2 +953,4 @@

The geographic bounding box
### zoom

@@ -810,2 +960,4 @@

The zoom level
## Returns

@@ -815,2 +967,4 @@

An array of tiles covering the bounding box
### <a id="tilesHasTile"></a>tilesHasTile

@@ -826,2 +980,4 @@

Checks whether a specific tile exists in the given tile array.
## Parameters

@@ -833,2 +989,4 @@

The array of tiles to search
### tile

@@ -838,2 +996,4 @@

The tile to look for
## Returns

@@ -843,2 +1003,4 @@

True if the tile is found in the array
### type-aliases

@@ -856,2 +1018,4 @@

An ordered array of MercatorLngLat points forming a boundary.
### <a id="MercatorTile"></a>MercatorTile

@@ -867,2 +1031,4 @@

A Mercator tile represented as [x, y, zoom].
### variables

@@ -880,2 +1046,4 @@

Conversion factor from degrees to radians.
### <a id="r2d"></a>r2d

@@ -891,3 +1059,5 @@

Conversion factor from radians to degrees.
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)

@@ -894,0 +1064,0 @@