@ac-kit/math-grid 0.4.0 → 0.5.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/CHANGELOG.md +84 -0
- package/README.md +97 -3
- package/dist/_brand.d.ts +14 -0
- package/dist/_brand.d.ts.map +1 -0
- package/dist/_brand.js +2 -0
- package/dist/_brand.js.map +1 -0
- package/dist/_coverage-contour2.d.ts +8 -1
- package/dist/_coverage-contour2.d.ts.map +1 -1
- package/dist/_coverage-contour2.js +477 -79
- package/dist/_coverage-contour2.js.map +1 -1
- package/dist/_grid-offsets2.d.ts +15 -0
- package/dist/_grid-offsets2.d.ts.map +1 -0
- package/dist/_grid-offsets2.js +53 -0
- package/dist/_grid-offsets2.js.map +1 -0
- package/dist/_nearest-site-propagation2.d.ts +1 -1
- package/dist/_nearest-site-propagation2.d.ts.map +1 -1
- package/dist/_nearest-site-propagation2.js +215 -59
- package/dist/_nearest-site-propagation2.js.map +1 -1
- package/dist/breadth-first-grid2.d.ts +65 -0
- package/dist/breadth-first-grid2.d.ts.map +1 -0
- package/dist/breadth-first-grid2.js +116 -0
- package/dist/breadth-first-grid2.js.map +1 -0
- package/dist/flood-fill2.d.ts +39 -0
- package/dist/flood-fill2.d.ts.map +1 -0
- package/dist/flood-fill2.js +76 -0
- package/dist/flood-fill2.js.map +1 -0
- package/dist/grid-neighbors2.d.ts +45 -0
- package/dist/grid-neighbors2.d.ts.map +1 -0
- package/dist/grid-neighbors2.js +45 -0
- package/dist/grid-neighbors2.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/max-rects-pack.d.ts +90 -0
- package/dist/max-rects-pack.d.ts.map +1 -0
- package/dist/max-rects-pack.js +310 -0
- package/dist/max-rects-pack.js.map +1 -0
- package/dist/rasterize-line2.d.ts +33 -0
- package/dist/rasterize-line2.d.ts.map +1 -0
- package/dist/rasterize-line2.js +103 -0
- package/dist/rasterize-line2.js.map +1 -0
- package/dist/signed-distance-from-coverage2.d.ts.map +1 -1
- package/dist/signed-distance-from-coverage2.js +147 -59
- package/dist/signed-distance-from-coverage2.js.map +1 -1
- package/dist/tile/_tile-matrix.d.ts +33 -0
- package/dist/tile/_tile-matrix.d.ts.map +1 -0
- package/dist/tile/_tile-matrix.js +186 -0
- package/dist/tile/_tile-matrix.js.map +1 -0
- package/dist/tile/index.d.ts +8 -0
- package/dist/tile/index.d.ts.map +1 -0
- package/dist/tile/index.js +8 -0
- package/dist/tile/index.js.map +1 -0
- package/dist/tile/quadkey.d.ts +30 -0
- package/dist/tile/quadkey.d.ts.map +1 -0
- package/dist/tile/quadkey.js +91 -0
- package/dist/tile/quadkey.js.map +1 -0
- package/dist/tile/tile-address.d.ts +91 -0
- package/dist/tile/tile-address.d.ts.map +1 -0
- package/dist/tile/tile-address.js +228 -0
- package/dist/tile/tile-address.js.map +1 -0
- package/dist/tile/tile-index.d.ts +26 -0
- package/dist/tile/tile-index.d.ts.map +1 -0
- package/dist/tile/tile-index.js +2 -0
- package/dist/tile/tile-index.js.map +1 -0
- package/dist/tile/tile-level.d.ts +24 -0
- package/dist/tile/tile-level.d.ts.map +1 -0
- package/dist/tile/tile-level.js +53 -0
- package/dist/tile/tile-level.js.map +1 -0
- package/dist/tile/tile-matrix-set-json.d.ts +67 -0
- package/dist/tile/tile-matrix-set-json.d.ts.map +1 -0
- package/dist/tile/tile-matrix-set-json.js +247 -0
- package/dist/tile/tile-matrix-set-json.js.map +1 -0
- package/dist/tile/tile-matrix-set.d.ts +174 -0
- package/dist/tile/tile-matrix-set.d.ts.map +1 -0
- package/dist/tile/tile-matrix-set.js +244 -0
- package/dist/tile/tile-matrix-set.js.map +1 -0
- package/dist/tile/tile-range.d.ts +57 -0
- package/dist/tile/tile-range.d.ts.map +1 -0
- package/dist/tile/tile-range.js +140 -0
- package/dist/tile/tile-range.js.map +1 -0
- package/package.json +10 -9
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { box2Of } from "@ac-kit/math-geometry";
|
|
2
|
+
import { tileMatrixSetCreate, } from "./tile-matrix-set.js";
|
|
3
|
+
const NORTHING_NAMES_ = new Set([
|
|
4
|
+
"lat",
|
|
5
|
+
"latitude",
|
|
6
|
+
"geodetic latitude",
|
|
7
|
+
"n",
|
|
8
|
+
"north",
|
|
9
|
+
"northing",
|
|
10
|
+
"y",
|
|
11
|
+
]);
|
|
12
|
+
const EASTING_NAMES_ = new Set([
|
|
13
|
+
"lon",
|
|
14
|
+
"long",
|
|
15
|
+
"longitude",
|
|
16
|
+
"geodetic longitude",
|
|
17
|
+
"e",
|
|
18
|
+
"east",
|
|
19
|
+
"easting",
|
|
20
|
+
"x",
|
|
21
|
+
]);
|
|
22
|
+
function isObject_(value) {
|
|
23
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24
|
+
}
|
|
25
|
+
function crsUri_(crs) {
|
|
26
|
+
if (typeof crs === "string") {
|
|
27
|
+
return crs;
|
|
28
|
+
}
|
|
29
|
+
return "uri" in crs && typeof crs.uri === "string" ? crs.uri : undefined;
|
|
30
|
+
}
|
|
31
|
+
/** The axis order a well-known CRS URI or CURIE implies, if any. */
|
|
32
|
+
function crsAxisOrder_(crs) {
|
|
33
|
+
const uri = crsUri_(crs);
|
|
34
|
+
if (uri === undefined) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const ogc = /(?:^|[/:[])(CRS84h?)\]?$/u.exec(uri);
|
|
38
|
+
if (ogc !== null) {
|
|
39
|
+
return "xy";
|
|
40
|
+
}
|
|
41
|
+
const epsg = /EPSG(?:\/0\/|::?|\/)(\d+)\]?$/iu.exec(uri);
|
|
42
|
+
if (epsg?.[1] === "3857") {
|
|
43
|
+
return "xy";
|
|
44
|
+
}
|
|
45
|
+
if (epsg?.[1] === "4326") {
|
|
46
|
+
return "yx";
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
function axesOrder_(axes) {
|
|
51
|
+
if (axes === undefined) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const first = axes[0].trim().toLowerCase();
|
|
55
|
+
const second = axes[1].trim().toLowerCase();
|
|
56
|
+
if (NORTHING_NAMES_.has(first) || EASTING_NAMES_.has(second)) {
|
|
57
|
+
return "yx";
|
|
58
|
+
}
|
|
59
|
+
if (EASTING_NAMES_.has(first) || NORTHING_NAMES_.has(second)) {
|
|
60
|
+
return "xy";
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
function field_(object, key, check, what, where) {
|
|
65
|
+
const value = object[key];
|
|
66
|
+
if (!check(value)) {
|
|
67
|
+
throw new TypeError(`tileMatrixSetFromJson: ${where}${key} must be ${what}.`);
|
|
68
|
+
}
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
function optionalField_(object, key, check, what, where) {
|
|
72
|
+
return object[key] === undefined
|
|
73
|
+
? undefined
|
|
74
|
+
: field_(object, key, check, what, where);
|
|
75
|
+
}
|
|
76
|
+
const isString_ = (value) => typeof value === "string";
|
|
77
|
+
const isNumber_ = (value) => typeof value === "number";
|
|
78
|
+
const isStrings_ = (value) => Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
79
|
+
const isPair_ = (value) => Array.isArray(value) &&
|
|
80
|
+
value.length === 2 &&
|
|
81
|
+
typeof value[0] === "number" &&
|
|
82
|
+
typeof value[1] === "number";
|
|
83
|
+
const isNamePair_ = (value) => Array.isArray(value) &&
|
|
84
|
+
value.length === 2 &&
|
|
85
|
+
typeof value[0] === "string" &&
|
|
86
|
+
typeof value[1] === "string";
|
|
87
|
+
const isCrs_ = (value) => typeof value === "string" || isObject_(value);
|
|
88
|
+
const isCorner_ = (value) => value === "topLeft" || value === "bottomLeft";
|
|
89
|
+
function planePair_(pair, axisOrder) {
|
|
90
|
+
return axisOrder === "xy" ? [pair[0], pair[1]] : [pair[1], pair[0]];
|
|
91
|
+
}
|
|
92
|
+
function matrixFromJson_(value, index, axisOrder) {
|
|
93
|
+
const where = `tileMatrices[${index}].`;
|
|
94
|
+
if (!isObject_(value)) {
|
|
95
|
+
throw new TypeError(`tileMatrixSetFromJson: tileMatrices[${index}] must be an object.`);
|
|
96
|
+
}
|
|
97
|
+
const widths = optionalField_(value, "variableMatrixWidths", Array.isArray, "an array", where);
|
|
98
|
+
return {
|
|
99
|
+
id: field_(value, "id", isString_, "a string", where),
|
|
100
|
+
title: optionalField_(value, "title", isString_, "a string", where),
|
|
101
|
+
description: optionalField_(value, "description", isString_, "a string", where),
|
|
102
|
+
keywords: optionalField_(value, "keywords", isStrings_, "an array of strings", where),
|
|
103
|
+
scaleDenominator: field_(value, "scaleDenominator", isNumber_, "a number", where),
|
|
104
|
+
cellSize: field_(value, "cellSize", isNumber_, "a number", where),
|
|
105
|
+
cornerOfOrigin: optionalField_(value, "cornerOfOrigin", isCorner_, '"topLeft" or "bottomLeft"', where),
|
|
106
|
+
pointOfOrigin: planePair_(field_(value, "pointOfOrigin", isPair_, "two numbers", where), axisOrder),
|
|
107
|
+
tileWidth: field_(value, "tileWidth", isNumber_, "a number", where),
|
|
108
|
+
tileHeight: field_(value, "tileHeight", isNumber_, "a number", where),
|
|
109
|
+
matrixWidth: field_(value, "matrixWidth", isNumber_, "a number", where),
|
|
110
|
+
matrixHeight: field_(value, "matrixHeight", isNumber_, "a number", where),
|
|
111
|
+
variableMatrixWidths: widths?.map((entry, entryIndex) => {
|
|
112
|
+
const at = `${where}variableMatrixWidths[${entryIndex}].`;
|
|
113
|
+
if (!isObject_(entry)) {
|
|
114
|
+
throw new TypeError(`tileMatrixSetFromJson: ${at.slice(0, -1)} must be an object.`);
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
coalesce: field_(entry, "coalesce", isNumber_, "a number", at),
|
|
118
|
+
minTileRow: field_(entry, "minTileRow", isNumber_, "a number", at),
|
|
119
|
+
maxTileRow: field_(entry, "maxTileRow", isNumber_, "a number", at),
|
|
120
|
+
};
|
|
121
|
+
}),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Creates the tile matrix set a JSON TileMatrixSet document describes (OGC
|
|
126
|
+
* 17-083r4 §7.1, parsed already): its `pointOfOrigin` and `boundingBox` come in
|
|
127
|
+
* CRS axis order and are turned to plane order by the axis order of `options`,
|
|
128
|
+
* of `orderedAxes`, or of a well-known CRS, in that order. A bounding box with
|
|
129
|
+
* a CRS of its own keeps only its corners. Allocates.
|
|
130
|
+
*
|
|
131
|
+
* @throws {TypeError} When `json` or a member has the wrong JSON type.
|
|
132
|
+
* @throws {RangeError} When the axis order cannot be known, or the values do
|
|
133
|
+
* not make a set (as {@link tileMatrixSetCreate} throws).
|
|
134
|
+
*/
|
|
135
|
+
export function tileMatrixSetFromJson(json, options) {
|
|
136
|
+
if (!isObject_(json)) {
|
|
137
|
+
throw new TypeError("tileMatrixSetFromJson: a TileMatrixSet must be an object.");
|
|
138
|
+
}
|
|
139
|
+
const crs = field_(json, "crs", isCrs_, "a URI or an object", "");
|
|
140
|
+
const orderedAxes = optionalField_(json, "orderedAxes", isNamePair_, "two strings", "");
|
|
141
|
+
const axisOrder = options?.axisOrder ?? axesOrder_(orderedAxes) ?? crsAxisOrder_(crs);
|
|
142
|
+
if (axisOrder === undefined) {
|
|
143
|
+
throw new RangeError("tileMatrixSetFromJson: the axis order of the CRS is unknown; pass options.axisOrder.");
|
|
144
|
+
}
|
|
145
|
+
const matrices = field_(json, "tileMatrices", Array.isArray, "an array", "");
|
|
146
|
+
const box = json["boundingBox"];
|
|
147
|
+
let boundingBox;
|
|
148
|
+
if (box !== undefined) {
|
|
149
|
+
if (!isObject_(box)) {
|
|
150
|
+
throw new TypeError("tileMatrixSetFromJson: boundingBox must be an object.");
|
|
151
|
+
}
|
|
152
|
+
const lower = planePair_(field_(box, "lowerLeft", isPair_, "two numbers", "boundingBox."), axisOrder);
|
|
153
|
+
const upper = planePair_(field_(box, "upperRight", isPair_, "two numbers", "boundingBox."), axisOrder);
|
|
154
|
+
boundingBox = box2Of(lower[0], lower[1], upper[0], upper[1]);
|
|
155
|
+
}
|
|
156
|
+
return tileMatrixSetCreate({
|
|
157
|
+
id: optionalField_(json, "id", isString_, "a string", ""),
|
|
158
|
+
title: optionalField_(json, "title", isString_, "a string", ""),
|
|
159
|
+
description: optionalField_(json, "description", isString_, "a string", ""),
|
|
160
|
+
keywords: optionalField_(json, "keywords", isStrings_, "an array of strings", ""),
|
|
161
|
+
uri: optionalField_(json, "uri", isString_, "a string", ""),
|
|
162
|
+
crs,
|
|
163
|
+
orderedAxes,
|
|
164
|
+
axisOrder,
|
|
165
|
+
wellKnownScaleSet: optionalField_(json, "wellKnownScaleSet", isString_, "a string", ""),
|
|
166
|
+
boundingBox,
|
|
167
|
+
tileMatrices: matrices.map((matrix, index) => matrixFromJson_(matrix, index, axisOrder)),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function crsPair_(pair, axisOrder) {
|
|
171
|
+
// The swap is its own inverse.
|
|
172
|
+
return planePair_(pair, axisOrder);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The JSON TileMatrixSet document of `set` (OGC 17-083r4 §7.1), ready for
|
|
176
|
+
* `JSON.stringify`: coordinates back in CRS axis order, `cornerOfOrigin` always
|
|
177
|
+
* written, empty and absent members left out, the matrices coarsest first.
|
|
178
|
+
* {@link tileMatrixSetFromJson} reads it back to an equal set when the set's
|
|
179
|
+
* axis order is the one its `orderedAxes` or CRS implies, or is passed to it
|
|
180
|
+
* again. Allocates.
|
|
181
|
+
*/
|
|
182
|
+
export function tileMatrixSetToJson(set) {
|
|
183
|
+
const json = {
|
|
184
|
+
crs: typeof set.crs === "string" ? set.crs : structuredClone(set.crs),
|
|
185
|
+
tileMatrices: [],
|
|
186
|
+
};
|
|
187
|
+
if (set.id !== undefined) {
|
|
188
|
+
json.id = set.id;
|
|
189
|
+
}
|
|
190
|
+
if (set.title !== undefined) {
|
|
191
|
+
json.title = set.title;
|
|
192
|
+
}
|
|
193
|
+
if (set.description !== undefined) {
|
|
194
|
+
json.description = set.description;
|
|
195
|
+
}
|
|
196
|
+
if (set.keywords.length > 0) {
|
|
197
|
+
json.keywords = [...set.keywords];
|
|
198
|
+
}
|
|
199
|
+
if (set.uri !== undefined) {
|
|
200
|
+
json.uri = set.uri;
|
|
201
|
+
}
|
|
202
|
+
if (set.orderedAxes !== undefined) {
|
|
203
|
+
json.orderedAxes = [set.orderedAxes[0], set.orderedAxes[1]];
|
|
204
|
+
}
|
|
205
|
+
if (set.wellKnownScaleSet !== undefined) {
|
|
206
|
+
json.wellKnownScaleSet = set.wellKnownScaleSet;
|
|
207
|
+
}
|
|
208
|
+
const box = set.boundingBox;
|
|
209
|
+
if (box !== undefined) {
|
|
210
|
+
json.boundingBox = {
|
|
211
|
+
lowerLeft: crsPair_([box[0], box[1]], set.axisOrder),
|
|
212
|
+
upperRight: crsPair_([box[2], box[3]], set.axisOrder),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
for (const matrix of set.tileMatrices) {
|
|
216
|
+
const entry = {
|
|
217
|
+
id: matrix.id,
|
|
218
|
+
scaleDenominator: matrix.scaleDenominator,
|
|
219
|
+
cellSize: matrix.cellSize,
|
|
220
|
+
cornerOfOrigin: matrix.cornerOfOrigin,
|
|
221
|
+
pointOfOrigin: crsPair_(matrix.pointOfOrigin, set.axisOrder),
|
|
222
|
+
tileWidth: matrix.tileWidth,
|
|
223
|
+
tileHeight: matrix.tileHeight,
|
|
224
|
+
matrixWidth: matrix.matrixWidth,
|
|
225
|
+
matrixHeight: matrix.matrixHeight,
|
|
226
|
+
};
|
|
227
|
+
if (matrix.title !== undefined) {
|
|
228
|
+
entry.title = matrix.title;
|
|
229
|
+
}
|
|
230
|
+
if (matrix.description !== undefined) {
|
|
231
|
+
entry.description = matrix.description;
|
|
232
|
+
}
|
|
233
|
+
if (matrix.keywords.length > 0) {
|
|
234
|
+
entry.keywords = [...matrix.keywords];
|
|
235
|
+
}
|
|
236
|
+
if (matrix.variableMatrixWidths.length > 0) {
|
|
237
|
+
entry.variableMatrixWidths = matrix.variableMatrixWidths.map((width) => ({
|
|
238
|
+
coalesce: width.coalesce,
|
|
239
|
+
minTileRow: width.minTileRow,
|
|
240
|
+
maxTileRow: width.maxTileRow,
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
json.tileMatrices.push(entry);
|
|
244
|
+
}
|
|
245
|
+
return json;
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=tile-matrix-set-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile-matrix-set-json.js","sourceRoot":"","sources":["../../src/tile/tile-matrix-set-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAMN,mBAAmB,GAEnB,MAAM,sBAAsB,CAAC;AAiD9B,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC/B,KAAK;IACL,UAAU;IACV,mBAAmB;IACnB,GAAG;IACH,OAAO;IACP,UAAU;IACV,GAAG;CACH,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC9B,KAAK;IACL,MAAM;IACN,WAAW;IACX,oBAAoB;IACpB,GAAG;IACH,MAAM;IACN,SAAS;IACT,GAAG;CACH,CAAC,CAAC;AAEH,SAAS,SAAS,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,OAAO,CAAC,GAAqB;IACrC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,KAAK,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,GAAG,KAA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AAM,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACtC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACxC,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,KAAK,CAAC,QAAQ,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,MAAM,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5C,KAAK,CAAC,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBACxE,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,UAAU,EAAE,KAAK,CAAC,UAAU;aAC5B,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { type Box2, type ReadonlyBox2 } from "@ac-kit/math-geometry";
|
|
2
|
+
import type { Brand_ } from "../_brand.js";
|
|
3
|
+
/**
|
|
4
|
+
* The corner a tile matrix numbers its rows and columns from (Table 8):
|
|
5
|
+
* `"topLeft"` (rows grow downwards, the WMTS and "XYZ" convention) or
|
|
6
|
+
* `"bottomLeft"` (rows grow upwards, the Tile Map Service "TMS" convention).
|
|
7
|
+
*/
|
|
8
|
+
export type TileCornerOfOrigin = "topLeft" | "bottomLeft";
|
|
9
|
+
/**
|
|
10
|
+
* How the CRS of a tile matrix set orders the two plane axes: `"xy"` easting
|
|
11
|
+
* first (CRS84, EPSG:3857), `"yx"` northing first (EPSG:4326, EPSG:3035).
|
|
12
|
+
*/
|
|
13
|
+
export type TileAxisOrder = "xy" | "yx";
|
|
14
|
+
/**
|
|
15
|
+
* The coalescence of the rows `minTileRow` to `maxTileRow` of a tile matrix
|
|
16
|
+
* (Table 9): `coalesce` adjacent tiles of each row are one tile, `coalesce`
|
|
17
|
+
* times as wide in the CRS for the same `tileWidth` in cells. The tile keeps
|
|
18
|
+
* the column index of its first column (§6.1.5): with `coalesce = 4`, columns 0
|
|
19
|
+
* to 3 are tile 0, columns 4 to 7 tile 4. A last group cut by the matrix's edge
|
|
20
|
+
* is narrower.
|
|
21
|
+
*/
|
|
22
|
+
export type TileMatrixCoalescence = {
|
|
23
|
+
/** The number of tiles merged into one, an integer `≥ 1`. */
|
|
24
|
+
readonly coalesce: number;
|
|
25
|
+
/** The first row it applies to. */
|
|
26
|
+
readonly minTileRow: number;
|
|
27
|
+
/** The last row it applies to, inclusive. */
|
|
28
|
+
readonly maxTileRow: number;
|
|
29
|
+
};
|
|
30
|
+
/** The parameters of one tile matrix, in plane order. */
|
|
31
|
+
export type TileMatrixSpec = {
|
|
32
|
+
/** The identifier, unique in its set (`"0"`, `"1"`, … in most sets). */
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly title?: string | undefined;
|
|
35
|
+
readonly description?: string | undefined;
|
|
36
|
+
readonly keywords?: readonly string[] | undefined;
|
|
37
|
+
/** The scale denominator at the standard 0.28 mm rendering cell. */
|
|
38
|
+
readonly scaleDenominator: number;
|
|
39
|
+
/** The size of one cell in CRS units. */
|
|
40
|
+
readonly cellSize: number;
|
|
41
|
+
/** `"topLeft"` when omitted. */
|
|
42
|
+
readonly cornerOfOrigin?: TileCornerOfOrigin | undefined;
|
|
43
|
+
/** The corner of origin `[x, y]`, the outer corner of tile `(0, 0)`. */
|
|
44
|
+
readonly pointOfOrigin: readonly [x: number, y: number];
|
|
45
|
+
/** The width of a tile in cells. */
|
|
46
|
+
readonly tileWidth: number;
|
|
47
|
+
/** The height of a tile in cells. */
|
|
48
|
+
readonly tileHeight: number;
|
|
49
|
+
/** The number of tile columns. */
|
|
50
|
+
readonly matrixWidth: number;
|
|
51
|
+
/** The number of tile rows. */
|
|
52
|
+
readonly matrixHeight: number;
|
|
53
|
+
/** The coalesced rows; none when omitted. */
|
|
54
|
+
readonly variableMatrixWidths?: readonly TileMatrixCoalescence[] | undefined;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* One tile matrix of a {@link TileMatrixSet}: a parameter record made only by
|
|
58
|
+
* {@link tileMatrixSetCreate} and frozen. Its `variableMatrixWidths` are sorted
|
|
59
|
+
* by row and hold only factors above 1.
|
|
60
|
+
*/
|
|
61
|
+
export type TileMatrix = {
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly title: string | undefined;
|
|
64
|
+
readonly description: string | undefined;
|
|
65
|
+
readonly keywords: readonly string[];
|
|
66
|
+
readonly scaleDenominator: number;
|
|
67
|
+
readonly cellSize: number;
|
|
68
|
+
readonly cornerOfOrigin: TileCornerOfOrigin;
|
|
69
|
+
readonly pointOfOrigin: readonly [x: number, y: number];
|
|
70
|
+
readonly tileWidth: number;
|
|
71
|
+
readonly tileHeight: number;
|
|
72
|
+
readonly matrixWidth: number;
|
|
73
|
+
readonly matrixHeight: number;
|
|
74
|
+
readonly variableMatrixWidths: readonly TileMatrixCoalescence[];
|
|
75
|
+
} & Brand_<"TileMatrix">;
|
|
76
|
+
/**
|
|
77
|
+
* The CRS of a tile matrix set (Table 4): a URI, or an object carrying a `uri`,
|
|
78
|
+
* a `wkt` definition or an ISO 19111 `referenceSystem`, kept as given.
|
|
79
|
+
*/
|
|
80
|
+
export type TileMatrixSetCrs = string | {
|
|
81
|
+
readonly uri: string;
|
|
82
|
+
} | {
|
|
83
|
+
readonly wkt: unknown;
|
|
84
|
+
} | {
|
|
85
|
+
readonly referenceSystem: unknown;
|
|
86
|
+
};
|
|
87
|
+
/** The parameters of a tile matrix set, in plane order. */
|
|
88
|
+
export type TileMatrixSetSpec = {
|
|
89
|
+
readonly id?: string | undefined;
|
|
90
|
+
readonly title?: string | undefined;
|
|
91
|
+
readonly description?: string | undefined;
|
|
92
|
+
readonly keywords?: readonly string[] | undefined;
|
|
93
|
+
readonly uri?: string | undefined;
|
|
94
|
+
/** The CRS every coordinate of the set is in. */
|
|
95
|
+
readonly crs: TileMatrixSetCrs;
|
|
96
|
+
/** The CRS axis names, in CRS order (informative). */
|
|
97
|
+
readonly orderedAxes?: readonly [string, string] | undefined;
|
|
98
|
+
/** `"xy"` when omitted. */
|
|
99
|
+
readonly axisOrder?: TileAxisOrder | undefined;
|
|
100
|
+
readonly wellKnownScaleSet?: string | undefined;
|
|
101
|
+
/** The informative extent `[minX, minY, maxX, maxY]`. */
|
|
102
|
+
readonly boundingBox?: ReadonlyBox2 | undefined;
|
|
103
|
+
/** At least one tile matrix, in any order. */
|
|
104
|
+
readonly tileMatrices: readonly TileMatrixSpec[];
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* An OGC tile matrix set in any CRS: a parameter record made only by
|
|
108
|
+
* {@link tileMatrixSetCreate} (or `tileMatrixSetFromJson`) and frozen. Its
|
|
109
|
+
* `tileMatrices` are sorted from the coarsest to the finest (decreasing
|
|
110
|
+
* `cellSize`), and a tile's `level` is an index into them; find a matrix by its
|
|
111
|
+
* identifier with {@link tileMatrixSetLevelOf}.
|
|
112
|
+
*/
|
|
113
|
+
export type TileMatrixSet = {
|
|
114
|
+
readonly id: string | undefined;
|
|
115
|
+
readonly title: string | undefined;
|
|
116
|
+
readonly description: string | undefined;
|
|
117
|
+
readonly keywords: readonly string[];
|
|
118
|
+
readonly uri: string | undefined;
|
|
119
|
+
readonly crs: TileMatrixSetCrs;
|
|
120
|
+
readonly orderedAxes: readonly [string, string] | undefined;
|
|
121
|
+
readonly axisOrder: TileAxisOrder;
|
|
122
|
+
readonly wellKnownScaleSet: string | undefined;
|
|
123
|
+
readonly boundingBox: ReadonlyBox2 | undefined;
|
|
124
|
+
readonly tileMatrices: readonly TileMatrix[];
|
|
125
|
+
} & Brand_<"TileMatrixSet">;
|
|
126
|
+
/**
|
|
127
|
+
* Creates the tile matrix set of `spec`: validates every tile matrix, sorts
|
|
128
|
+
* them from the coarsest to the finest (decreasing `cellSize`), keeps only the
|
|
129
|
+
* coalescence factors above 1, sorted by row, and freezes the result (a CRS
|
|
130
|
+
* object is cloned and frozen one level deep). Allocates; make a set once.
|
|
131
|
+
*
|
|
132
|
+
* @throws {RangeError} When there is no tile matrix; a matrix has a
|
|
133
|
+
* non-positive or non-finite scale denominator or cell size, a non-finite
|
|
134
|
+
* point of origin, a tile or matrix size that is not a positive safe integer,
|
|
135
|
+
* an unknown corner of origin, or a coalescence outside its rows, below 1 or
|
|
136
|
+
* overlapping another; two matrices share an identifier, a cell size or a
|
|
137
|
+
* scale denominator; or `axisOrder` is not `"xy"` or `"yx"`.
|
|
138
|
+
* @throws {TypeError} When an identifier, title, description or keyword is not
|
|
139
|
+
* a string, or the CRS is neither a string nor an object.
|
|
140
|
+
*/
|
|
141
|
+
export declare function tileMatrixSetCreate(spec: TileMatrixSetSpec): TileMatrixSet;
|
|
142
|
+
/**
|
|
143
|
+
* The level of the tile matrix of identifier `id` in `set`, or `-1` when there
|
|
144
|
+
* is none. O(levels).
|
|
145
|
+
*/
|
|
146
|
+
export declare function tileMatrixSetLevelOf(set: TileMatrixSet, id: string): number;
|
|
147
|
+
/**
|
|
148
|
+
* The number of tiles merged into one in row `row` of `matrix` (§6.1.5): 1
|
|
149
|
+
* outside its coalesced rows. `NaN` for a `NaN` row. O(coalesced row ranges).
|
|
150
|
+
*
|
|
151
|
+
* @throws {RangeError} When `row` is not an integer row of `matrix`.
|
|
152
|
+
*/
|
|
153
|
+
export declare function tileMatrixCoalescence(matrix: TileMatrix, row: number): number;
|
|
154
|
+
/**
|
|
155
|
+
* Writes the extent of `matrix`, `[minX, minY, maxX, maxY]` in plane order,
|
|
156
|
+
* into `out`: from its point of origin over `matrixWidth · tileWidth ·
|
|
157
|
+
* cellSize` by `matrixHeight · tileHeight · cellSize`.
|
|
158
|
+
*
|
|
159
|
+
* @returns `out`.
|
|
160
|
+
*/
|
|
161
|
+
export declare function tileMatrixBounds(out: Box2, matrix: TileMatrix): Box2;
|
|
162
|
+
/**
|
|
163
|
+
* The set of the same tiles numbered from another corner: each matrix moves its
|
|
164
|
+
* point of origin to `cornerOfOrigin` and renumbers its coalesced rows, so row
|
|
165
|
+
* `r` becomes `matrixHeight − 1 − r` (the "XYZ" ↔ "TMS" flip). The tiles keep
|
|
166
|
+
* their extents up to rounding; the set loses its `uri`, which names the
|
|
167
|
+
* registered numbering. `set` itself when every matrix already counts from that
|
|
168
|
+
* corner. Allocates.
|
|
169
|
+
*
|
|
170
|
+
* @throws {RangeError} When `cornerOfOrigin` is not `"topLeft"` or
|
|
171
|
+
* `"bottomLeft"`.
|
|
172
|
+
*/
|
|
173
|
+
export declare function tileMatrixSetWithCornerOfOrigin(set: TileMatrixSet, cornerOfOrigin: TileCornerOfOrigin): TileMatrixSet;
|
|
174
|
+
//# sourceMappingURL=tile-matrix-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile-matrix-set.d.ts","sourceRoot":"","sources":["../../src/tile/tile-matrix-set.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAU,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE7E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAU3C;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,YAAY,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG;IACnC,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mCAAmC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,6CAA6C;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC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