@spacexr/tiles 0.0.0-stage → 0.1.0
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/LICENSE +201 -0
- package/README.md +57 -2
- package/dist/addressing/index.d.ts +16 -0
- package/dist/addressing/index.js +4 -0
- package/dist/addressing/index.js.map +1 -0
- package/dist/bake/index.d.ts +91 -0
- package/dist/bake/index.js +3 -0
- package/dist/bake/index.js.map +1 -0
- package/dist/celestial-dataset-CUIsplKO.d.ts +99 -0
- package/dist/chunk-2HLQXRDD.js +246 -0
- package/dist/chunk-2HLQXRDD.js.map +1 -0
- package/dist/chunk-6YNCRDEE.js +170 -0
- package/dist/chunk-6YNCRDEE.js.map +1 -0
- package/dist/chunk-7AWV2IEK.js +79 -0
- package/dist/chunk-7AWV2IEK.js.map +1 -0
- package/dist/chunk-ESLGXWQR.js +219 -0
- package/dist/chunk-ESLGXWQR.js.map +1 -0
- package/dist/chunk-FB57CZDK.js +312 -0
- package/dist/chunk-FB57CZDK.js.map +1 -0
- package/dist/chunk-GRTG4WNA.js +44 -0
- package/dist/chunk-GRTG4WNA.js.map +1 -0
- package/dist/chunk-HVYN4AIT.js +45 -0
- package/dist/chunk-HVYN4AIT.js.map +1 -0
- package/dist/chunk-IGNRXAW3.js +77 -0
- package/dist/chunk-IGNRXAW3.js.map +1 -0
- package/dist/chunk-QGTREKHS.js +145 -0
- package/dist/chunk-QGTREKHS.js.map +1 -0
- package/dist/chunk-SPDRAY37.js +56 -0
- package/dist/chunk-SPDRAY37.js.map +1 -0
- package/dist/chunk-TA4BEVHL.js +81 -0
- package/dist/chunk-TA4BEVHL.js.map +1 -0
- package/dist/chunk-TGOB5HT5.js +149 -0
- package/dist/chunk-TGOB5HT5.js.map +1 -0
- package/dist/chunk-X6ZJ2PDY.js +104 -0
- package/dist/chunk-X6ZJ2PDY.js.map +1 -0
- package/dist/chunk-XTY4HCPY.js +22 -0
- package/dist/chunk-XTY4HCPY.js.map +1 -0
- package/dist/chunk-Y66PNDG2.js +107 -0
- package/dist/chunk-Y66PNDG2.js.map +1 -0
- package/dist/chunk-YEACOJOC.js +51 -0
- package/dist/chunk-YEACOJOC.js.map +1 -0
- package/dist/cube/index.d.ts +160 -0
- package/dist/cube/index.js +9 -0
- package/dist/cube/index.js.map +1 -0
- package/dist/datasets/index.d.ts +75 -0
- package/dist/datasets/index.js +11 -0
- package/dist/datasets/index.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/mercator/index.d.ts +24 -0
- package/dist/mercator/index.js +8 -0
- package/dist/mercator/index.js.map +1 -0
- package/dist/metrics-HGbzqj6L.d.ts +45 -0
- package/dist/pyramid/index.d.ts +156 -0
- package/dist/pyramid/index.js +4 -0
- package/dist/pyramid/index.js.map +1 -0
- package/dist/raster-registration-CgBxrhDB.d.ts +19 -0
- package/dist/reference-surface-CsTtrNsc.d.ts +49 -0
- package/dist/reprojection/index.d.ts +255 -0
- package/dist/reprojection/index.js +6 -0
- package/dist/reprojection/index.js.map +1 -0
- package/dist/sources/index.d.ts +55 -0
- package/dist/sources/index.js +7 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/surface/index.d.ts +15 -0
- package/dist/surface/index.js +4 -0
- package/dist/surface/index.js.map +1 -0
- package/dist/tile-D-jjIRRA.d.ts +53 -0
- package/dist/tile-address-BkfSftp6.d.ts +66 -0
- package/dist/tile-http-client-BHZOtGX7.d.ts +73 -0
- package/dist/tile-neighbors-LfvV7oiX.d.ts +48 -0
- package/dist/tile-surface-s9Zi6X9_.d.ts +40 -0
- package/dist/tile-topology-B6xHYqPb.d.ts +51 -0
- package/dist/web-mercator-dataset-Dmou8byO.d.ts +125 -0
- package/dist/web-tile-source-DrZDBIm6.d.ts +92 -0
- package/package.json +122 -5
- package/src/addressing/index.ts +8 -0
- package/src/addressing/metrics.ts +48 -0
- package/src/addressing/raster-registration.ts +22 -0
- package/src/addressing/tile-address.ts +130 -0
- package/src/addressing/tile-edge-rotation.ts +13 -0
- package/src/addressing/tile-neighbors.ts +73 -0
- package/src/addressing/tile-surface.ts +44 -0
- package/src/addressing/tile-topology.ts +86 -0
- package/src/addressing/tile.ts +73 -0
- package/src/bake/bake-pyramid.ts +106 -0
- package/src/bake/index.ts +2 -0
- package/src/bake/pyramid-levels.ts +63 -0
- package/src/cube/celestial-dataset.ts +182 -0
- package/src/cube/cube-face.ts +51 -0
- package/src/cube/cube-geometric-error.ts +30 -0
- package/src/cube/cube-mapping.ts +101 -0
- package/src/cube/cube-neighbors.ts +198 -0
- package/src/cube/cube-tile-surface.ts +30 -0
- package/src/cube/index.ts +6 -0
- package/src/datasets/index.ts +1 -0
- package/src/datasets/tile-dataset.ts +121 -0
- package/src/index.ts +9 -0
- package/src/mercator/index.ts +3 -0
- package/src/mercator/web-mercator-dataset.ts +215 -0
- package/src/mercator/web-mercator-tile-metrics.ts +119 -0
- package/src/mercator/web-mercator-tile-surface.ts +52 -0
- package/src/pyramid/index.ts +2 -0
- package/src/pyramid/resident-tiles.ts +81 -0
- package/src/pyramid/tile-pyramid.ts +285 -0
- package/src/reprojection/cube-resampling.ts +159 -0
- package/src/reprojection/index.ts +4 -0
- package/src/reprojection/source-projection.ts +196 -0
- package/src/reprojection/source-tile-matrix.ts +100 -0
- package/src/reprojection/wmts-capabilities.ts +112 -0
- package/src/sources/index.ts +4 -0
- package/src/sources/tile-http-client.ts +154 -0
- package/src/sources/tile-layer-changes.ts +88 -0
- package/src/sources/url-template.ts +96 -0
- package/src/sources/web-tile-source.ts +73 -0
- package/src/surface/directions.ts +27 -0
- package/src/surface/index.ts +2 -0
- package/src/surface/reference-surface.ts +88 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Location of the samples of a raster over the tile extent. It belongs to the data, so every source declares it where
|
|
3
|
+
* its data is imported: there is no default.
|
|
4
|
+
*
|
|
5
|
+
* - `area`: each sample covers one pixel, so sample `i` is centred at `(i + 0.5) / size`. This is how web tiles are
|
|
6
|
+
* published, elevation and imagery alike; two neighbouring tiles never share a sample.
|
|
7
|
+
* - `point`: sample `i` lies at `i / (size - 1)`, so the first and last samples lie on the tile edges, as in the tiles of
|
|
8
|
+
* a multi-root pyramid and in stitched rasters.
|
|
9
|
+
*/
|
|
10
|
+
type RasterRegistration = "area" | "point";
|
|
11
|
+
/**
|
|
12
|
+
* Checks the registration a source declares, for callers the compiler does not reach: a raster read with the wrong one
|
|
13
|
+
* moves half a pixel without any other sign.
|
|
14
|
+
*
|
|
15
|
+
* @throws TypeError When the registration is missing or unknown.
|
|
16
|
+
*/
|
|
17
|
+
declare function assertRasterRegistration(registration: unknown): asserts registration is RasterRegistration;
|
|
18
|
+
|
|
19
|
+
export { type RasterRegistration as R, assertRasterRegistration as a };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Ellipsoid, ICartesian3 } from '@spacexr/geodesy';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reference surface of a celestial body: a triaxial ellipsoid with radii `a`, `b`, `c` along the `X`, `Y` and `Z`
|
|
5
|
+
* axes of its body-fixed frame, in metres. Terrain heights are radial: the point of direction `d` and height `h` is
|
|
6
|
+
* `(radius(d) + h) * d`. No geodetic latitude is involved, so triaxial bodies need no special case.
|
|
7
|
+
*/
|
|
8
|
+
declare class ReferenceSurface {
|
|
9
|
+
readonly radii: readonly [number, number, number];
|
|
10
|
+
private readonly inverseSquares;
|
|
11
|
+
/**
|
|
12
|
+
* @param a - Radius along `X`, in metres.
|
|
13
|
+
* @param b - Radius along `Y`, in metres.
|
|
14
|
+
* @param c - Radius along `Z`, the polar radius, in metres.
|
|
15
|
+
* @throws RangeError When a radius is not a positive finite number.
|
|
16
|
+
*/
|
|
17
|
+
constructor(a: number, b: number, c: number);
|
|
18
|
+
/** A sphere of the given radius, in metres. */
|
|
19
|
+
static sphere(radius: number): ReferenceSurface;
|
|
20
|
+
/** The biaxial surface of an ellipsoid: its semi-major axis along `X` and `Y`, its semi-minor axis along `Z`. */
|
|
21
|
+
static fromEllipsoid(ellipsoid: Ellipsoid): ReferenceSurface;
|
|
22
|
+
/**
|
|
23
|
+
* Distance from the centre to the surface along a unit direction: `1 / sqrt(x^2 / a^2 + y^2 / b^2 + z^2 / c^2)`.
|
|
24
|
+
*/
|
|
25
|
+
radius(direction: Readonly<ICartesian3>): number;
|
|
26
|
+
/**
|
|
27
|
+
* Point of a unit direction at a radial height: `(radius(direction) + height) * direction`.
|
|
28
|
+
*
|
|
29
|
+
* @param height - Radial height above the surface, in metres.
|
|
30
|
+
* @param target - Receives the point.
|
|
31
|
+
*/
|
|
32
|
+
point(direction: Readonly<ICartesian3>, height?: number, target?: ICartesian3): ICartesian3;
|
|
33
|
+
/**
|
|
34
|
+
* Radial height of a point above the surface: its distance to the centre minus the radius of its direction.
|
|
35
|
+
*
|
|
36
|
+
* @throws RangeError When the point is the centre or is not finite.
|
|
37
|
+
*/
|
|
38
|
+
height(point: Readonly<ICartesian3>): number;
|
|
39
|
+
/**
|
|
40
|
+
* Unit normal of the surface at a point of it, `normalize(x / a^2, y / b^2, z / c^2)`. It differs from the radial
|
|
41
|
+
* direction on a non-spherical surface. For a point off the surface it is the normal of the scaled surface through
|
|
42
|
+
* that point.
|
|
43
|
+
*
|
|
44
|
+
* @param target - Receives the normal.
|
|
45
|
+
*/
|
|
46
|
+
normal(point: Readonly<ICartesian3>, target?: ICartesian3): ICartesian3;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { ReferenceSurface as R };
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { ICartesian3 } from '@spacexr/geodesy';
|
|
2
|
+
import { I as ITileAddress } from '../tile-address-BkfSftp6.js';
|
|
3
|
+
import { R as ReferenceSurface } from '../reference-surface-CsTtrNsc.js';
|
|
4
|
+
import { R as RasterRegistration } from '../raster-registration-CgBxrhDB.js';
|
|
5
|
+
|
|
6
|
+
/** Position in the map of a source: degrees for a geographic source, metres for a projected one. */
|
|
7
|
+
interface IMapPosition {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Projection of a raster source: from a unit direction of the body-fixed frame to the map of the source, and back. The
|
|
13
|
+
* unit directions go through it, whatever the source. Latitude conventions are explicit: each
|
|
14
|
+
* projection states which latitude its source uses.
|
|
15
|
+
*/
|
|
16
|
+
interface ISourceProjection {
|
|
17
|
+
/** Map position of a unit direction. */
|
|
18
|
+
forward(direction: Readonly<ICartesian3>, target?: IMapPosition): IMapPosition;
|
|
19
|
+
/** Unit direction of a map position. */
|
|
20
|
+
inverse(x: number, y: number, target?: ICartesian3): ICartesian3;
|
|
21
|
+
/** Metres on the ground per map unit, at the reference of the map. */
|
|
22
|
+
readonly metresPerUnit: number;
|
|
23
|
+
/** Width of the map along `x` when it wraps around the body, as a global geographic map does. */
|
|
24
|
+
readonly periodX: number | undefined;
|
|
25
|
+
}
|
|
26
|
+
interface IGeographicProjectionOptions {
|
|
27
|
+
/** Equatorial radius of the body, in metres. */
|
|
28
|
+
semiMajorAxis: number;
|
|
29
|
+
/**
|
|
30
|
+
* Polar radius of the ellipsoid of the source, for a source with geodetic latitudes such as EPSG:4326. Defaults to
|
|
31
|
+
* `semiMajorAxis`: on a sphere, latitudes are planetocentric.
|
|
32
|
+
*/
|
|
33
|
+
semiMinorAxis?: number;
|
|
34
|
+
/** Longitude of the centre of the map, in degrees. Defaults to 0: longitudes run from -180 to 180. */
|
|
35
|
+
centralMeridianDegrees?: number;
|
|
36
|
+
}
|
|
37
|
+
/** Geographic map, plate carree: `x` is the longitude and `y` the latitude, in degrees. */
|
|
38
|
+
declare class GeographicProjection implements ISourceProjection {
|
|
39
|
+
readonly metresPerUnit: number;
|
|
40
|
+
readonly periodX = 360;
|
|
41
|
+
private readonly squaredRatio;
|
|
42
|
+
private readonly centralMeridian;
|
|
43
|
+
constructor(options: IGeographicProjectionOptions);
|
|
44
|
+
forward(direction: Readonly<ICartesian3>, target?: IMapPosition): IMapPosition;
|
|
45
|
+
inverse(x: number, y: number, target?: ICartesian3): ICartesian3;
|
|
46
|
+
}
|
|
47
|
+
interface IPolarStereographicProjectionOptions {
|
|
48
|
+
pole: "north" | "south";
|
|
49
|
+
/** Radius of the sphere of the map, in metres. */
|
|
50
|
+
radius: number;
|
|
51
|
+
/** `central_meridian` of the source, in degrees. Defaults to 0. */
|
|
52
|
+
centralMeridianDegrees?: number;
|
|
53
|
+
/** Defaults to 0. */
|
|
54
|
+
falseEasting?: number;
|
|
55
|
+
/** Defaults to 0. */
|
|
56
|
+
falseNorthing?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Polar stereographic map on a sphere, true to scale at the pole, in metres. It reads the direction without any latitude
|
|
60
|
+
* or longitude, so the pole is a point like any other:
|
|
61
|
+
*
|
|
62
|
+
* ```text
|
|
63
|
+
* south: x = 2R dy / (1 - dz), y = 2R dx / (1 - dz)
|
|
64
|
+
* north: x = 2R dy / (1 + dz), y = -2R dx / (1 + dz)
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* with `dx`, `dy` turned by the central meridian. It matches `Stereographic_South_Pole` of ESRI and EPSG on a sphere.
|
|
68
|
+
*/
|
|
69
|
+
declare class PolarStereographicProjection implements ISourceProjection {
|
|
70
|
+
readonly metresPerUnit = 1;
|
|
71
|
+
readonly periodX: undefined;
|
|
72
|
+
private readonly south;
|
|
73
|
+
private readonly diameter;
|
|
74
|
+
private readonly cosine;
|
|
75
|
+
private readonly sine;
|
|
76
|
+
private readonly falseEasting;
|
|
77
|
+
private readonly falseNorthing;
|
|
78
|
+
constructor(options: IPolarStereographicProjectionOptions);
|
|
79
|
+
forward(direction: Readonly<ICartesian3>, target?: IMapPosition): IMapPosition;
|
|
80
|
+
inverse(x: number, y: number, target?: ICartesian3): ICartesian3;
|
|
81
|
+
}
|
|
82
|
+
interface IWebMercatorProjectionOptions {
|
|
83
|
+
/** Radius of the map, in metres. Supplied explicitly in metres. */
|
|
84
|
+
semiMajorAxis: number;
|
|
85
|
+
/** Polar radius of the ellipsoid of the latitudes. Supplied explicitly by the caller. */
|
|
86
|
+
semiMinorAxis?: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Web Mercator map, EPSG:3857, in metres: spherical formulas applied to geodetic latitudes. It stops at 85.05 degrees: the
|
|
90
|
+
* positions beyond it fall outside the tile matrices, so another source must cover the caps.
|
|
91
|
+
*/
|
|
92
|
+
declare class WebMercatorProjection implements ISourceProjection {
|
|
93
|
+
readonly metresPerUnit = 1;
|
|
94
|
+
readonly periodX: number;
|
|
95
|
+
private readonly radius;
|
|
96
|
+
private readonly squaredRatio;
|
|
97
|
+
constructor(options: IWebMercatorProjectionOptions);
|
|
98
|
+
forward(direction: Readonly<ICartesian3>, target?: IMapPosition): IMapPosition;
|
|
99
|
+
inverse(x: number, y: number, target?: ICartesian3): ICartesian3;
|
|
100
|
+
}
|
|
101
|
+
/** Longitude and geodetic latitude of a unit direction on a biaxial ellipsoid, in degrees, for the sources that use them. */
|
|
102
|
+
declare function geodeticOfDirection(direction: Readonly<ICartesian3>, semiMajorAxis: number, semiMinorAxis: number): {
|
|
103
|
+
latitude: number;
|
|
104
|
+
longitude: number;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* One level of the tiles of a raster source. The pixel size is explicit: it cannot always be read from a WMTS
|
|
109
|
+
* `ScaleDenominator`, and the matrix may be larger than the map: a A provider polar matrix of 2 x 1 tiles has its whole map
|
|
110
|
+
* in the first column.
|
|
111
|
+
*/
|
|
112
|
+
interface ISourceTileMatrix {
|
|
113
|
+
identifier: string;
|
|
114
|
+
/** Where the pixels lie, required: a WMTS or XYZ tile is `area`; a GeoTIFF declares it in its `GTRasterTypeGeoKey`. */
|
|
115
|
+
registration: RasterRegistration;
|
|
116
|
+
/** Map position of the outer corner of the first pixel in `area` registration, of its centre in `point` registration. */
|
|
117
|
+
originX: number;
|
|
118
|
+
originY: number;
|
|
119
|
+
/** Map units per pixel. Rows run toward decreasing `y`. */
|
|
120
|
+
pixelSize: number;
|
|
121
|
+
tileWidth: number;
|
|
122
|
+
tileHeight: number;
|
|
123
|
+
matrixWidth: number;
|
|
124
|
+
matrixHeight: number;
|
|
125
|
+
}
|
|
126
|
+
/** A pixel of a source tile. */
|
|
127
|
+
interface ISourcePixel {
|
|
128
|
+
column: number;
|
|
129
|
+
row: number;
|
|
130
|
+
/** Pixel in the tile, 0 at its west and north. */
|
|
131
|
+
x: number;
|
|
132
|
+
y: number;
|
|
133
|
+
}
|
|
134
|
+
/** Tile of a source. */
|
|
135
|
+
interface ISourceTile {
|
|
136
|
+
column: number;
|
|
137
|
+
row: number;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Fractional pixel of a map position, over the whole matrix: pixel `n` has its centre at `n`.
|
|
141
|
+
*
|
|
142
|
+
* @throws TypeError When the matrix does not declare its registration.
|
|
143
|
+
*/
|
|
144
|
+
declare function sourcePixelCoordinates(matrix: ISourceTileMatrix, position: Readonly<IMapPosition>, target?: IMapPosition): IMapPosition;
|
|
145
|
+
/**
|
|
146
|
+
* The tile and the pixel holding a pixel of the matrix.
|
|
147
|
+
*
|
|
148
|
+
* @param periodPixels - Width of the map in pixels when it wraps around the body; columns then wrap.
|
|
149
|
+
* @returns `undefined` beyond the matrix.
|
|
150
|
+
*/
|
|
151
|
+
declare function sourcePixelAt(matrix: ISourceTileMatrix, pixelX: number, pixelY: number, periodPixels?: number): ISourcePixel | undefined;
|
|
152
|
+
/** The tile matrix of a level of an XYZ Web Mercator pyramid, EPSG:3857: rows from the north, 2^level tiles per side. */
|
|
153
|
+
declare function webMercatorTileMatrix(level: number, tileSize: number | undefined, semiMajorAxis: number): ISourceTileMatrix;
|
|
154
|
+
/** The tile matrix of a level of a global geographic pyramid, such as A provider: 2 x 1 tiles at level 0, from -180 and 90. */
|
|
155
|
+
declare function geographicTileMatrix(level: number, tileSize?: number): ISourceTileMatrix;
|
|
156
|
+
|
|
157
|
+
/** A raster source seen from the cube: its projection and the level it is read at. */
|
|
158
|
+
interface ICubeSourceLevel {
|
|
159
|
+
projection: ISourceProjection;
|
|
160
|
+
matrix: ISourceTileMatrix;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Coarsest level of a source at least as fine as a level of the cube, the last one otherwise. It depends on the level of
|
|
164
|
+
* the cube alone, so both sides of a tile edge read the same level. On a global geographic source, it is `lod + 1`.
|
|
165
|
+
*
|
|
166
|
+
* @param bodyRadius - Radius of the body, in metres.
|
|
167
|
+
* @param lod - Level of the cube.
|
|
168
|
+
* @param tileSize - Cells per side of the tiles of the cube.
|
|
169
|
+
* @param matrices - Levels of the source, from the coarsest.
|
|
170
|
+
* @throws RangeError When the source has no level.
|
|
171
|
+
*/
|
|
172
|
+
declare function cubeSourceMatrix(projection: ISourceProjection, matrices: readonly ISourceTileMatrix[], bodyRadius: number, lod: number, tileSize?: number): ISourceTileMatrix;
|
|
173
|
+
/**
|
|
174
|
+
* The tiles of a source that the samples of a tile of the cube read, to load before {@link resampleCubeTile}.
|
|
175
|
+
*
|
|
176
|
+
* @param tileSize - Cells per side of the tile of the cube. Defaults to 256.
|
|
177
|
+
*/
|
|
178
|
+
declare function cubeTileSourceTiles(address: ITileAddress, source: ICubeSourceLevel, tileSize?: number): ISourceTile[];
|
|
179
|
+
/**
|
|
180
|
+
* Value of a source at a pixel of a loaded tile, `NaN` where it has none: a missing tile, or its no-data value.
|
|
181
|
+
*
|
|
182
|
+
* @param column - Column of the tile.
|
|
183
|
+
* @param row - Row of the tile.
|
|
184
|
+
* @param x - Pixel in the tile.
|
|
185
|
+
* @param y - Pixel in the tile.
|
|
186
|
+
* @param channel - Channel of the pixel.
|
|
187
|
+
*/
|
|
188
|
+
type SourcePixelReader = (column: number, row: number, x: number, y: number, channel: number) => number;
|
|
189
|
+
interface IResampleCubeTileOptions {
|
|
190
|
+
/** Cells per side of the tile of the cube. Defaults to 256: 257 samples per side. */
|
|
191
|
+
tileSize?: number;
|
|
192
|
+
/** Channels per sample. Defaults to 1. */
|
|
193
|
+
channels?: number;
|
|
194
|
+
/** Receives the samples, channels interleaved. Defaults to a new array. */
|
|
195
|
+
target?: Float32Array;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Reads a source at the samples of a tile of the cube, bilinearly in its pixels: `(tileSize + 1)^2` samples in point
|
|
199
|
+
* registration. A sample depends on its direction alone, so tiles sharing an edge hold the same samples on it, across cube
|
|
200
|
+
* faces included. Pixels without data are left out of the interpolation; a sample with none is `NaN`.
|
|
201
|
+
*
|
|
202
|
+
* @throws RangeError When a supplied target has another length.
|
|
203
|
+
*/
|
|
204
|
+
declare function resampleCubeTile(address: ITileAddress, source: ICubeSourceLevel, read: SourcePixelReader, options?: IResampleCubeTileOptions): Float32Array;
|
|
205
|
+
/**
|
|
206
|
+
* Radial height over a reference surface of a source whose heights are radial over a sphere, such as LOLA over 1737.4 km:
|
|
207
|
+
* `h + sourceRadius - radius(direction)`. It is the height itself when both surfaces are that sphere.
|
|
208
|
+
*/
|
|
209
|
+
declare function rebaseRadialHeight(height: number, sourceRadius: number, reference: ReferenceSurface, direction: Readonly<ICartesian3>): number;
|
|
210
|
+
/**
|
|
211
|
+
* Weight of a polar source against a global one, from a unit direction: 0 up to `fromDegrees` of latitude, 1 from
|
|
212
|
+
* `toDegrees`, smooth in between. It depends on the direction alone, so shared edges stay identical. Latitudes are
|
|
213
|
+
* planetocentric and absolute.
|
|
214
|
+
*
|
|
215
|
+
* @throws RangeError When `toDegrees` does not exceed `fromDegrees`.
|
|
216
|
+
*/
|
|
217
|
+
declare function capBlendWeight(direction: Readonly<ICartesian3>, fromDegrees: number, toDegrees: number): number;
|
|
218
|
+
|
|
219
|
+
/** A layer read from a WMTS capabilities document. */
|
|
220
|
+
interface IWmtsLayer {
|
|
221
|
+
identifier: string;
|
|
222
|
+
/** `SupportedCRS` as written: A provider polar layers write `EPSG::0`, so the projection must come from elsewhere. */
|
|
223
|
+
crs: string | undefined;
|
|
224
|
+
/** Media type of the tiles. An 8-bit format is for display: it holds no elevation. */
|
|
225
|
+
format: string | undefined;
|
|
226
|
+
style: string;
|
|
227
|
+
tileMatrixSet: string;
|
|
228
|
+
/** Coverage of the layer in map units, `[minX, minY, maxX, maxY]`. */
|
|
229
|
+
boundingBox: readonly [number, number, number, number] | undefined;
|
|
230
|
+
/** REST template, with `{Style}`, `{TileMatrixSet}`, `{TileMatrix}`, `{TileRow}` and `{TileCol}`. */
|
|
231
|
+
resourceUrl: string | undefined;
|
|
232
|
+
/** Levels from the coarsest. */
|
|
233
|
+
matrices: readonly ISourceTileMatrix[];
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Reads a WMTS capabilities document, whose tiles are images, so in `area` registration, without any XML library, so that it also runs in a Cloudflare Worker, which has no
|
|
237
|
+
* `DOMParser`. Comments are ignored: A provider leaves old tile matrices in them.
|
|
238
|
+
*
|
|
239
|
+
* Pixel sizes come from the geometry of the matrix: the rows of a level span the origin symmetrically, so a pixel is
|
|
240
|
+
* `2 * originY / (MatrixHeight * TileHeight)`, in degrees or in metres. `ScaleDenominator` is not reliable: it assumes
|
|
241
|
+
* source-specific unit assumptions on geographic layers. Geometry-derived pixel size is preferred; the scale is used only when the origin is 0.
|
|
242
|
+
*
|
|
243
|
+
* @param xml - The document.
|
|
244
|
+
* @param layerIdentifier - Layer to read. Defaults to the first one.
|
|
245
|
+
* @throws RangeError When the document, the layer or a value it needs is missing or invalid.
|
|
246
|
+
*/
|
|
247
|
+
declare function parseWmtsCapabilities(xml: string, layerIdentifier?: string): IWmtsLayer;
|
|
248
|
+
/**
|
|
249
|
+
* URL of a tile of a WMTS layer. Empty path segments are removed: A provider templates hold `1.0.0//{Style}`.
|
|
250
|
+
*
|
|
251
|
+
* @throws RangeError When the layer has no REST template.
|
|
252
|
+
*/
|
|
253
|
+
declare function wmtsTileUrl(layer: IWmtsLayer, matrix: ISourceTileMatrix, row: number, column: number): string;
|
|
254
|
+
|
|
255
|
+
export { GeographicProjection, type ICubeSourceLevel, type IGeographicProjectionOptions, type IMapPosition, type IPolarStereographicProjectionOptions, type IResampleCubeTileOptions, type ISourcePixel, type ISourceProjection, type ISourceTile, type ISourceTileMatrix, type IWebMercatorProjectionOptions, type IWmtsLayer, PolarStereographicProjection, type SourcePixelReader, WebMercatorProjection, capBlendWeight, cubeSourceMatrix, cubeTileSourceTiles, geodeticOfDirection, geographicTileMatrix, parseWmtsCapabilities, rebaseRadialHeight, resampleCubeTile, sourcePixelAt, sourcePixelCoordinates, webMercatorTileMatrix, wmtsTileUrl };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { GeographicProjection, PolarStereographicProjection, WebMercatorProjection, capBlendWeight, cubeSourceMatrix, cubeTileSourceTiles, geodeticOfDirection, geographicTileMatrix, parseWmtsCapabilities, rebaseRadialHeight, resampleCubeTile, sourcePixelAt, sourcePixelCoordinates, webMercatorTileMatrix, wmtsTileUrl } from '../chunk-FB57CZDK.js';
|
|
2
|
+
import '../chunk-IGNRXAW3.js';
|
|
3
|
+
import '../chunk-X6ZJ2PDY.js';
|
|
4
|
+
import '../chunk-Y66PNDG2.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export { F as FetchFunction, I as ITileHttpClientOptions, T as TileFetchResult, a as TileHttpClient, b as TileHttpError } from '../tile-http-client-BHZOtGX7.js';
|
|
2
|
+
export { B as BUILT_IN_TILE_URL_VARIABLES, I as ITileUrlTemplateOptions, a as IWebTileSourceOptions, T as TileUrlTemplateError, W as WebTileSource, e as expandTileUrlTemplate, t as tileUrlTemplateVariables, v as validateTileUrlTemplate } from '../web-tile-source-DrZDBIm6.js';
|
|
3
|
+
import { I as IGeoBounds } from '../tile-D-jjIRRA.js';
|
|
4
|
+
import '../metrics-HGbzqj6L.js';
|
|
5
|
+
import '../raster-registration-CgBxrhDB.js';
|
|
6
|
+
import '../tile-address-BkfSftp6.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A layer laid over the tiles of a source, such as a vector or a raster draped on imagery: identified by `id`, and
|
|
10
|
+
* covering `bounds`, the whole body without them. A layer whose look changes is a new object with the same `id`.
|
|
11
|
+
*/
|
|
12
|
+
interface ITileLayer {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly bounds?: IGeoBounds;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* What a new set of layers changes in the tiles: nothing, the tiles of an extent, or all of them (a layer touched
|
|
18
|
+
* without bounds covers the whole body).
|
|
19
|
+
*/
|
|
20
|
+
type TileLayerChange = {
|
|
21
|
+
kind: "none";
|
|
22
|
+
} | {
|
|
23
|
+
kind: "area";
|
|
24
|
+
bounds: IGeoBounds;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "all";
|
|
27
|
+
};
|
|
28
|
+
/** Throws away the tiles of an extent, all of them without one, so that they load again. */
|
|
29
|
+
type TileInvalidator = (bounds?: IGeoBounds) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Smallest extent holding both. An extent crossing the antimeridian (`west > east`) widens the union to every
|
|
32
|
+
* longitude, which holds it whatever the other.
|
|
33
|
+
*/
|
|
34
|
+
declare function unionGeoBounds(a: IGeoBounds, b: IGeoBounds): IGeoBounds;
|
|
35
|
+
/**
|
|
36
|
+
* The layers a new set touches, compared with the set drawn: a layer added or taken away, a layer replaced by another
|
|
37
|
+
* object of the same `id`, and, when the order of the layers kept changes, all of them, since the order is how they
|
|
38
|
+
* lay over each other. A replaced layer counts with its old and its new extent.
|
|
39
|
+
*/
|
|
40
|
+
declare function touchedTileLayers<T extends ITileLayer>(before: readonly T[], after: readonly T[]): T[];
|
|
41
|
+
/** The part of the tiles a new set of layers changes: the union of the extents of the layers it touches. */
|
|
42
|
+
declare function tileLayerChange(before: readonly ITileLayer[], after: readonly ITileLayer[]): TileLayerChange;
|
|
43
|
+
/**
|
|
44
|
+
* What to do for a change of the layers: nothing, throw away the tiles it touches, or build the source again when its
|
|
45
|
+
* tiles cannot be thrown away.
|
|
46
|
+
*/
|
|
47
|
+
declare function planTileLayerUpdate(change: TileLayerChange, canInvalidate: boolean): "none" | "invalidate" | "rebuild";
|
|
48
|
+
/**
|
|
49
|
+
* Applies a new set of layers to a running source: `replace` swaps the layers its tiles read, then the tiles they
|
|
50
|
+
* change are thrown away. False when it cannot be done in place (no `invalidate`): the source keeps its layers, and is
|
|
51
|
+
* to be built again by the caller.
|
|
52
|
+
*/
|
|
53
|
+
declare function applyTileLayers<T extends ITileLayer>(current: readonly T[], next: readonly T[], invalidate: TileInvalidator | undefined, replace: (layers: readonly T[]) => void): boolean;
|
|
54
|
+
|
|
55
|
+
export { type ITileLayer, type TileInvalidator, type TileLayerChange, applyTileLayers, planTileLayerUpdate, tileLayerChange, touchedTileLayers, unionGeoBounds };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { applyTileLayers, planTileLayerUpdate, tileLayerChange, touchedTileLayers, unionGeoBounds } from '../chunk-HVYN4AIT.js';
|
|
2
|
+
export { WebTileSource } from '../chunk-YEACOJOC.js';
|
|
3
|
+
export { BUILT_IN_TILE_URL_VARIABLES, TileHttpClient, TileHttpError, TileUrlTemplateError, expandTileUrlTemplate, tileUrlTemplateVariables, validateTileUrlTemplate } from '../chunk-6YNCRDEE.js';
|
|
4
|
+
import '../chunk-X6ZJ2PDY.js';
|
|
5
|
+
import '../chunk-Y66PNDG2.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { R as ReferenceSurface } from '../reference-surface-CsTtrNsc.js';
|
|
2
|
+
import { ICartesian3 } from '@spacexr/geodesy';
|
|
3
|
+
import { a as IGeographic2 } from '../metrics-HGbzqj6L.js';
|
|
4
|
+
|
|
5
|
+
/** Unit Cartesian direction from planetocentric angles in degrees. */
|
|
6
|
+
declare function planetocentricDirection(latitudeDegrees: number, longitudeDegrees: number, target?: ICartesian3): ICartesian3;
|
|
7
|
+
/**
|
|
8
|
+
* Planetocentric latitude and east-positive longitude of a direction, in degrees, longitudes in `(-180, 180]`. A
|
|
9
|
+
* planetocentric latitude is not a geodetic one on a non-spherical body.
|
|
10
|
+
*
|
|
11
|
+
* @throws RangeError When the direction is zero or not finite.
|
|
12
|
+
*/
|
|
13
|
+
declare function directionToPlanetocentric(direction: Readonly<ICartesian3>): IGeographic2;
|
|
14
|
+
|
|
15
|
+
export { directionToPlanetocentric, planetocentricDirection };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { b as ITileMetrics } from './metrics-HGbzqj6L.js';
|
|
2
|
+
import { I as ITileAddress } from './tile-address-BkfSftp6.js';
|
|
3
|
+
|
|
4
|
+
/** Geographic extent in degrees. `west` may be greater than `east` only for extents crossing the antimeridian. */
|
|
5
|
+
interface IGeoBounds {
|
|
6
|
+
west: number;
|
|
7
|
+
south: number;
|
|
8
|
+
east: number;
|
|
9
|
+
north: number;
|
|
10
|
+
}
|
|
11
|
+
/** Extent in map pixels at the tile level of detail, from the north-west corner of the map. */
|
|
12
|
+
interface IPixelBounds {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}
|
|
18
|
+
/** Tile of a pyramid with its location and optional content. */
|
|
19
|
+
interface ITile<T> {
|
|
20
|
+
readonly address: ITileAddress;
|
|
21
|
+
readonly quadkey: string;
|
|
22
|
+
/** Identifies the pyramid, for example a source id. Empty by default. */
|
|
23
|
+
readonly namespace: string;
|
|
24
|
+
/** Unique key across pyramids: `namespace:quadkey`. */
|
|
25
|
+
readonly key: string;
|
|
26
|
+
readonly geoBounds: IGeoBounds;
|
|
27
|
+
readonly pixelBounds: IPixelBounds;
|
|
28
|
+
content: T | undefined;
|
|
29
|
+
}
|
|
30
|
+
/** Returns the geographic extent of a tile. */
|
|
31
|
+
declare function tileGeoBounds(address: ITileAddress, metrics: ITileMetrics): IGeoBounds;
|
|
32
|
+
/** Returns the extent of a tile in map pixels. */
|
|
33
|
+
declare function tilePixelBounds(address: ITileAddress, metrics: ITileMetrics): IPixelBounds;
|
|
34
|
+
/** Immutable location of a tile with mutable content. */
|
|
35
|
+
declare class Tile<T> implements ITile<T> {
|
|
36
|
+
readonly address: ITileAddress;
|
|
37
|
+
readonly quadkey: string;
|
|
38
|
+
readonly namespace: string;
|
|
39
|
+
readonly key: string;
|
|
40
|
+
readonly geoBounds: IGeoBounds;
|
|
41
|
+
readonly pixelBounds: IPixelBounds;
|
|
42
|
+
content: T | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* @param address - XYZ address.
|
|
45
|
+
* @param metrics - Metrics of the pyramid, used to derive the bounds.
|
|
46
|
+
* @param content - Optional content.
|
|
47
|
+
* @param namespace - Pyramid identifier used in {@link key}.
|
|
48
|
+
* @throws RangeError When the address lies outside its pyramid level.
|
|
49
|
+
*/
|
|
50
|
+
constructor(address: ITileAddress, metrics: ITileMetrics, content?: T, namespace?: string);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { type IGeoBounds as I, Tile as T, type IPixelBounds as a, type ITile as b, tilePixelBounds as c, tileGeoBounds as t };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Address of a tile in a quadtree pyramid, in the XYZ convention.
|
|
3
|
+
*
|
|
4
|
+
* `x` grows eastward and `y` grows southward from the north-west corner, as in
|
|
5
|
+
* Slippy Map, Google and Bing tiles. Use {@link toTmsY} for TMS sources, whose
|
|
6
|
+
* `y` grows northward.
|
|
7
|
+
*
|
|
8
|
+
* A pyramid with several roots, such as a multi-root pyramid of a celestial body, has one quadtree per root, selected by
|
|
9
|
+
* `face`. Single-root pyramids, such as Web Mercator, omit it, which means face 0.
|
|
10
|
+
*/
|
|
11
|
+
interface ITileAddress {
|
|
12
|
+
/** Root of the address, from 0 to {@link MAX_TILE_FACE}; omitted for face 0 of single-root pyramids. */
|
|
13
|
+
face?: number;
|
|
14
|
+
/** Level of detail, also called zoom. Level 0 has a single tile. */
|
|
15
|
+
lod: number;
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}
|
|
19
|
+
/** Highest root of a tile address: the six faces of a multi-root pyramid are 0 to 5. */
|
|
20
|
+
declare const MAX_TILE_FACE = 5;
|
|
21
|
+
/** Text of an address for messages and keys: `lod/x/y`, or `face/lod/x/y` when it has a face. */
|
|
22
|
+
declare function formatTileAddress(address: ITileAddress): string;
|
|
23
|
+
/**
|
|
24
|
+
* Key of a tile within a pyramid: `lod/x/y`, prefixed by the face when it is not 0, so that an address without a face
|
|
25
|
+
* and an address on face 0 are the same tile. Keys are ephemeral: they are not stable identifiers.
|
|
26
|
+
*/
|
|
27
|
+
declare function tileAddressKey(address: ITileAddress): string;
|
|
28
|
+
/** Number of tiles along one axis at a level of detail. */
|
|
29
|
+
declare function tileCount(lod: number): number;
|
|
30
|
+
/** Returns `true` when the address lies inside its pyramid level. */
|
|
31
|
+
declare function isValidTileAddress(address: ITileAddress): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Throws when the address lies outside its pyramid level.
|
|
34
|
+
*
|
|
35
|
+
* @throws RangeError When the address is invalid.
|
|
36
|
+
*/
|
|
37
|
+
declare function assertValidTileAddress(address: ITileAddress): void;
|
|
38
|
+
/**
|
|
39
|
+
* Converts between XYZ and TMS row numbers. The conversion is its own inverse.
|
|
40
|
+
*
|
|
41
|
+
* @param y - Row number in one convention.
|
|
42
|
+
* @param lod - Level of detail.
|
|
43
|
+
* @returns Row number in the other convention.
|
|
44
|
+
*/
|
|
45
|
+
declare function toTmsY(y: number, lod: number): number;
|
|
46
|
+
/**
|
|
47
|
+
* Encodes an address as a Bing Maps quadkey.
|
|
48
|
+
*
|
|
49
|
+
* Each digit encodes one level, from the coarsest: `x` bit plus twice the `y` bit.
|
|
50
|
+
* Level 0 has the empty quadkey.
|
|
51
|
+
*/
|
|
52
|
+
declare function tileAddressToQuadkey(address: ITileAddress): string;
|
|
53
|
+
/**
|
|
54
|
+
* Decodes a Bing Maps quadkey.
|
|
55
|
+
*
|
|
56
|
+
* @throws RangeError When the quadkey contains a character other than 0 to 3.
|
|
57
|
+
*/
|
|
58
|
+
declare function quadkeyToTileAddress(quadkey: string): ITileAddress;
|
|
59
|
+
/** Returns the parent address, or `undefined` at level 0. The face is kept. */
|
|
60
|
+
declare function parentTileAddress(address: ITileAddress): ITileAddress | undefined;
|
|
61
|
+
/** Returns the ancestor `levels` levels above, clamped to level 0. The face is kept. */
|
|
62
|
+
declare function ancestorTileAddress(address: ITileAddress, levels: number): ITileAddress;
|
|
63
|
+
/** Returns the four children in north-west, north-east, south-west, south-east order. The face is kept. */
|
|
64
|
+
declare function childTileAddresses(address: ITileAddress): [ITileAddress, ITileAddress, ITileAddress, ITileAddress];
|
|
65
|
+
|
|
66
|
+
export { type ITileAddress as I, MAX_TILE_FACE as M, ancestorTileAddress as a, assertValidTileAddress as b, childTileAddresses as c, tileAddressToQuadkey as d, tileCount as e, formatTileAddress as f, toTmsY as g, isValidTileAddress as i, parentTileAddress as p, quadkeyToTileAddress as q, tileAddressKey as t };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Fetch function compatible with `globalThis.fetch`. */
|
|
2
|
+
type FetchFunction = (input: string, init?: RequestInit) => Promise<Response>;
|
|
3
|
+
/** Options of {@link TileHttpClient}. */
|
|
4
|
+
interface ITileHttpClientOptions {
|
|
5
|
+
/** Defaults to `globalThis.fetch`. */
|
|
6
|
+
fetch?: FetchFunction;
|
|
7
|
+
/** Headers sent with every request, for example an `Authorization` header. */
|
|
8
|
+
headers?: Readonly<Record<string, string>>;
|
|
9
|
+
/** Total number of attempts, including the first one. Defaults to 4. */
|
|
10
|
+
maxAttempts?: number;
|
|
11
|
+
/** Base delay of the exponential backoff in milliseconds. Defaults to 500. */
|
|
12
|
+
initialDelayMs?: number;
|
|
13
|
+
/** Upper bound of a single delay in milliseconds, including `Retry-After`. Defaults to 30,000. */
|
|
14
|
+
maxDelayMs?: number;
|
|
15
|
+
/** HTTP statuses retried with backoff. Defaults to 408, 425, 429, 500, 502, 503 and 504. */
|
|
16
|
+
retryStatuses?: readonly number[];
|
|
17
|
+
/** HTTP statuses meaning that the tile does not exist. Defaults to 204 and 404. */
|
|
18
|
+
absentStatuses?: readonly number[];
|
|
19
|
+
/** Random source in `[0, 1)` for the jitter. Defaults to `Math.random`. */
|
|
20
|
+
random?: () => number;
|
|
21
|
+
/** Waits for a delay, rejecting when the signal aborts. Replaceable for tests. */
|
|
22
|
+
sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/** Outcome of a tile request. A tile known to be missing is a result, not an error. */
|
|
25
|
+
type TileFetchResult = {
|
|
26
|
+
status: "ok";
|
|
27
|
+
url: string;
|
|
28
|
+
bytes: Uint8Array;
|
|
29
|
+
contentType: string | undefined;
|
|
30
|
+
} | {
|
|
31
|
+
status: "absent";
|
|
32
|
+
url: string;
|
|
33
|
+
httpStatus: number;
|
|
34
|
+
};
|
|
35
|
+
/** Raised when a tile request fails permanently or exhausts its attempts. */
|
|
36
|
+
declare class TileHttpError extends Error {
|
|
37
|
+
readonly url: string;
|
|
38
|
+
readonly attempts: number;
|
|
39
|
+
readonly httpStatus?: number | undefined;
|
|
40
|
+
constructor(message: string, url: string, attempts: number, httpStatus?: number | undefined, options?: ErrorOptions);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* HTTP client for tile requests.
|
|
44
|
+
*
|
|
45
|
+
* - Statuses listed in `absentStatuses` resolve to `{ status: "absent" }`, so sparse pyramids need no error handling.
|
|
46
|
+
* - Network errors and statuses listed in `retryStatuses` are retried with exponential backoff and jitter:
|
|
47
|
+
* `min(maxDelayMs, initialDelayMs * 2^(attempt - 1)) + random() * initialDelayMs`, or `Retry-After` when present.
|
|
48
|
+
* - Any other status fails immediately with a {@link TileHttpError}.
|
|
49
|
+
* - Aborting the signal rejects with the abort reason, including during a backoff delay.
|
|
50
|
+
*/
|
|
51
|
+
declare class TileHttpClient {
|
|
52
|
+
private readonly fetchFunction;
|
|
53
|
+
private readonly headers;
|
|
54
|
+
private readonly maxAttempts;
|
|
55
|
+
private readonly initialDelayMs;
|
|
56
|
+
private readonly maxDelayMs;
|
|
57
|
+
private readonly retryStatuses;
|
|
58
|
+
private readonly absentStatuses;
|
|
59
|
+
private readonly random;
|
|
60
|
+
private readonly sleep;
|
|
61
|
+
constructor(options?: ITileHttpClientOptions);
|
|
62
|
+
/**
|
|
63
|
+
* Fetches one tile.
|
|
64
|
+
*
|
|
65
|
+
* @param url - Expanded tile URL.
|
|
66
|
+
* @param signal - Optional abort signal.
|
|
67
|
+
* @returns The tile bytes, or an `absent` result.
|
|
68
|
+
* @throws TileHttpError When the request fails permanently or exhausts its attempts.
|
|
69
|
+
*/
|
|
70
|
+
fetchTile(url: string, signal?: AbortSignal): Promise<TileFetchResult>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { type FetchFunction as F, type ITileHttpClientOptions as I, type TileFetchResult as T, TileHttpClient as a, TileHttpError as b };
|