@basemaps/shared 6.40.0 → 6.41.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 +11 -0
- package/build/__tests__/api.test.js +17 -2
- package/build/__tests__/api.test.js.map +1 -1
- package/build/api.d.ts +2 -0
- package/build/api.d.ts.map +1 -1
- package/build/api.js +10 -0
- package/build/api.js.map +1 -1
- package/build/index.d.ts +1 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -3
- package/build/index.js.map +1 -1
- package/package.json +8 -10
- package/build/proj/__tests__/projection.test.d.ts +0 -2
- package/build/proj/__tests__/projection.test.d.ts.map +0 -1
- package/build/proj/__tests__/projection.test.js +0 -113
- package/build/proj/__tests__/projection.test.js.map +0 -1
- package/build/proj/__tests__/projection.tile.matrix.set.test.d.ts +0 -2
- package/build/proj/__tests__/projection.tile.matrix.set.test.d.ts.map +0 -1
- package/build/proj/__tests__/projection.tile.matrix.set.test.js +0 -234
- package/build/proj/__tests__/projection.tile.matrix.set.test.js.map +0 -1
- package/build/proj/__tests__/test.util.d.ts +0 -6
- package/build/proj/__tests__/test.util.d.ts.map +0 -1
- package/build/proj/__tests__/test.util.js +0 -26
- package/build/proj/__tests__/test.util.js.map +0 -1
- package/build/proj/citm2000.d.ts +0 -7
- package/build/proj/citm2000.d.ts.map +0 -1
- package/build/proj/citm2000.js +0 -29
- package/build/proj/citm2000.js.map +0 -1
- package/build/proj/nztm2000.d.ts +0 -7
- package/build/proj/nztm2000.d.ts.map +0 -1
- package/build/proj/nztm2000.js +0 -27
- package/build/proj/nztm2000.js.map +0 -1
- package/build/proj/projection.d.ts +0 -110
- package/build/proj/projection.d.ts.map +0 -1
- package/build/proj/projection.js +0 -233
- package/build/proj/projection.js.map +0 -1
- package/build/proj/tile.set.name.d.ts +0 -5
- package/build/proj/tile.set.name.d.ts.map +0 -1
- package/build/proj/tile.set.name.js +0 -8
- package/build/proj/tile.set.name.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [6.41.0](https://github.com/linz/basemaps/compare/v6.40.0...v6.41.0) (2023-07-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* truncate the api key when logging ([#2828](https://github.com/linz/basemaps/issues/2828)) ([3396593](https://github.com/linz/basemaps/commit/33965937fdc6cce4bc50b5ed41616a65c830ec6f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [6.40.0](https://github.com/linz/basemaps/compare/v6.39.0...v6.40.0) (2023-03-16)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import o from 'ospec';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { decodeTime, encodeTime, ulid } from 'ulid';
|
|
3
|
+
import { getApiKey, OneDayMs, truncateApiKey } from '../api.js';
|
|
4
4
|
o.spec('ApiKey', () => {
|
|
5
5
|
const localStorage = { getItem: () => null, setItem: () => undefined };
|
|
6
6
|
o.beforeEach(() => {
|
|
@@ -43,4 +43,19 @@ o.spec('ApiKey', () => {
|
|
|
43
43
|
o(Date.now() - decodeTime(newApiKey.slice(1).toUpperCase()) < 1000).equals(true);
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
+
o.spec('ApiKeyTruncate', () => {
|
|
47
|
+
o('should truncate apikeys', () => {
|
|
48
|
+
o(truncateApiKey('c01h3e17kjsw5evq8ndjxbda80e')).equals('cbda80e');
|
|
49
|
+
o(truncateApiKey('d01h3e17kjsw5evq8ndjxbda80e')).equals('dbda80e');
|
|
50
|
+
});
|
|
51
|
+
o('should not truncate invalid api keys', () => {
|
|
52
|
+
o(truncateApiKey([{ hello: 'world' }])).deepEquals('invalid');
|
|
53
|
+
o(truncateApiKey(null)).equals('invalid');
|
|
54
|
+
o(truncateApiKey(1)).equals('invalid');
|
|
55
|
+
});
|
|
56
|
+
o('should not truncate truncated', () => {
|
|
57
|
+
o(truncateApiKey('cbda80e')).equals('cbda80e');
|
|
58
|
+
o(truncateApiKey('dbda80e')).equals('dbda80e');
|
|
59
|
+
});
|
|
60
|
+
});
|
|
46
61
|
//# sourceMappingURL=api.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.test.js","sourceRoot":"","sources":["../../src/__tests__/api.test.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"api.test.js","sourceRoot":"","sources":["../../src/__tests__/api.test.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAMhE,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,MAAM,YAAY,GAAG,EAAE,OAAO,EAAE,GAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,GAAS,EAAE,CAAC,SAAS,EAAE,CAAC;IAC5F,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE;QAChB,YAAY,CAAC,OAAO,GAAG,GAAkB,EAAE,CAAC,IAAI,CAAC;QACjD,YAAY,CAAC,OAAO,GAAG,GAAS,EAAE,CAAC,SAAS,CAAC;QAC7C,MAAM,CAAC,YAAY,GAAG,YAAmB,CAAC;IAC5C,CAAC,CAAC,CAAC;IACH,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;QACf,OAAO,MAAM,CAAC,YAAY,CAAC;IAC7B,CAAC,CAAC,CAAC;IACH,CAA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AC,CAAC;IAEH,CAAC,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC7C,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC9D,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC1C,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,CAAC,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACtC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC/C,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/build/api.d.ts
CHANGED
|
@@ -10,4 +10,6 @@ export interface ApiKeyStatusInvalid {
|
|
|
10
10
|
message: 'malformed' | 'missing' | 'expired';
|
|
11
11
|
}
|
|
12
12
|
export declare function isValidApiKey(apiKey?: string | null): ApiKeyStatus;
|
|
13
|
+
/** Truncate a API key to the last 6 digits */
|
|
14
|
+
export declare function truncateApiKey(x: unknown): string | undefined;
|
|
13
15
|
//# sourceMappingURL=api.d.ts.map
|
package/build/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,QAAsB,CAAC;AAW5C,wBAAgB,SAAS,IAAI,MAAM,CAelC;AAED,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEnE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;CAC9C;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,CAclE"}
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,QAAsB,CAAC;AAW5C,wBAAgB,SAAS,IAAI,MAAM,CAelC;AAED,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEnE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;CAC9C;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,CAclE;AAED,8CAA8C;AAC9C,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK7D"}
|
package/build/api.js
CHANGED
|
@@ -47,4 +47,14 @@ export function isValidApiKey(apiKey) {
|
|
|
47
47
|
}
|
|
48
48
|
return { valid: true, key: apiKey };
|
|
49
49
|
}
|
|
50
|
+
/** Truncate a API key to the last 6 digits */
|
|
51
|
+
export function truncateApiKey(x) {
|
|
52
|
+
if (typeof x !== 'string')
|
|
53
|
+
return 'invalid';
|
|
54
|
+
if (x.startsWith('c'))
|
|
55
|
+
return 'c' + x.slice(x.length - 6);
|
|
56
|
+
if (x.startsWith('d'))
|
|
57
|
+
return 'd' + x.slice(x.length - 6);
|
|
58
|
+
return 'invalid';
|
|
59
|
+
}
|
|
50
60
|
//# sour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AAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IACtG,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC7C,IAAI;QACF,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;QAEhE,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,GAAG,cAAc;YAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;KACzF;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;KAC/C;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,cAAc,CAAC,CAAU;IACvC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC5C,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1D,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/build/index.d.ts
CHANGED
|
@@ -2,12 +2,10 @@ export { Const, Env } from './const.js';
|
|
|
2
2
|
export { LogConfig, LogType } from './log.js';
|
|
3
3
|
export * from './api.js';
|
|
4
4
|
export { V, VNode, VNodeElement, VNodeText } from './vdom.js';
|
|
5
|
-
export { CompositeError } from './composite.error.js';
|
|
6
5
|
export { LoggerFatalError } from './logger.fatal.error.js';
|
|
7
|
-
export { TileSetName, TileSetNameValues } from './proj/tile.set.name.js';
|
|
8
6
|
export { setDefaultConfig, getDefaultConfig } from './config.js';
|
|
9
7
|
export { toQueryString } from './url.js';
|
|
10
|
-
export
|
|
8
|
+
export { CompositeError } from './composite.error.js';
|
|
11
9
|
export * from './file/index.js';
|
|
12
10
|
export * from './util.js';
|
|
13
11
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC9C,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC9C,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -4,12 +4,10 @@ export { Const, Env } from './const.js';
|
|
|
4
4
|
export { LogConfig } from './log.js';
|
|
5
5
|
export * from './api.js';
|
|
6
6
|
export { V, VNode, VNodeElement, VNodeText } from './vdom.js';
|
|
7
|
-
export { CompositeError } from './composite.error.js';
|
|
8
7
|
export { LoggerFatalError } from './logger.fatal.error.js';
|
|
9
|
-
export { TileSetName, TileSetNameValues } from './proj/tile.set.name.js';
|
|
10
8
|
export { setDefaultConfig, getDefaultConfig } from './config.js';
|
|
11
9
|
export { toQueryString } from './url.js';
|
|
12
|
-
export
|
|
10
|
+
export { CompositeError } from './composite.error.js';
|
|
13
11
|
export * from './file/index.js';
|
|
14
12
|
export * from './util.js';
|
|
15
13
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,GAAG,GAAG,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAW,MAAM,UAAU,CAAC;AAC9C,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,GAAG,GAAG,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAW,MAAM,UAAU,CAAC;AAC9C,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basemaps/shared",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.41.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,23 +23,21 @@
|
|
|
23
23
|
"test": "ospec --globs 'build/**/*.test.js'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@basemaps/config": "^6.
|
|
27
|
-
"@basemaps/geo": "^6.
|
|
28
|
-
"@basemaps/tiler": "^6.
|
|
26
|
+
"@basemaps/config": "^6.41.0",
|
|
27
|
+
"@basemaps/geo": "^6.41.0",
|
|
28
|
+
"@basemaps/tiler": "^6.41.0",
|
|
29
29
|
"@chunkd/fs": "^10.0.2",
|
|
30
30
|
"@chunkd/source-aws-v2": "^9.3.1",
|
|
31
|
-
"@linzjs/geojson": "^6.
|
|
32
|
-
"@linzjs/metrics": "^6.
|
|
31
|
+
"@linzjs/geojson": "^6.41.0",
|
|
32
|
+
"@linzjs/metrics": "^6.41.0",
|
|
33
33
|
"aws-sdk": "^2.890.0",
|
|
34
34
|
"entities": "^4.3.0",
|
|
35
35
|
"pino": "^8.6.1",
|
|
36
|
-
"proj4": "^2.8.0",
|
|
37
36
|
"source-map-support": "^0.5.19",
|
|
38
37
|
"ulid": "^2.3.0"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"@types/aws-lambda": "^8.10.75"
|
|
42
|
-
"@types/proj4": "^2.5.2"
|
|
40
|
+
"@types/aws-lambda": "^8.10.75"
|
|
43
41
|
},
|
|
44
42
|
"publishConfig": {
|
|
45
43
|
"access": "public"
|
|
@@ -47,5 +45,5 @@
|
|
|
47
45
|
"files": [
|
|
48
46
|
"build/"
|
|
49
47
|
],
|
|
50
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "a466cbcc9859b1585e6ca32894615b3eb6ad04b0"
|
|
51
49
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projection.test.d.ts","sourceRoot":"","sources":["../../../src/proj/__tests__/projection.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Epsg, EpsgCode } from '@basemaps/geo';
|
|
2
|
-
import { round } from '@basemaps/test/build/rounding.js';
|
|
3
|
-
import { bboxToPolygon } from '@linzjs/geojson';
|
|
4
|
-
import o from 'ospec';
|
|
5
|
-
import { Projection } from '../projection.js';
|
|
6
|
-
import { qkToNamedBounds } from './test.util.js';
|
|
7
|
-
o.spec('Projection', () => {
|
|
8
|
-
const googleProj = Projection.get(EpsgCode.Google);
|
|
9
|
-
const nztmProj = Projection.get(EpsgCode.Nztm2000);
|
|
10
|
-
o('should convert to 2193', () => {
|
|
11
|
-
if (nztmProj == null) {
|
|
12
|
-
throw new Error('Failed to init proj:2193');
|
|
13
|
-
}
|
|
14
|
-
const output = nztmProj.toWgs84([1180000, 4758000]);
|
|
15
|
-
o(round(output, 6)).deepEquals([167.454458, -47.197075]);
|
|
16
|
-
const reverse = nztmProj.fromWgs84(output);
|
|
17
|
-
o(round(reverse, 2)).deepEquals([1180000, 4758000]);
|
|
18
|
-
});
|
|
19
|
-
o('tryGet should not throw if epsg is defined but projection is not', () => {
|
|
20
|
-
const count = Epsg.Codes.size;
|
|
21
|
-
const epsg = new Epsg(Math.random());
|
|
22
|
-
o(Projection.tryGet(epsg)).equals(null);
|
|
23
|
-
Epsg.Codes.delete(epsg.code);
|
|
24
|
-
o(Epsg.Codes.size).equals(count);
|
|
25
|
-
});
|
|
26
|
-
o('toGeoJson', () => {
|
|
27
|
-
const geojson = googleProj.toGeoJson(qkToNamedBounds(['31', '33']));
|
|
28
|
-
const { features } = geojson;
|
|
29
|
-
o(features.length).equals(2);
|
|
30
|
-
o(features[0].properties).deepEquals({ name: '2-3-2' });
|
|
31
|
-
o(features[1].properties).deepEquals({ name: '2-3-3' });
|
|
32
|
-
const { geometry } = features[0];
|
|
33
|
-
const coords = geometry.type === 'Polygon' ? geometry.coordinates : null;
|
|
34
|
-
o(round(coords[0], 8)).deepEquals([
|
|
35
|
-
[90, -66.51326044],
|
|
36
|
-
[90, 0],
|
|
37
|
-
[180, 0],
|
|
38
|
-
[180, -66.51326044],
|
|
39
|
-
[90, -66.51326044],
|
|
40
|
-
]);
|
|
41
|
-
});
|
|
42
|
-
o.spec('boundsToGeoJsonFeature', () => {
|
|
43
|
-
o('simple', () => {
|
|
44
|
-
const ans = round(googleProj.boundsToGeoJsonFeature({
|
|
45
|
-
x: -19929885.00696367,
|
|
46
|
-
y: 19871181.369240656,
|
|
47
|
-
width: 48921.969810251147,
|
|
48
|
-
height: 4891.969810251147,
|
|
49
|
-
}, { name: '13-22-33' }));
|
|
50
|
-
o(ans).deepEquals({
|
|
51
|
-
type: 'Feature',
|
|
52
|
-
geometry: {
|
|
53
|
-
type: 'Polygon',
|
|
54
|
-
coordinates: [
|
|
55
|
-
[
|
|
56
|
-
[-179.03320312, 84.92054529],
|
|
57
|
-
[-179.03320312, 84.92443459],
|
|
58
|
-
[-178.59372959, 84.92443459],
|
|
59
|
-
[-178.59372959, 84.92054529],
|
|
60
|
-
[-179.03320312, 84.92054529],
|
|
61
|
-
],
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
properties: { name: '13-22-33' },
|
|
65
|
-
bbox: [-179.03320312, 84.92054529, -178.59372959, 84.92443459],
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
o('crosses antimeridian', () => {
|
|
69
|
-
const ans = round(nztmProj.boundsToGeoJsonFeature({ x: 1293760, y: 5412480, width: 1246880, height: 1146880 }, { name: '1-2-1' }), 4);
|
|
70
|
-
o(ans).deepEquals({
|
|
71
|
-
type: 'Feature',
|
|
72
|
-
geometry: {
|
|
73
|
-
type: 'MultiPolygon',
|
|
74
|
-
coordinates: [
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[169.3378, -41.3809],
|
|
78
|
-
[180, -41.223],
|
|
79
|
-
[180, -30.908],
|
|
80
|
-
[169.7909, -31.0596],
|
|
81
|
-
[169.3378, -41.3809],
|
|
82
|
-
],
|
|
83
|
-
],
|
|
84
|
-
[
|
|
85
|
-
[
|
|
86
|
-
[-180, -41.223],
|
|
87
|
-
[-175.8429, -40.8954],
|
|
88
|
-
[-177.1978, -30.7264],
|
|
89
|
-
[-180, -30.908],
|
|
90
|
-
[-180, -41.223],
|
|
91
|
-
],
|
|
92
|
-
],
|
|
93
|
-
],
|
|
94
|
-
},
|
|
95
|
-
properties: { name: '1-2-1' },
|
|
96
|
-
bbox: [169.3378, -41.3809, -177.1978, -30.7264],
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
o('projectMultipolygon', () => {
|
|
101
|
-
const poly = [bboxToPolygon([18494091.86765497, -6051366.655280836, 19986142.659781612, -4016307.214216303])];
|
|
102
|
-
o(googleProj.projectMultipolygon(poly, googleProj)).equals(poly);
|
|
103
|
-
const projected = round(googleProj.projectMultipolygon(poly, nztmProj), 4);
|
|
104
|
-
o(projected.length).equals(1);
|
|
105
|
-
o(projected[0].length).equals(1);
|
|
106
|
-
o(projected[0][0][0]).deepEquals([1084733.8969, 4698018.9435]);
|
|
107
|
-
o(projected[0][0][1]).deepEquals([2090794.1708, 4700144.6365]);
|
|
108
|
-
o(projected[0][0][2]).deepEquals([2204979.5628, 6228860.047]);
|
|
109
|
-
o(projected[0][0][3]).deepEquals([964788.1204, 6226878.2808]);
|
|
110
|
-
o(projected[0][0][4]).deepEquals([1084733.8969, 4698018.9435]);
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
//# sourceMappingURL=projection.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projection.test.js","sourceRoot":"","sources":["../../../src/proj/__tests__/projection.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE;IACxB,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEnD,CAAC,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAC/B,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;SAC7C;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;QAEzD,MAAM,OAAO,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CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projection.tile.matrix.set.test.d.ts","sourceRoot":"","sources":["../../../src/proj/__tests__/projection.tile.matrix.set.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { Bounds, GoogleTms, Nztm2000QuadTms, Nztm2000Tms, QuadKey } from '@basemaps/geo';
|
|
2
|
-
import { Approx } from '@basemaps/test';
|
|
3
|
-
import { round } from '@basemaps/test/build/rounding.js';
|
|
4
|
-
import o from 'ospec';
|
|
5
|
-
import { Projection } from '../projection.js';
|
|
6
|
-
const TileSize = 256;
|
|
7
|
-
/**
|
|
8
|
-
* Get the raster bounds for a WebMercator zoom level
|
|
9
|
-
*
|
|
10
|
-
* @param extent Extent in meters in the format of [minX,minY,maxX,maxY]
|
|
11
|
-
* @param zoom Web mercator zoom level
|
|
12
|
-
*/
|
|
13
|
-
function getPixelsBoundsFromMeters(extent, zoom) {
|
|
14
|
-
const upperLeftMeters = GoogleTms.sourceToPixels(extent[0], extent[3], zoom);
|
|
15
|
-
const lowerRightMeters = GoogleTms.sourceToPixels(extent[2], extent[1], zoom);
|
|
16
|
-
return Bounds.fromUpperLeftLowerRight(upperLeftMeters, lowerRightMeters);
|
|
17
|
-
}
|
|
18
|
-
/** Convert a XYZ tile into a screen bounding box */
|
|
19
|
-
function getPixelsFromTile(x, y) {
|
|
20
|
-
return new Bounds(x * TileSize, y * TileSize, TileSize, TileSize);
|
|
21
|
-
}
|
|
22
|
-
function isValidLatLong(x) {
|
|
23
|
-
o(x.lat <= 90).equals(true)(`lat: ${x.lat} <= 90`);
|
|
24
|
-
o(x.lat >= -90).equals(true)(`lat: ${x.lat} >= -90`);
|
|
25
|
-
o(x.lon <= 180).equals(true)(`lon: ${x.lon} <= 180`);
|
|
26
|
-
o(x.lon >= -180).equals(true)(`lon: ${x.lon} >= -180`);
|
|
27
|
-
}
|
|
28
|
-
o.spec('ProjectionTileMatrixSet', () => {
|
|
29
|
-
o('getTiffResZoom', () => {
|
|
30
|
-
o(Projection.getTiffResZoom(GoogleTms, 10)).equals(14);
|
|
31
|
-
o(Projection.getTiffResZoom(GoogleTms, 10 * 2)).equals(13);
|
|
32
|
-
o(Projection.getTiffResZoom(GoogleTms, 0.075)).equals(21);
|
|
33
|
-
o(Projection.getTiffResZoom(Nztm2000Tms, 10)).equals(10);
|
|
34
|
-
o(Projection.getTiffResZoom(Nztm2000Tms, 10 * 2)).equals(9);
|
|
35
|
-
o(Projection.getTiffResZoom(Nztm2000Tms, 0.075)).equals(16);
|
|
36
|
-
});
|
|
37
|
-
[Nztm2000QuadTms, GoogleTms].forEach((tms) => {
|
|
38
|
-
o(`should getTiffResZoom when floating errors happen (${tms.identifier})`, () => {
|
|
39
|
-
// Shift the resolution by a very small amount
|
|
40
|
-
const shiftAmount = 1e-9;
|
|
41
|
-
for (let i = 0; i < tms.maxZoom; i++) {
|
|
42
|
-
o(Projection.getTiffResZoom(tms, tms.pixelScale(i) - shiftAmount)).equals(i);
|
|
43
|
-
o(Projection.getTiffResZoom(tms, tms.pixelScale(i) + shiftAmount)).equals(i);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
o('getTileSize', async () => {
|
|
48
|
-
o(Projection.getImagePixelWidth(GoogleTms, { x: 0, y: 0, z: 5 }, 10)).equals(16384);
|
|
49
|
-
o(Projection.getImagePixelWidth(GoogleTms, { x: 0, y: 0, z: 13 }, 20)).equals(65536);
|
|
50
|
-
o(Projection.getImagePixelWidth(Nztm2000Tms, { x: 0, y: 0, z: 5 }, 10)).equals(20480);
|
|
51
|
-
o(Projection.getImagePixelWidth(Nztm2000Tms, { x: 0, y: 0, z: 13 }, 16)).equals(5120);
|
|
52
|
-
});
|
|
53
|
-
o('findAlignmentLevels', () => {
|
|
54
|
-
o(Projection.findAlignmentLevels(GoogleTms, { x: 2, y: 0, z: 5 }, 0.075)).equals(15);
|
|
55
|
-
o(Projection.findAlignmentLevels(GoogleTms, { x: 2, y: 0, z: 5 }, 0.5)).equals(13);
|
|
56
|
-
o(Projection.findAlignmentLevels(GoogleTms, { x: 2, y: 0, z: 3 }, 1)).equals(14);
|
|
57
|
-
o(Projection.findAlignmentLevels(GoogleTms, { x: 2, y: 0, z: 8 }, 10)).equals(5);
|
|
58
|
-
o(Projection.findAlignmentLevels(GoogleTms, { x: 2, y: 0, z: 14 }, 10)).equals(0);
|
|
59
|
-
o(Projection.findAlignmentLevels(Nztm2000Tms, { x: 2, y: 0, z: 1 }, 0.075)).equals(14);
|
|
60
|
-
o(Projection.findAlignmentLevels(Nztm2000Tms, { x: 2, y: 0, z: 5 }, 0.5)).equals(8);
|
|
61
|
-
o(Projection.findAlignmentLevels(Nztm2000Tms, { x: 2, y: 0, z: 3 }, 7)).equals(6);
|
|
62
|
-
o(Projection.findAlignmentLevels(Nztm2000Tms, { x: 2, y: 0, z: 8 }, 14)).equals(0);
|
|
63
|
-
});
|
|
64
|
-
o.spec('tileCenterToLatLon', () => {
|
|
65
|
-
o('should create centers for web mercator', () => {
|
|
66
|
-
const center = Projection.tileCenterToLatLon(GoogleTms, QuadKey.toTile('3120123'));
|
|
67
|
-
isValidLatLong(center);
|
|
68
|
-
o(round(center, 6)).deepEquals({
|
|
69
|
-
lat: -47.989922,
|
|
70
|
-
lon: 105.46875,
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
o('should create centers for NZTM', () => {
|
|
74
|
-
const center = Projection.tileCenterToLatLon(Nztm2000Tms, { x: 2295, y: 5119, z: 10 });
|
|
75
|
-
isValidLatLong(center);
|
|
76
|
-
const centerB = Projection.tileCenterToLatLon(Nztm2000Tms, { x: 20, y: 20, z: 10 });
|
|
77
|
-
isValidLatLong(centerB);
|
|
78
|
-
});
|
|
79
|
-
o('should create centers for NZTMQuad', () => {
|
|
80
|
-
const center = Projection.tileCenterToLatLon(Nztm2000QuadTms, { x: 200, y: 500, z: 10 });
|
|
81
|
-
isValidLatLong(center);
|
|
82
|
-
o(round(center, 7)).deepEquals({ lat: -35.7940688, lon: 141.3785792 });
|
|
83
|
-
const centerB = Projection.tileCenterToLatLon(Nztm2000QuadTms, { x: 1000, y: 1000, z: 10 });
|
|
84
|
-
isValidLatLong(centerB);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
o.spec('wrapLatLon', () => {
|
|
88
|
-
o('should wrap longitude', () => {
|
|
89
|
-
o(Projection.wrapLatLon(0, 1)).deepEquals({ lat: 0, lon: 1 });
|
|
90
|
-
o(Projection.wrapLatLon(0, 181)).deepEquals({ lat: 0, lon: -179 });
|
|
91
|
-
o(Projection.wrapLatLon(0, 271)).deepEquals({ lat: 0, lon: -89 });
|
|
92
|
-
o(Projection.wrapLatLon(0, 361)).deepEquals({ lat: 0, lon: 1 });
|
|
93
|
-
o(Projection.wrapLatLon(0, 631)).deepEquals({ lat: 0, lon: -89 });
|
|
94
|
-
o(Projection.wrapLatLon(0, 721)).deepEquals({ lat: 0, lon: 1 });
|
|
95
|
-
o(Projection.wrapLatLon(0, -1)).deepEquals({ lat: 0, lon: -1 });
|
|
96
|
-
o(Projection.wrapLatLon(0, -181)).deepEquals({ lat: 0, lon: 179 });
|
|
97
|
-
o(Projection.wrapLatLon(0, -271)).deepEquals({ lat: 0, lon: 89 });
|
|
98
|
-
o(Projection.wrapLatLon(0, -361)).deepEquals({ lat: 0, lon: -1 });
|
|
99
|
-
o(Projection.wrapLatLon(0, -631)).deepEquals({ lat: 0, lon: 89 });
|
|
100
|
-
o(Projection.wrapLatLon(0, -721)).deepEquals({ lat: 0, lon: -1 });
|
|
101
|
-
});
|
|
102
|
-
o('should wrap latitude', () => {
|
|
103
|
-
o(Projection.wrapLatLon(1, 0)).deepEquals({ lat: 1, lon: 0 });
|
|
104
|
-
o(Projection.wrapLatLon(91, 0)).deepEquals({ lat: 89, lon: 180 });
|
|
105
|
-
o(Projection.wrapLatLon(181, 0)).deepEquals({ lat: -1, lon: 180 });
|
|
106
|
-
o(Projection.wrapLatLon(271, 0)).deepEquals({ lat: -89, lon: 0 });
|
|
107
|
-
o(Projection.wrapLatLon(361, 0)).deepEquals({ lat: 1, lon: 0 });
|
|
108
|
-
o(Projection.wrapLatLon(631, 0)).deepEquals({ lat: -89, lon: 0 });
|
|
109
|
-
o(Projection.wrapLatLon(721, 0)).deepEquals({ lat: 1, lon: 0 });
|
|
110
|
-
o(Projection.wrapLatLon(-1, 0)).deepEquals({ lat: -1, lon: 0 });
|
|
111
|
-
o(Projection.wrapLatLon(-91, 0)).deepEquals({ lat: -89, lon: 180 });
|
|
112
|
-
o(Projection.wrapLatLon(-181, 0)).deepEquals({ lat: 1, lon: 180 });
|
|
113
|
-
o(Projection.wrapLatLon(-271, 0)).deepEquals({ lat: 89, lon: 0 });
|
|
114
|
-
o(Projection.wrapLatLon(-361, 0)).deepEquals({ lat: -1, lon: 0 });
|
|
115
|
-
o(Projection.wrapLatLon(-631, 0)).deepEquals({ lat: 89, lon: 0 });
|
|
116
|
-
o(Projection.wrapLatLon(-721, 0)).deepEquals({ lat: -1, lon: 0 });
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
o.spec('tileToWgs84Bbox', () => {
|
|
120
|
-
o('should handle antimeridian', () => {
|
|
121
|
-
const pt = Projection.tileToWgs84Bbox(Nztm2000Tms, { x: 2, y: 1, z: 1 });
|
|
122
|
-
o(round(pt)).deepEquals([170.05982382, -20.71836222, -179.34441047, -10.28396555]);
|
|
123
|
-
});
|
|
124
|
-
o('should convert base tiles', () => {
|
|
125
|
-
const pt = Projection.tileToWgs84Bbox(GoogleTms, { x: 0, y: 0, z: 0 });
|
|
126
|
-
o(round(pt)).deepEquals([-180, -85.05112878, 180, 85.05112878]);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
o.spec('TilingBounds', () => {
|
|
130
|
-
// Approximate bounding box of new zealand
|
|
131
|
-
const tifBoundingBox = [18494091.86765497, -6051366.655280836, 19986142.659781612, -4016307.214216303];
|
|
132
|
-
const expectedBaseSize = Bounds.fromJson({ width: 9.53125, height: 13, y: 153.65625, x: 246.14062500000006 });
|
|
133
|
-
o('should tile 0,0,0', () => {
|
|
134
|
-
const bounds = getPixelsBoundsFromMeters(tifBoundingBox, 0);
|
|
135
|
-
Approx.bounds(bounds, expectedBaseSize);
|
|
136
|
-
const screenBounds = getPixelsFromTile(0, 0);
|
|
137
|
-
const intersection = bounds.intersection(screenBounds);
|
|
138
|
-
Approx.bounds(intersection, expectedBaseSize);
|
|
139
|
-
});
|
|
140
|
-
o('should tile 1,1,1', () => {
|
|
141
|
-
const [x, y, z] = [1, 1, 1];
|
|
142
|
-
const bounds = getPixelsBoundsFromMeters(tifBoundingBox, z);
|
|
143
|
-
const expectedBaseSizeScaled = expectedBaseSize.scale(2, 2);
|
|
144
|
-
Approx.bounds(bounds, expectedBaseSizeScaled);
|
|
145
|
-
const screenBounds = getPixelsFromTile(x, y);
|
|
146
|
-
const intersection = bounds.intersection(screenBounds);
|
|
147
|
-
Approx.bounds(intersection, expectedBaseSizeScaled);
|
|
148
|
-
});
|
|
149
|
-
/**
|
|
150
|
-
* XYZ tiles 15,9,4 & 15,10,4 provide a top/bottom tiles for this bounding box
|
|
151
|
-
*
|
|
152
|
-
* 15
|
|
153
|
-
* |-------|
|
|
154
|
-
* | XXX | 9
|
|
155
|
-
* |-------|
|
|
156
|
-
* | XXX | 10
|
|
157
|
-
* |-------|
|
|
158
|
-
*/
|
|
159
|
-
o('should tile [15, 9, 4] & [15, 10, 4]', () => {
|
|
160
|
-
const [x, z] = [15, 4];
|
|
161
|
-
const bounds = getPixelsBoundsFromMeters(tifBoundingBox, z);
|
|
162
|
-
const expectedBaseSizeScaled = expectedBaseSize.scale(2 ** z, 2 ** z);
|
|
163
|
-
Approx.bounds(bounds, expectedBaseSizeScaled);
|
|
164
|
-
const screenBounds9 = getPixelsFromTile(x, 9);
|
|
165
|
-
const screenBounds10 = getPixelsFromTile(x, 10);
|
|
166
|
-
o(screenBounds9.toJson()).deepEquals({ width: 256, height: 256, y: 2304, x: 3840 });
|
|
167
|
-
o(screenBounds10.toJson()).deepEquals({ width: 256, height: 256, y: 2560, x: 3840 });
|
|
168
|
-
const intersection9 = bounds.intersection(screenBounds9);
|
|
169
|
-
const intersection10 = bounds.intersection(screenBounds10);
|
|
170
|
-
if (intersection9 == null || intersection10 == null) {
|
|
171
|
-
throw new Error('Intersections are null');
|
|
172
|
-
}
|
|
173
|
-
// the image is split in two so the intersection should combine into the total height of the image
|
|
174
|
-
const totalIntersectionHeight = intersection9.height + intersection10.height;
|
|
175
|
-
o(totalIntersectionHeight).equals(bounds.height);
|
|
176
|
-
// The image is not split horizontally so the width should be the same for both intersections
|
|
177
|
-
o(intersection9.width).equals(bounds.width);
|
|
178
|
-
o(intersection10.width).equals(bounds.width);
|
|
179
|
-
Approx.equal(intersection9.height, 101.5, 'height');
|
|
180
|
-
Approx.equal(intersection10.height, 106.5, 'height');
|
|
181
|
-
});
|
|
182
|
-
/**
|
|
183
|
-
* XYZ tiles [30, 19, 5], [31, 19, 5], [30, 20, 5], [31, 20, 5]
|
|
184
|
-
* provide a top, bottom, left & right tiles for this bounding box
|
|
185
|
-
*
|
|
186
|
-
* 30 31
|
|
187
|
-
* |-------|-------|
|
|
188
|
-
* | XXXXX|XXXX | 19
|
|
189
|
-
* |-------|-------|
|
|
190
|
-
* | XXXXX|XXXX | 20
|
|
191
|
-
* |-------|-------|
|
|
192
|
-
*/
|
|
193
|
-
o('should tile [30, 19, 5], [31, 19, 5], [30, 20, 5], [31, 20, 5]', () => {
|
|
194
|
-
const z = 5;
|
|
195
|
-
const tileBounds = new Bounds(30, 19, 1, 1);
|
|
196
|
-
const bounds = getPixelsBoundsFromMeters(tifBoundingBox, z);
|
|
197
|
-
const expectedBaseSizeScaled = expectedBaseSize.scale(2 ** z, 2 ** z);
|
|
198
|
-
Approx.bounds(bounds, expectedBaseSizeScaled);
|
|
199
|
-
const screenTopLeft = getPixelsFromTile(tileBounds.x, tileBounds.y);
|
|
200
|
-
const screenTopRight = getPixelsFromTile(tileBounds.right, tileBounds.y);
|
|
201
|
-
o(screenTopLeft.toJson()).deepEquals({ width: 256, height: 256, y: 4864, x: 7680 });
|
|
202
|
-
o(screenTopRight.toJson()).deepEquals({ width: 256, height: 256, y: 4864, x: 7936 });
|
|
203
|
-
const intersectionTopLeft = bounds.intersection(screenTopLeft);
|
|
204
|
-
const intersectionTopRight = bounds.intersection(screenTopRight);
|
|
205
|
-
if (intersectionTopLeft == null || intersectionTopRight == null) {
|
|
206
|
-
throw new Error('Intersections are null');
|
|
207
|
-
}
|
|
208
|
-
// the image is split in two so the intersection should combine into the total width of the image
|
|
209
|
-
const totalTopIntersectionWidth = intersectionTopLeft.width + intersectionTopRight.width;
|
|
210
|
-
o(totalTopIntersectionWidth).equals(bounds.width);
|
|
211
|
-
o(intersectionTopLeft.height).equals(203);
|
|
212
|
-
o(intersectionTopRight.height).equals(203);
|
|
213
|
-
const screenBottomLeft = getPixelsFromTile(tileBounds.x, tileBounds.bottom);
|
|
214
|
-
const screenBottomRight = getPixelsFromTile(tileBounds.right, tileBounds.bottom);
|
|
215
|
-
o(screenBottomLeft.toJson()).deepEquals({ width: 256, height: 256, y: 5120, x: 7680 });
|
|
216
|
-
o(screenBottomRight.toJson()).deepEquals({ width: 256, height: 256, y: 5120, x: 7936 });
|
|
217
|
-
const intersectionBottomLeft = bounds.intersection(screenBottomLeft);
|
|
218
|
-
const intersectionBottomRight = bounds.intersection(screenBottomRight);
|
|
219
|
-
if (intersectionBottomLeft == null || intersectionBottomRight == null) {
|
|
220
|
-
throw new Error('Bottom intersections are null');
|
|
221
|
-
}
|
|
222
|
-
// the image is split in two so the intersection should combine into the total width of the image
|
|
223
|
-
const totalBottomIntersectionWidth = intersectionBottomLeft.width + intersectionBottomRight.width;
|
|
224
|
-
o(totalBottomIntersectionWidth).equals(bounds.width);
|
|
225
|
-
Approx.equal(intersectionBottomLeft.height, 213, 'height');
|
|
226
|
-
Approx.equal(intersectionBottomRight.height, 213, 'height');
|
|
227
|
-
const totalLeftIntersectionHeight = intersectionTopLeft.height + intersectionBottomLeft.height;
|
|
228
|
-
const totalRightIntersectionHeight = intersectionTopRight.height + intersectionBottomRight.height;
|
|
229
|
-
o(totalLeftIntersectionHeight).equals(bounds.height);
|
|
230
|
-
o(totalRightIntersectionHeight).equals(bounds.height);
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
//# sourceMappingURL=projection.tile.matrix.set.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projection.tile.matrix.set.test.js","sourceRoot":"","sources":["../../../src/proj/__tests__/projection.tile.matrix.set.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAEzD,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,EAAU,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB;;;;;GAKG;AACH,SAAS,yBAAyB,CAAC,MAAY,EAAE,IAAY;IAC3D,MAAM,eAAe,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC7E,MAAM,gBAAgB,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC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G;YACjG,MAAM,4BAA4B,GAAG,sBAAsB,CAAC,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAC;YAClG,CAAC,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACrD,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;YAC3D,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;YAE5D,MAAM,2BAA2B,GAAG,mBAAmB,CAAC,MAAM,GAAG,sBAAsB,CAAC,MAAM,CAAC;YAC/F,MAAM,4BAA4B,GAAG,oBAAoB,CAAC,MAAM,GAAG,uBAAuB,CAAC,MAAM,CAAC;YAClG,CAAC,CAAC,2BAA2B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACrD,CAAC,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { TileMatrixSet, Tile, NamedBounds } from '@basemaps/geo';
|
|
2
|
-
export declare function qkToName(qk: string): string;
|
|
3
|
-
export declare function qkToNamedBounds(quadKeys: string[]): NamedBounds[];
|
|
4
|
-
export declare function tileNamesToNamedBounds(tileNames: string[], tms?: TileMatrixSet): NamedBounds[];
|
|
5
|
-
export declare function genTileNames(topLeftTile: Tile, xTotal: number, yTotal?: number, tms?: TileMatrixSet): NamedBounds[];
|
|
6
|
-
//# sourceMappingURL=test.util.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.util.d.ts","sourceRoot":"","sources":["../../../src/proj/__tests__/test.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,IAAI,EAAkB,WAAW,EAAE,MAAM,eAAe,CAAC;AAEpG,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAGjE;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,gBAAsC,GAAG,WAAW,EAAE,CAEpH;AAED,wBAAgB,YAAY,CAC1B,WAAW,EAAE,IAAI,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,SAAI,EACV,GAAG,gBAAsC,GACxC,WAAW,EAAE,CAef"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { EpsgCode, QuadKey, TileMatrixSet, TileMatrixSets } from '@basemaps/geo';
|
|
2
|
-
export function qkToName(qk) {
|
|
3
|
-
return TileMatrixSet.tileToName(QuadKey.toTile(qk));
|
|
4
|
-
}
|
|
5
|
-
export function qkToNamedBounds(quadKeys) {
|
|
6
|
-
const tms = TileMatrixSets.get(EpsgCode.Google);
|
|
7
|
-
return quadKeys.map((qk) => ({ name: qkToName(qk), ...tms.tileToSourceBounds(QuadKey.toTile(qk)) }));
|
|
8
|
-
}
|
|
9
|
-
export function tileNamesToNamedBounds(tileNames, tms = TileMatrixSets.get(EpsgCode.Google)) {
|
|
10
|
-
return tileNames.map((name) => ({ name, ...tms.tileToSourceBounds(TileMatrixSet.nameToTile(name)) }));
|
|
11
|
-
}
|
|
12
|
-
export function genTileNames(topLeftTile, xTotal, yTotal = 1, tms = TileMatrixSets.get(EpsgCode.Google)) {
|
|
13
|
-
const bounds = [];
|
|
14
|
-
yTotal += topLeftTile.y;
|
|
15
|
-
xTotal += topLeftTile.x;
|
|
16
|
-
const tile = { ...topLeftTile };
|
|
17
|
-
for (let y = topLeftTile.y; y < yTotal; ++y) {
|
|
18
|
-
tile.y = y;
|
|
19
|
-
for (let x = topLeftTile.x; x < xTotal; ++x) {
|
|
20
|
-
tile.x = x;
|
|
21
|
-
bounds.push({ name: TileMatrixSet.tileToName(tile), ...tms.tileToSourceBounds(tile) });
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return bounds;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=test.util.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.util.js","sourceRoot":"","sources":["../../../src/proj/__tests__/test.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAQ,cAAc,EAAe,MAAM,eAAe,CAAC;AAEpG,MAAM,UAAU,QAAQ,CAAC,EAAU;IACjC,OAAO,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAkB;IAChD,MAAM,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvG,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,SAAmB,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;IACnG,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,kBAAkB,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxG,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,WAAiB,EACjB,MAAc,EACd,MAAM,GAAG,CAAC,EACV,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;IAEzC,MAAM,MAAM,GAAkB,EAAE,CAAC;IAEjC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC;IACxB,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC;IACxB,MAAM,IAAI,GAAG,EAAE,GAAG,WAAW,EAAE,CAAC;IAChC,KAAK,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE;QAC3C,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,KAAK,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE;YAC3C,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YACX,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACxF;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/build/proj/citm2000.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Well known text for NZGD2000 / Chatham Islands TM 2000
|
|
3
|
-
*
|
|
4
|
-
* @see https://epsg.io/3793
|
|
5
|
-
*/
|
|
6
|
-
export declare const Citm2000 = "PROJCS[\"NZGD2000 / Chatham Islands TM 2000\",\nGEOGCS[\"NZGD2000\",\n DATUM[\"New_Zealand_Geodetic_Datum_2000\",\n SPHEROID[\"GRS 1980\",6378137,298.257222101,\n AUTHORITY[\"EPSG\",\"7019\"]],\n TOWGS84[0,0,0,0,0,0,0],\n AUTHORITY[\"EPSG\",\"6167\"]],\n PRIMEM[\"Greenwich\",0,\n AUTHORITY[\"EPSG\",\"8901\"]],\n UNIT[\"degree\",0.01745329251994328,\n AUTHORITY[\"EPSG\",\"9122\"]],\n AUTHORITY[\"EPSG\",\"4167\"]],\n UNIT[\"metre\",1,\n AUTHORITY[\"EPSG\",\"9001\"]],\nPROJECTION[\"Transverse_Mercator\"],\nPARAMETER[\"latitude_of_origin\",0],\nPARAMETER[\"central_meridian\",-176.5],\nPARAMETER[\"scale_factor\",1],\nPARAMETER[\"false_easting\",3500000],\nPARAMETER[\"false_northing\",10000000],\nAUTHORITY[\"EPSG\",\"3793\"],\nAXIS[\"Easting\",EAST],\nAXIS[\"Northing\",NORTH]]";
|
|
7
|
-
//# sourceMappingURL=citm2000.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"citm2000.d.ts","sourceRoot":"","sources":["../../src/proj/citm2000.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,s1BAsBG,CAAC"}
|
package/build/proj/citm2000.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Well known text for NZGD2000 / Chatham Islands TM 2000
|
|
3
|
-
*
|
|
4
|
-
* @see https://epsg.io/3793
|
|
5
|
-
*/
|
|
6
|
-
export const Citm2000 = `PROJCS["NZGD2000 / Chatham Islands TM 2000",
|
|
7
|
-
GEOGCS["NZGD2000",
|
|
8
|
-
DATUM["New_Zealand_Geodetic_Datum_2000",
|
|
9
|
-
SPHEROID["GRS 1980",6378137,298.257222101,
|
|
10
|
-
AUTHORITY["EPSG","7019"]],
|
|
11
|
-
TOWGS84[0,0,0,0,0,0,0],
|
|
12
|
-
AUTHORITY["EPSG","6167"]],
|
|
13
|
-
PRIMEM["Greenwich",0,
|
|
14
|
-
AUTHORITY["EPSG","8901"]],
|
|
15
|
-
UNIT["degree",0.01745329251994328,
|
|
16
|
-
AUTHORITY["EPSG","9122"]],
|
|
17
|
-
AUTHORITY["EPSG","4167"]],
|
|
18
|
-
UNIT["metre",1,
|
|
19
|
-
AUTHORITY["EPSG","9001"]],
|
|
20
|
-
PROJECTION["Transverse_Mercator"],
|
|
21
|
-
PARAMETER["latitude_of_origin",0],
|
|
22
|
-
PARAMETER["central_meridian",-176.5],
|
|
23
|
-
PARAMETER["scale_factor",1],
|
|
24
|
-
PARAMETER["false_easting",3500000],
|
|
25
|
-
PARAMETER["false_northing",10000000],
|
|
26
|
-
AUTHORITY["EPSG","3793"],
|
|
27
|
-
AXIS["Easting",EAST],
|
|
28
|
-
AXIS["Northing",NORTH]]`;
|
|
29
|
-
//# sourceMappingURL=citm2000.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"citm2000.js","sourceRoot":"","sources":["../../src/proj/citm2000.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;wBAsBA,CAAC"}
|
package/build/proj/nztm2000.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Well known text for NZGD2000
|
|
3
|
-
*
|
|
4
|
-
* @see https://epsg.io/2193
|
|
5
|
-
*/
|
|
6
|
-
export declare const Nztm2000 = "PROJCS[\"NZGD2000 / New Zealand Transverse Mercator 2000\",\nGEOGCS[\"NZGD2000\",\n DATUM[\"New_Zealand_Geodetic_Datum_2000\",\n SPHEROID[\"GRS 1980\",6378137,298.257222101,\n AUTHORITY[\"EPSG\",\"7019\"]],\n TOWGS84[0,0,0,0,0,0,0],\n AUTHORITY[\"EPSG\",\"6167\"]],\n PRIMEM[\"Greenwich\",0,\n AUTHORITY[\"EPSG\",\"8901\"]],\n UNIT[\"degree\",0.0174532925199433,\n AUTHORITY[\"EPSG\",\"9122\"]],\n AUTHORITY[\"EPSG\",\"4167\"]],\nPROJECTION[\"Transverse_Mercator\"],\nPARAMETER[\"latitude_of_origin\",0],\nPARAMETER[\"central_meridian\",173],\nPARAMETER[\"scale_factor\",0.9996],\nPARAMETER[\"false_easting\",1600000],\nPARAMETER[\"false_northing\",10000000],\nUNIT[\"metre\",1,\n AUTHORITY[\"EPSG\",\"9001\"]],\nAUTHORITY[\"EPSG\",\"2193\"]]";
|
|
7
|
-
//# sourceMappingURL=nztm2000.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nztm2000.d.ts","sourceRoot":"","sources":["../../src/proj/nztm2000.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,wyBAoBK,CAAC"}
|
package/build/proj/nztm2000.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Well known text for NZGD2000
|
|
3
|
-
*
|
|
4
|
-
* @see https://epsg.io/2193
|
|
5
|
-
*/
|
|
6
|
-
export const Nztm2000 = `PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
|
|
7
|
-
GEOGCS["NZGD2000",
|
|
8
|
-
DATUM["New_Zealand_Geodetic_Datum_2000",
|
|
9
|
-
SPHEROID["GRS 1980",6378137,298.257222101,
|
|
10
|
-
AUTHORITY["EPSG","7019"]],
|
|
11
|
-
TOWGS84[0,0,0,0,0,0,0],
|
|
12
|
-
AUTHORITY["EPSG","6167"]],
|
|
13
|
-
PRIMEM["Greenwich",0,
|
|
14
|
-
AUTHORITY["EPSG","8901"]],
|
|
15
|
-
UNIT["degree",0.0174532925199433,
|
|
16
|
-
AUTHORITY["EPSG","9122"]],
|
|
17
|
-
AUTHORITY["EPSG","4167"]],
|
|
18
|
-
PROJECTION["Transverse_Mercator"],
|
|
19
|
-
PARAMETER["latitude_of_origin",0],
|
|
20
|
-
PARAMETER["central_meridian",173],
|
|
21
|
-
PARAMETER["scale_factor",0.9996],
|
|
22
|
-
PARAMETER["false_easting",1600000],
|
|
23
|
-
PARAMETER["false_northing",10000000],
|
|
24
|
-
UNIT["metre",1,
|
|
25
|
-
AUTHORITY["EPSG","9001"]],
|
|
26
|
-
AUTHORITY["EPSG","2193"]]`;
|
|
27
|
-
//# sourceMappingURL=nztm2000.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nztm2000.js","sourceRoot":"","sources":["../../src/proj/nztm2000.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;0BAoBE,CAAC"}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { BoundingBox, Epsg, EpsgCode, TileMatrixSet, Tile, NamedBounds } from '@basemaps/geo';
|
|
2
|
-
import { BBox, BBoxFeature, BBoxFeatureCollection } from '@linzjs/geojson';
|
|
3
|
-
import { Position } from 'geojson';
|
|
4
|
-
export interface LatLon {
|
|
5
|
-
lat: number;
|
|
6
|
-
lon: number;
|
|
7
|
-
}
|
|
8
|
-
export declare class Projection {
|
|
9
|
-
/** If floating point numbers differ by this amount they are close enough */
|
|
10
|
-
static AllowedFloatingError: number;
|
|
11
|
-
/** EPSG code for the projection other than Epsg.Wgs84 */
|
|
12
|
-
epsg: Epsg;
|
|
13
|
-
/** Transform coordinates to and from Wgs84 */
|
|
14
|
-
private projection;
|
|
15
|
-
/**
|
|
16
|
-
* Wrapper around TileMatrixSet with utilities for converting Points and Polygons
|
|
17
|
-
*/
|
|
18
|
-
private constructor();
|
|
19
|
-
/** Ensure that a transformation in proj4.js is defined */
|
|
20
|
-
static define(epsg: Epsg, def: string): void;
|
|
21
|
-
/**
|
|
22
|
-
* Get the Projection instance for a specified code,
|
|
23
|
-
*
|
|
24
|
-
* throws a exception if the code is not recognized
|
|
25
|
-
*
|
|
26
|
-
* @param epsgCode
|
|
27
|
-
*/
|
|
28
|
-
static get(epsgCode: Epsg | EpsgCode | TileMatrixSet): Projection;
|
|
29
|
-
/**
|
|
30
|
-
* Try to find a corresponding Projection for a number
|
|
31
|
-
* @param epsgCode
|
|
32
|
-
*/
|
|
33
|
-
static tryGet(unk?: Epsg | EpsgCode | TileMatrixSet): Projection | null;
|
|
34
|
-
/**
|
|
35
|
-
* Project the points in a MultiPolygon array to the `targetProjection`.
|
|
36
|
-
*
|
|
37
|
-
* @return if multipoly is not projected return it verbatim otherwise creates a new multi
|
|
38
|
-
* polygon
|
|
39
|
-
*/
|
|
40
|
-
projectMultipolygon(multipoly: Position[][][], targetProjection: Projection): Position[][][];
|
|
41
|
-
/**
|
|
42
|
-
* Convert source `[x, y]` coordinates to `[lon, lat]`
|
|
43
|
-
*/
|
|
44
|
-
get toWgs84(): (coordinates: Position) => Position;
|
|
45
|
-
/**
|
|
46
|
-
* Convert `[lon, lat]` coordinates to source `[x, y]`
|
|
47
|
-
*/
|
|
48
|
-
get fromWgs84(): (coordinates: Position) => Position;
|
|
49
|
-
/**
|
|
50
|
-
* Convert a source Bounds to GeoJSON WGS84 BoundingBox. In particular if the bounds crosses the
|
|
51
|
-
* anti-meridian then the east component will be less than the west component.
|
|
52
|
-
*
|
|
53
|
-
* @param source
|
|
54
|
-
* @returns [west, south, east, north]
|
|
55
|
-
*/
|
|
56
|
-
boundsToWgs84BoundingBox(source: BoundingBox): BBox;
|
|
57
|
-
/**
|
|
58
|
-
* Convert a source bounds to a WSG84 GeoJSON Feature
|
|
59
|
-
*
|
|
60
|
-
* @param bounds in source epsg
|
|
61
|
-
* @param properties any properties to include in the feature such as name
|
|
62
|
-
*
|
|
63
|
-
* @returns If `bounds` crosses the antimeridian then and east and west pair of non crossing
|
|
64
|
-
* polygons will be returned; otherwise a single Polygon will be returned.
|
|
65
|
-
*/
|
|
66
|
-
boundsToGeoJsonFeature(bounds: BoundingBox, properties?: {}): BBoxFeature;
|
|
67
|
-
/** Convert a tile covering to a GeoJSON FeatureCollection */
|
|
68
|
-
toGeoJson(files: NamedBounds[]): BBoxFeatureCollection;
|
|
69
|
-
/**
|
|
70
|
-
* Find the closest zoom level to `pixelScale` that is at
|
|
71
|
-
* least as good as `pixelScale` or within the error bounds (+- 1e-8)
|
|
72
|
-
*
|
|
73
|
-
* @see Projection.AllowedFloatingError.
|
|
74
|
-
*
|
|
75
|
-
* @param pixelScale A pixel's resolution in metres
|
|
76
|
-
*/
|
|
77
|
-
static getTiffResZoom(tms: TileMatrixSet, pixelScale: number): number;
|
|
78
|
-
/** Convert a tile to the wgs84 bounds */
|
|
79
|
-
static tileToWgs84Bbox(tms: TileMatrixSet, tile: Tile): BBox;
|
|
80
|
-
/**
|
|
81
|
-
* return the `lat`, `lon` of a Tile's center
|
|
82
|
-
*/
|
|
83
|
-
static tileCenterToLatLon(tms: TileMatrixSet, tile: Tile): LatLon;
|
|
84
|
-
/**
|
|
85
|
-
* Reused from : https://github.com/pelias/api/blob/6a7751f35882698eb885b93635656ec0c2941633/sanitizer/wrap.js
|
|
86
|
-
*
|
|
87
|
-
* Normalize co-ordinates that lie outside of the normal ranges.
|
|
88
|
-
*
|
|
89
|
-
* longitude wrapping simply requires adding +- 360 to the value until it comes in to range.
|
|
90
|
-
* for the latitude values we need to flip the longitude whenever the latitude
|
|
91
|
-
* crosses a pole.
|
|
92
|
-
*
|
|
93
|
-
*/
|
|
94
|
-
static wrapLatLon(lat: number, lon: number): LatLon;
|
|
95
|
-
/**
|
|
96
|
-
* Find the number of alignment levels required to render the tile. Min 0
|
|
97
|
-
*
|
|
98
|
-
* @param tile
|
|
99
|
-
* @param gsd the pixel resolution of the source imagery
|
|
100
|
-
*/
|
|
101
|
-
static findAlignmentLevels(tms: TileMatrixSet, tile: Tile, gsd: number, blockFactor?: number): number;
|
|
102
|
-
/**
|
|
103
|
-
* Return the expected width in pixels of an image at the tile resolution.
|
|
104
|
-
*
|
|
105
|
-
* @param tile
|
|
106
|
-
* @param targetZoom The desired zoom level for the imagery
|
|
107
|
-
*/
|
|
108
|
-
static getImagePixelWidth(tms: TileMatrixSet, tile: Tile, targetZoom: number): number;
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/proj/projection.ts"],"names":[],"mapp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AsB,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,KAAK,GAAG,WAAW;IAezE,6DAA6D;IAC7D,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,qBAAqB;IAOtD;;;;;;;OAOG;IACH,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAQrE,yCAAyC;IACzC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI;IAY5D;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM;IAOjE;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IA8BnD;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,SAAI,GAAG,MAAM;IAIhG;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;CAKtF"}
|
package/build/proj/projection.js
DELETED
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { Epsg } from '@basemaps/geo';
|
|
2
|
-
import { multiPolygonToWgs84, toFeatureMultiPolygon, toFeaturePolygon, } from '@linzjs/geojson';
|
|
3
|
-
import Proj from 'proj4';
|
|
4
|
-
import { CompositeError } from '../composite.error.js';
|
|
5
|
-
import { Citm2000 } from './citm2000.js';
|
|
6
|
-
import { Nztm2000 } from './nztm2000.js';
|
|
7
|
-
Proj.defs(Epsg.Nztm2000.toEpsgString(), Nztm2000);
|
|
8
|
-
Proj.defs(Epsg.Citm2000.toEpsgString(), Citm2000);
|
|
9
|
-
const CodeMap = new Map();
|
|
10
|
-
function getEpsgCode(epsgCode) {
|
|
11
|
-
if (epsgCode == null)
|
|
12
|
-
return null;
|
|
13
|
-
if (typeof epsgCode === 'number')
|
|
14
|
-
return epsgCode;
|
|
15
|
-
if ('code' in epsgCode)
|
|
16
|
-
return epsgCode.code;
|
|
17
|
-
if ('projection' in epsgCode)
|
|
18
|
-
return epsgCode.projection.code;
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
export class Projection {
|
|
22
|
-
/**
|
|
23
|
-
* Wrapper around TileMatrixSet with utilities for converting Points and Polygons
|
|
24
|
-
*/
|
|
25
|
-
constructor(epsg) {
|
|
26
|
-
this.epsg = epsg;
|
|
27
|
-
try {
|
|
28
|
-
this.projection = Proj(epsg.toEpsgString(), Epsg.Wgs84.toEpsgString());
|
|
29
|
-
}
|
|
30
|
-
catch (err) {
|
|
31
|
-
throw new CompositeError(`Failed to create projection: ${epsg.toEpsgString()}, ${Epsg.Wgs84.toEpsgString()}`, 500, err);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/** Ensure that a transformation in proj4.js is defined */
|
|
35
|
-
static define(epsg, def) {
|
|
36
|
-
const existing = CodeMap.get(epsg.code);
|
|
37
|
-
if (existing != null)
|
|
38
|
-
throw new Error('Duplicate projection definition: ' + epsg.toEpsgString());
|
|
39
|
-
Proj.defs(epsg.toEpsgString(), def);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get the Projection instance for a specified code,
|
|
43
|
-
*
|
|
44
|
-
* throws a exception if the code is not recognized
|
|
45
|
-
*
|
|
46
|
-
* @param epsgCode
|
|
47
|
-
*/
|
|
48
|
-
static get(epsgCode) {
|
|
49
|
-
const proj = this.tryGet(epsgCode);
|
|
50
|
-
if (proj == null)
|
|
51
|
-
throw new Error(`Invalid projection: ${epsgCode}`);
|
|
52
|
-
return proj;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Try to find a corresponding Projection for a number
|
|
56
|
-
* @param epsgCode
|
|
57
|
-
*/
|
|
58
|
-
static tryGet(unk) {
|
|
59
|
-
const epsgCode = getEpsgCode(unk);
|
|
60
|
-
if (epsgCode == null)
|
|
61
|
-
return null;
|
|
62
|
-
// Existing projection logic, cache and reuse
|
|
63
|
-
let proj = CodeMap.get(epsgCode);
|
|
64
|
-
if (proj != null)
|
|
65
|
-
return proj;
|
|
66
|
-
// ensure the EPSG Code has been registered in basemaps
|
|
67
|
-
const epsg = Epsg.tryGet(epsgCode);
|
|
68
|
-
if (epsg == null)
|
|
69
|
-
return null;
|
|
70
|
-
// Ensure proj has a transform for this projection
|
|
71
|
-
const def = Proj.defs(epsg.toEpsgString());
|
|
72
|
-
if (def == null)
|
|
73
|
-
return null;
|
|
74
|
-
proj = new Projection(epsg);
|
|
75
|
-
CodeMap.set(epsgCode, proj);
|
|
76
|
-
return proj;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Project the points in a MultiPolygon array to the `targetProjection`.
|
|
80
|
-
*
|
|
81
|
-
* @return if multipoly is not projected return it verbatim otherwise creates a new multi
|
|
82
|
-
* polygon
|
|
83
|
-
*/
|
|
84
|
-
projectMultipolygon(multipoly, targetProjection) {
|
|
85
|
-
if (targetProjection.epsg.code === this.epsg.code)
|
|
86
|
-
return multipoly;
|
|
87
|
-
const { toWgs84 } = this;
|
|
88
|
-
const { fromWgs84 } = targetProjection;
|
|
89
|
-
return multipoly.map((poly) => poly.map((ring) => ring.map((p) => fromWgs84(toWgs84(p)))));
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Convert source `[x, y]` coordinates to `[lon, lat]`
|
|
93
|
-
*/
|
|
94
|
-
get toWgs84() {
|
|
95
|
-
return this.projection.forward;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Convert `[lon, lat]` coordinates to source `[x, y]`
|
|
99
|
-
*/
|
|
100
|
-
get fromWgs84() {
|
|
101
|
-
return this.projection.inverse;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Convert a source Bounds to GeoJSON WGS84 BoundingBox. In particular if the bounds crosses the
|
|
105
|
-
* anti-meridian then the east component will be less than the west component.
|
|
106
|
-
*
|
|
107
|
-
* @param source
|
|
108
|
-
* @returns [west, south, east, north]
|
|
109
|
-
*/
|
|
110
|
-
boundsToWgs84BoundingBox(source) {
|
|
111
|
-
const sw = this.toWgs84([source.x, source.y]);
|
|
112
|
-
const ne = this.toWgs84([source.x + source.width, source.y + source.height]);
|
|
113
|
-
return [sw[0], sw[1], ne[0], ne[1]];
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Convert a source bounds to a WSG84 GeoJSON Feature
|
|
117
|
-
*
|
|
118
|
-
* @param bounds in source epsg
|
|
119
|
-
* @param properties any properties to include in the feature such as name
|
|
120
|
-
*
|
|
121
|
-
* @returns If `bounds` crosses the antimeridian then and east and west pair of non crossing
|
|
122
|
-
* polygons will be returned; otherwise a single Polygon will be returned.
|
|
123
|
-
*/
|
|
124
|
-
boundsToGeoJsonFeature(bounds, properties = {}) {
|
|
125
|
-
const sw = [bounds.x, bounds.y];
|
|
126
|
-
const se = [bounds.x + bounds.width, bounds.y];
|
|
127
|
-
const nw = [bounds.x, bounds.y + bounds.height];
|
|
128
|
-
const ne = [bounds.x + bounds.width, bounds.y + bounds.height];
|
|
129
|
-
const coords = multiPolygonToWgs84([[[sw, nw, ne, se, sw]]], this.toWgs84);
|
|
130
|
-
const feature = coords.length === 1 ? toFeaturePolygon(coords[0], properties) : toFeatureMultiPolygon(coords, properties);
|
|
131
|
-
feature.bbox = this.boundsToWgs84BoundingBox(bounds);
|
|
132
|
-
return feature;
|
|
133
|
-
}
|
|
134
|
-
/** Convert a tile covering to a GeoJSON FeatureCollection */
|
|
135
|
-
toGeoJson(files) {
|
|
136
|
-
return {
|
|
137
|
-
type: 'FeatureCollection',
|
|
138
|
-
features: files.map((f) => this.boundsToGeoJsonFeature(f, { name: f.name })),
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Find the closest zoom level to `pixelScale` that is at
|
|
143
|
-
* least as good as `pixelScale` or within the error bounds (+- 1e-8)
|
|
144
|
-
*
|
|
145
|
-
* @see Projection.AllowedFloatingError.
|
|
146
|
-
*
|
|
147
|
-
* @param pixelScale A pixel's resolution in metres
|
|
148
|
-
*/
|
|
149
|
-
static getTiffResZoom(tms, pixelScale) {
|
|
150
|
-
for (let z = 0; z < tms.zooms.length; z++) {
|
|
151
|
-
const diff = tms.pixelScale(z) - pixelScale;
|
|
152
|
-
if (diff < this.AllowedFloatingError)
|
|
153
|
-
return z;
|
|
154
|
-
}
|
|
155
|
-
return tms.zooms.length - 1;
|
|
156
|
-
}
|
|
157
|
-
/** Convert a tile to the wgs84 bounds */
|
|
158
|
-
static tileToWgs84Bbox(tms, tile) {
|
|
159
|
-
const ul = tms.tileToSource(tile);
|
|
160
|
-
const lr = tms.tileToSource({ x: tile.x + 1, y: tile.y + 1, z: tile.z });
|
|
161
|
-
const proj = this.get(tms);
|
|
162
|
-
const [swLon, swLat] = proj.toWgs84([ul.x, lr.y]);
|
|
163
|
-
const [neLon, neLat] = proj.toWgs84([lr.x, ul.y]);
|
|
164
|
-
return [swLon, swLat, neLon, neLat];
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* return the `lat`, `lon` of a Tile's center
|
|
168
|
-
*/
|
|
169
|
-
static tileCenterToLatLon(tms, tile) {
|
|
170
|
-
const point = tms.tileToSource({ x: tile.x + 0.5, y: tile.y + 0.5, z: tile.z });
|
|
171
|
-
const [lon, lat] = this.get(tms).toWgs84([point.x, point.y]);
|
|
172
|
-
return Projection.wrapLatLon(lat, lon);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Reused from : https://github.com/pelias/api/blob/6a7751f35882698eb885b93635656ec0c2941633/sanitizer/wrap.js
|
|
176
|
-
*
|
|
177
|
-
* Normalize co-ordinates that lie outside of the normal ranges.
|
|
178
|
-
*
|
|
179
|
-
* longitude wrapping simply requires adding +- 360 to the value until it comes in to range.
|
|
180
|
-
* for the latitude values we need to flip the longitude whenever the latitude
|
|
181
|
-
* crosses a pole.
|
|
182
|
-
*
|
|
183
|
-
*/
|
|
184
|
-
static wrapLatLon(lat, lon) {
|
|
185
|
-
const point = { lat, lon };
|
|
186
|
-
const quadrant = Math.floor(Math.abs(lat) / 90) % 4;
|
|
187
|
-
const pole = lat > 0 ? 90 : -90;
|
|
188
|
-
const offset = lat % 90;
|
|
189
|
-
switch (quadrant) {
|
|
190
|
-
case 0:
|
|
191
|
-
point.lat = offset;
|
|
192
|
-
break;
|
|
193
|
-
case 1:
|
|
194
|
-
point.lat = pole - offset;
|
|
195
|
-
point.lon += 180;
|
|
196
|
-
break;
|
|
197
|
-
case 2:
|
|
198
|
-
point.lat = -offset;
|
|
199
|
-
point.lon += 180;
|
|
200
|
-
break;
|
|
201
|
-
case 3:
|
|
202
|
-
point.lat = -pole + offset;
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
if (point.lon > 180 || point.lon < -180) {
|
|
206
|
-
point.lon -= Math.floor((point.lon + 180) / 360) * 360;
|
|
207
|
-
}
|
|
208
|
-
return point;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Find the number of alignment levels required to render the tile. Min 0
|
|
212
|
-
*
|
|
213
|
-
* @param tile
|
|
214
|
-
* @param gsd the pixel resolution of the source imagery
|
|
215
|
-
*/
|
|
216
|
-
static findAlignmentLevels(tms, tile, gsd, blockFactor = 2) {
|
|
217
|
-
return Math.max(0, this.getTiffResZoom(tms, gsd * blockFactor) - tile.z);
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Return the expected width in pixels of an image at the tile resolution.
|
|
221
|
-
*
|
|
222
|
-
* @param tile
|
|
223
|
-
* @param targetZoom The desired zoom level for the imagery
|
|
224
|
-
*/
|
|
225
|
-
static getImagePixelWidth(tms, tile, targetZoom) {
|
|
226
|
-
const ul = tms.tileToSource(tile);
|
|
227
|
-
const lr = tms.tileToSource({ x: tile.x + 1, y: tile.y + 1, z: tile.z });
|
|
228
|
-
return Math.round((lr.x - ul.x) / tms.pixelScale(targetZoom)) * 2;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
/** If floating point numbers differ by this amount they are close enough */
|
|
232
|
-
Projection.AllowedFloatingError = 1e-8;
|
|
233
|
-
//# sourceMappingURL=projection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../src/proj/projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAA8C,MAAM,eAAe,CAAC;AAC9F,OAAO,EAKL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,IAAI,MAAM,OAAO,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,QAAQ,CAAC,CAAC;AAClD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,QAAQ,CAAC,CAAC;AAElD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;AAMhD,SAAS,WAAW,CAAC,QAA0C;IAC7D,IAAI,QAAQ,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAClD,IAAI,MAAM,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,IAAI,CAAC;IAC7C,IAAI,YAAY,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;IA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CAAC;QAClC,MAAM,EAAE,GAAG,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;;AAjPD,4EAA4E;AACrE,+BAAoB,GAAG,IAAI,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tile.set.name.d.ts","sourceRoot":"","sources":["../../src/proj/tile.set.name.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,MAAM,WAAW;CAClB;AAED,wBAAgB,iBAAiB,IAAI,WAAW,EAAE,CAEjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tile.set.name.js","sourceRoot":"","sources":["../../src/proj/tile.set.name.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,WAEX;AAFD,WAAY,WAAW;IACrB,gCAAiB,CAAA;AACnB,CAAC,EAFW,WAAW,KAAX,WAAW,QAEtB;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC"}
|