@developmentseed/morecantile 0.2.0-beta.1 → 0.3.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 +1 -1
- package/README.md +11 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/tile.d.ts +19 -0
- package/dist/tile.d.ts.map +1 -0
- package/dist/tile.js +35 -0
- package/dist/tile.js.map +1 -0
- package/dist/transform.d.ts +1 -22
- package/dist/transform.d.ts.map +1 -1
- package/dist/transform.js.map +1 -1
- package/dist/types/spec/2DBoundingBox.d.ts +0 -4
- package/dist/types/spec/2DBoundingBox.d.ts.map +1 -1
- package/dist/types/spec/2DPoint.d.ts +0 -3
- package/dist/types/spec/2DPoint.d.ts.map +1 -1
- package/dist/types/spec/tileMatrixSet.d.ts +0 -3
- package/dist/types/spec/tileMatrixSet.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -1
- package/dist/utils.js.map +1 -1
- package/package.json +22 -29
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
# morecantile-ts
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
> Image credit [@vincentsarago].
|
|
6
|
+
|
|
7
|
+
[@vincentsarago]: https://github.com/vincentsarago
|
|
8
|
+
|
|
9
|
+
Typescript port of [Morecantile] for working with OGC [TileMatrixSet] grids.
|
|
10
|
+
|
|
11
|
+
[Morecantile]: https://github.com/developmentseed/morecantile
|
|
12
|
+
[TileMatrixSet]: https://docs.ogc.org/is/17-083r4/17-083r4.html
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { matrixTransform, tileTransform } from "./transform";
|
|
3
|
-
export type { BoundingBox, CRS, TileMatrix, TileMatrixSet, } from "./types/index";
|
|
4
|
-
export { metersPerUnit } from "./utils";
|
|
1
|
+
export { xy_bounds } from "./tile.js";
|
|
2
|
+
export { matrixTransform, tileTransform } from "./transform.js";
|
|
3
|
+
export type { BoundingBox, CRS, TileMatrix, TileMatrixSet, } from "./types/index.js";
|
|
4
|
+
export { metersPerUnit } from "./utils.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAChE,YAAY,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { xy_bounds } from "./tile.js";
|
|
2
|
+
export { matrixTransform, tileTransform } from "./transform.js";
|
|
3
|
+
export { metersPerUnit } from "./utils.js";
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAOhE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/tile.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BoundingBox, TileMatrix, TileMatrixSet } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Return the bounding box of the tile in the TMS's native coordinate reference
|
|
4
|
+
* system.
|
|
5
|
+
*/
|
|
6
|
+
export declare function xy_bounds(matrix: TileMatrix, tile: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}): BoundingBox;
|
|
10
|
+
/**
|
|
11
|
+
* Return the bounding box of the tile in the TMS's native coordinate reference
|
|
12
|
+
* system.
|
|
13
|
+
*/
|
|
14
|
+
export declare function xy_bounds(matrixSet: TileMatrixSet, tile: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
z: number;
|
|
18
|
+
}): BoundingBox;
|
|
19
|
+
//# sourceMappingURL=tile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../src/tile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGtE;;;GAGG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7B,WAAW,CAAC;AACf;;;GAGG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GACxC,WAAW,CAAC"}
|
package/dist/tile.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as affine from "@developmentseed/affine";
|
|
2
|
+
import { tileTransform } from "./transform";
|
|
3
|
+
import { narrowTileMatrixSet } from "./utils";
|
|
4
|
+
export function xy_bounds(input, tile) {
|
|
5
|
+
const tileMatrix = getTileMatrix(input, tile);
|
|
6
|
+
const { tileHeight, tileWidth } = tileMatrix;
|
|
7
|
+
const { x, y } = tile;
|
|
8
|
+
const tileAffine = tileTransform(tileMatrix, { col: x, row: y });
|
|
9
|
+
// Apply affine to local tile pixel corners (0,0) is the origin corner,
|
|
10
|
+
// (tileWidth, tileHeight) is the opposite corner.
|
|
11
|
+
const [x0, y0] = affine.apply(tileAffine, 0, 0);
|
|
12
|
+
const [x1, y1] = affine.apply(tileAffine, tileWidth, tileHeight);
|
|
13
|
+
if (tileMatrix.cornerOfOrigin === "bottomLeft") {
|
|
14
|
+
// (x0, y0) is bottom-left, (x1, y1) is top-right
|
|
15
|
+
return { lowerLeft: [x0, y0], upperRight: [x1, y1] };
|
|
16
|
+
}
|
|
17
|
+
// topLeft (default): (x0, y0) is top-left, (x1, y1) is bottom-right
|
|
18
|
+
return { lowerLeft: [x0, y1], upperRight: [x1, y0] };
|
|
19
|
+
}
|
|
20
|
+
function getTileMatrix(input, tile) {
|
|
21
|
+
if (narrowTileMatrixSet(input)) {
|
|
22
|
+
if (tile.z === undefined) {
|
|
23
|
+
throw new Error("Tile z level is required when input is a TileMatrixSet");
|
|
24
|
+
}
|
|
25
|
+
const tileMatrix = input.tileMatrices[tile.z];
|
|
26
|
+
if (!tileMatrix) {
|
|
27
|
+
throw new Error(`Tile z level ${tile.z} is out of bounds for TileMatrixSet with ${input.tileMatrices.length} levels.`);
|
|
28
|
+
}
|
|
29
|
+
return tileMatrix;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return input;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=tile.js.map
|
package/dist/tile.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.js","sourceRoot":"","sources":["../src/tile.ts"],"names":[],"mappings":"AAAA,O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K,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;QACD,MAAM,UAAU,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,gBAAgB,IAAI,CAAC,CAAC,4CAA4C,KAAK,CAAC,YAAY,CAAC,MAAM,UAAU,CACtG,CAAC;QACJ,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/transform.d.ts
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
|
+
import type { Affine } from "@developmentseed/affine";
|
|
1
2
|
import type { TileMatrix } from "./types/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* A 2-D affine transform as a six-element tuple in row-major order:
|
|
4
|
-
*
|
|
5
|
-
* x_crs = a * col_px + b * row_px + c
|
|
6
|
-
* y_crs = d * col_px + e * row_px + f
|
|
7
|
-
*
|
|
8
|
-
* For the north-up, axis-aligned grids produced by OGC TileMatrices,
|
|
9
|
-
* b and d are always zero, but the type does not enforce that.
|
|
10
|
-
*
|
|
11
|
-
* Note: the meaning of the two output axes depends on the
|
|
12
|
-
* `orderedAxes` field of the parent TileMatrixSet, which these
|
|
13
|
-
* helpers do not consult. Axis 0 of pointOfOrigin is axis 0 of the
|
|
14
|
-
* transform output, whatever that axis happens to be.
|
|
15
|
-
*/
|
|
16
|
-
export type Affine = [
|
|
17
|
-
a: number,
|
|
18
|
-
b: number,
|
|
19
|
-
c: number,
|
|
20
|
-
d: number,
|
|
21
|
-
e: number,
|
|
22
|
-
f: number
|
|
23
|
-
];
|
|
24
3
|
/**
|
|
25
4
|
* Construct a single affine transform that maps pixel coordinates
|
|
26
5
|
* within *any* tile of the matrix to CRS coordinates.
|
package/dist/transform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAgBjE;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACjC,MAAM,CAiBR"}
|
package/dist/transform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,MAAkB;IAChD,IAAI,MAAM,CAAC,oBAAoB,IAAI,MAAM,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC;IAChD,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,OAAO;QACL,MAAM,CAAC,QAAQ,EAAE,qBAAqB;QACtC,CAAC,EAAE,IAAI;QACP,OAA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C;YACnD,OAAO,GAAG,CAAC,QAAQ,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2DBoundingBox.d.ts","sourceRoot":"","sources":["../../../src/types/spec/2DBoundingBox.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV
|
|
1
|
+
{"version":3,"file":"2DBoundingBox.d.ts","sourceRoot":"","sources":["../../../src/types/spec/2DBoundingBox.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2DPoint.d.ts","sourceRoot":"","sources":["../../../src/types/spec/2DPoint.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"2DPoint.d.ts","sourceRoot":"","sources":["../../../src/types/spec/2DPoint.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tileMatrixSet.d.ts","sourceRoot":"","sources":["../../../src/types/spec/tileMatrixSet.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb
|
|
1
|
+
{"version":3,"file":"tileMatrixSet.d.ts","sourceRoot":"","sources":["../../../src/types/spec/tileMatrixSet.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IACpC,GAAG,EAAE,GAAG,CAAC;IACT;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TileMatrix, TileMatrixSet } from "./types";
|
|
1
2
|
/**
|
|
2
3
|
* Coefficient to convert the coordinate reference system (CRS)
|
|
3
4
|
* units into meters (metersPerUnit).
|
|
@@ -12,7 +13,8 @@
|
|
|
12
13
|
* @param semiMajorAxis - The semi-major axis of the ellipsoid, required if unit is 'degree'.
|
|
13
14
|
* @returns The meters per unit conversion factor.
|
|
14
15
|
*/
|
|
15
|
-
export declare function metersPerUnit(unit: "m" | "metre" | "meter" | "meters" | "foot" | "us survey foot" | "degree", { semiMajorAxis }
|
|
16
|
+
export declare function metersPerUnit(unit: "m" | "metre" | "meter" | "meters" | "foot" | "us survey foot" | "degree", { semiMajorAxis }?: {
|
|
16
17
|
semiMajorAxis?: number;
|
|
17
18
|
}): number;
|
|
19
|
+
export declare function narrowTileMatrixSet(obj: TileMatrix | TileMatrixSet): obj is TileMatrixSet;
|
|
18
20
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,aAAa,CAC3B,IAAI,EACA,GAAG,GACH,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,gBAAgB,GAChB,QAAQ,EACZ,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,aAAa,CAC3B,IAAI,EACA,GAAG,GACH,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,gBAAgB,GAChB,QAAQ,EACZ,EAAE,aAAa,EAAE,GAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAO,GACjD,MAAM,CA4BR;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,UAAU,GAAG,aAAa,GAC9B,GAAG,IAAI,aAAa,CAEtB"}
|
package/dist/utils.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @returns The meters per unit conversion factor.
|
|
14
14
|
*/
|
|
15
15
|
// https://github.com/developmentseed/morecantile/blob/7c95a11c491303700d6e33e9c1607f2719584dec/morecantile/utils.py#L67-L90
|
|
16
|
-
export function metersPerUnit(unit, { semiMajorAxis }) {
|
|
16
|
+
export function metersPerUnit(unit, { semiMajorAxis } = {}) {
|
|
17
17
|
unit = unit.toLowerCase();
|
|
18
18
|
switch (unit) {
|
|
19
19
|
case "m":
|
|
@@ -35,4 +35,7 @@ export function metersPerUnit(unit, { semiMajorAxis }) {
|
|
|
35
35
|
}
|
|
36
36
|
throw new Error(`Unsupported CRS units: ${unit} when computing metersPerUnit.`);
|
|
37
37
|
}
|
|
38
|
+
export function narrowTileMatrixSet(obj) {
|
|
39
|
+
return "tileMatrices" in obj;
|
|
40
|
+
}
|
|
38
41
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,4HAA4H;AAC5H,MAAM,UAAU,aAAa,CAC3B,IAOY,EACZ,EAAE,aAAa,KAAiC,EAAE;IAElD,IAAI,GAAG,IAAI,CAAC,WAAW,EAAiB,CAAC;IACzC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,GAAG,CAAC;QACT,KAAK,OAAO,CAAC;QACb,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC;QACX,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,gBAAgB;YACnB,OAAO,IAAI,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,0CAA0C;QAC1C,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,aAAa,CAAC,GAAG,GAAG,CAAC;IAC7C,CAAC;IAED,MAAM,IAAI,KAAK,CACb,0BAA0B,IAAI,gCAAgC,CAC/D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,GAA+B;IAE/B,OAAO,cAAc,IAAI,GAAG,CAAC;AAC/B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,61 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@developmentseed/morecantile",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "TypeScript port of
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "TypeScript port of Python morecantile — TileMatrixSet utilities.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"sideEffects": false,
|
|
14
15
|
"files": [
|
|
15
16
|
"dist"
|
|
16
17
|
],
|
|
17
18
|
"keywords": [
|
|
19
|
+
"tms",
|
|
20
|
+
"tile-matrix-set",
|
|
21
|
+
"morecantile",
|
|
22
|
+
"xyz",
|
|
18
23
|
"tiles",
|
|
19
|
-
"
|
|
20
|
-
"ogc",
|
|
21
|
-
"gis",
|
|
22
|
-
"maps"
|
|
24
|
+
"geospatial"
|
|
23
25
|
],
|
|
26
|
+
"author": "Development Seed",
|
|
24
27
|
"license": "MIT",
|
|
25
28
|
"repository": {
|
|
26
29
|
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/developmentseed/
|
|
28
|
-
},
|
|
29
|
-
"engines": {
|
|
30
|
-
"node": ">=18"
|
|
30
|
+
"url": "git+https://github.com/developmentseed/deck.gl-raster.git"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
33
|
+
"@types/node": "^25.3.3",
|
|
34
|
+
"jsdom": "^28.1.0",
|
|
35
35
|
"json-schema-to-typescript": "^15.0.4",
|
|
36
|
-
"publint": "^0.3.16",
|
|
37
36
|
"tsx": "^4.21.0",
|
|
38
37
|
"typescript": "^5.9.3",
|
|
39
|
-
"vitest": "^
|
|
38
|
+
"vitest": "^4.0.18"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@developmentseed/affine": "^0.3.0"
|
|
40
42
|
},
|
|
43
|
+
"peerDependencies": {},
|
|
41
44
|
"volta": {
|
|
42
|
-
"
|
|
43
|
-
"pnpm": "10.25.0"
|
|
45
|
+
"extends": "../../package.json"
|
|
44
46
|
},
|
|
45
47
|
"scripts": {
|
|
46
|
-
"build": "tsc --build",
|
|
47
|
-
"
|
|
48
|
-
"clean": "rm -rf dist",
|
|
49
|
-
"check": "biome check .",
|
|
50
|
-
"check:fix": "biome check --write .",
|
|
51
|
-
"format": "biome format .",
|
|
52
|
-
"format:fix": "biome format --write .",
|
|
53
|
-
"generate-types": "tsx scripts/generate-types.ts && pnpm check:fix",
|
|
54
|
-
"lint": "biome lint .",
|
|
55
|
-
"lint:fix": "biome lint --write .",
|
|
56
|
-
"publint": "publint",
|
|
57
|
-
"test": "vitest run",
|
|
48
|
+
"build": "tsc --build tsconfig.build.json",
|
|
49
|
+
"generate-types": "tsx scripts/generate-types.ts",
|
|
58
50
|
"test:watch": "vitest",
|
|
51
|
+
"test": "vitest run",
|
|
59
52
|
"typecheck": "tsc --noEmit"
|
|
60
53
|
}
|
|
61
54
|
}
|