@basemaps/shared 6.22.0 → 6.24.2
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
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
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.24.2](https://github.com/linz/basemaps/compare/v6.24.1...v6.24.2) (2022-04-20)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @basemaps/shared
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [6.24.1](https://github.com/linz/basemaps/compare/v6.24.0...v6.24.1) (2022-04-07)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **shared:** Projection.tyryGet do not throw if no projection is defined ([#2145](https://github.com/linz/basemaps/issues/2145)) ([7592fe5](https://github.com/linz/basemaps/commit/7592fe53c023f341f916520a7014fd00436df245))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [6.23.0](https://github.com/linz/basemaps/compare/v6.22.1...v6.23.0) (2022-04-04)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* **shared:** load projections from the internet when not defined locally ([#2132](https://github.com/linz/basemaps/issues/2132)) ([85ac59f](https://github.com/linz/basemaps/commit/85ac59f771c3233f163a0223459faece46073847))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
# [6.22.0](https://github.com/linz/basemaps/compare/v6.21.1...v6.22.0) (2022-03-20)
|
|
7
37
|
|
|
8
38
|
**Note:** Version bump only for package @basemaps/shared
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EpsgCode } from '@basemaps/geo';
|
|
1
|
+
import { Epsg, EpsgCode } from '@basemaps/geo';
|
|
2
2
|
import { round } from '@basemaps/test/build/rounding.js';
|
|
3
3
|
import { bboxToPolygon } from '@linzjs/geojson';
|
|
4
4
|
import o from 'ospec';
|
|
@@ -16,6 +16,13 @@ o.spec('Projection', () => {
|
|
|
16
16
|
const reverse = nztmProj.fromWgs84(output);
|
|
17
17
|
o(round(reverse, 2)).deepEquals([1180000, 4758000]);
|
|
18
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
|
+
});
|
|
19
26
|
o('toGeoJson', () => {
|
|
20
27
|
const geojson = googleProj.toGeoJson(qkToNamedBounds(['31', '33']));
|
|
21
28
|
const { features } = geojson;
|
|
@@ -13,6 +13,8 @@ export declare class Projection {
|
|
|
13
13
|
* Wrapper around TileMatrixSet with utilities for converting Points and Polygons
|
|
14
14
|
*/
|
|
15
15
|
private constructor();
|
|
16
|
+
/** Ensure that a transformation in proj4.js is defined */
|
|
17
|
+
static define(epsg: Epsg, def: string): void;
|
|
16
18
|
/**
|
|
17
19
|
* Get the Projection instance for a specified code,
|
|
18
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/proj/projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EACL,IAAI,EACJ,WAAW,EACX,qBAAqB,EAKtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAUnC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AAE,MAAM,GAAG,MAAM;CAKtF"}
|
package/build/proj/projection.js
CHANGED
|
@@ -31,6 +31,13 @@ export class Projection {
|
|
|
31
31
|
throw new CompositeError(`Failed to create projection: ${epsg.toEpsgString()}, ${Epsg.Wgs84.toEpsgString()}`, 500, err);
|
|
32
32
|
}
|
|
33
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
|
+
}
|
|
34
41
|
/**
|
|
35
42
|
* Get the Projection instance for a specified code,
|
|
36
43
|
*
|
|
@@ -52,12 +59,18 @@ export class Projection {
|
|
|
52
59
|
const epsgCode = getEpsgCode(unk);
|
|
53
60
|
if (epsgCode == null)
|
|
54
61
|
return null;
|
|
62
|
+
// Existing projection logic, cache and reuse
|
|
55
63
|
let proj = CodeMap.get(epsgCode);
|
|
56
64
|
if (proj != null)
|
|
57
65
|
return proj;
|
|
66
|
+
// ensure the EPSG Code has been registered in basemaps
|
|
58
67
|
const epsg = Epsg.tryGet(epsgCode);
|
|
59
68
|
if (epsg == null)
|
|
60
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;
|
|
61
74
|
proj = new Projection(epsg);
|
|
62
75
|
CodeMap.set(epsgCode, proj);
|
|
63
76
|
return proj;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basemaps/shared",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.24.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,9 +23,9 @@
|
|
|
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.24.2",
|
|
27
|
+
"@basemaps/geo": "^6.24.2",
|
|
28
|
+
"@basemaps/tiler": "^6.24.2",
|
|
29
29
|
"@chunkd/source-aws-v2": "^8.1.0",
|
|
30
30
|
"@linzjs/geojson": "^6.21.1",
|
|
31
31
|
"@linzjs/metrics": "^6.21.1",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"files": [
|
|
50
50
|
"build/"
|
|
51
51
|
],
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "12826558ede6a4e6ecdc0c250afc9a784b9cb40e"
|
|
53
53
|
}
|