@basemaps/cli 6.6.0 → 6.10.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 +52 -0
- package/basemaps.js +2 -0
- package/build/cli/base.cli.d.ts +1 -1
- package/build/cli/base.cli.d.ts.map +1 -1
- package/build/cli/base.cli.js +25 -27
- package/build/cli/basemaps/action.invalidate.d.ts +1 -1
- package/build/cli/basemaps/action.invalidate.d.ts.map +1 -1
- package/build/cli/basemaps/action.invalidate.js +14 -18
- package/build/cli/basemaps/action.tileset.info.d.ts +1 -1
- package/build/cli/basemaps/action.tileset.info.d.ts.map +1 -1
- package/build/cli/basemaps/action.tileset.info.js +18 -23
- package/build/cli/basemaps/index.d.ts +2 -2
- package/build/cli/basemaps/index.d.ts.map +1 -1
- package/build/cli/basemaps/index.js +10 -14
- package/build/cli/basemaps/tileset.action.d.ts.map +1 -1
- package/build/cli/basemaps/tileset.action.js +4 -8
- package/build/cli/basemaps/tileset.util.d.ts +1 -13
- package/build/cli/basemaps/tileset.util.d.ts.map +1 -1
- package/build/cli/basemaps/tileset.util.js +20 -63
- package/build/cli/cli.table.d.ts.map +1 -1
- package/build/cli/cli.table.js +2 -7
- package/build/cli/cogify/__test__/action.batch.test.js +11 -14
- package/build/cli/cogify/__test__/semver.test.js +50 -53
- package/build/cli/cogify/action.batch.d.ts +2 -2
- package/build/cli/cogify/action.batch.d.ts.map +1 -1
- package/build/cli/cogify/action.batch.js +16 -22
- package/build/cli/cogify/action.cog.d.ts +1 -1
- package/build/cli/cogify/action.cog.d.ts.map +1 -1
- package/build/cli/cogify/action.cog.js +29 -33
- package/build/cli/cogify/action.job.d.ts.map +1 -1
- package/build/cli/cogify/action.job.js +21 -26
- package/build/cli/cogify/index.d.ts +2 -2
- package/build/cli/cogify/index.d.ts.map +1 -1
- package/build/cli/cogify/index.js +9 -13
- package/build/cli/cogify/semver.util.d.ts.map +1 -1
- package/build/cli/cogify/semver.util.js +2 -5
- package/build/cli/folder.js +6 -11
- package/build/cli/tag.action.js +1 -4
- package/build/cli/util.js +11 -16
- package/build/cog/__test__/builder.test.js +31 -35
- package/build/cog/__test__/cog.stac.job.test.js +59 -62
- package/build/cog/__test__/cog.test.js +26 -29
- package/build/cog/__test__/cog.vrt.test.js +90 -90
- package/build/cog/__test__/cutline.test.js +71 -71
- package/build/cog/__test__/source.tiff.testhelper.d.ts +1 -1
- package/build/cog/__test__/source.tiff.testhelper.d.ts.map +1 -1
- package/build/cog/__test__/source.tiff.testhelper.js +6 -9
- package/build/cog/builder.d.ts +3 -3
- package/build/cog/builder.d.ts.map +1 -1
- package/build/cog/builder.js +43 -48
- package/build/cog/cog.d.ts +2 -2
- package/build/cog/cog.d.ts.map +1 -1
- package/build/cog/cog.js +15 -19
- package/build/cog/cog.stac.job.d.ts +10 -10
- package/build/cog/cog.stac.job.d.ts.map +1 -1
- package/build/cog/cog.stac.job.js +48 -52
- package/build/cog/cog.vrt.d.ts +2 -2
- package/build/cog/cog.vrt.d.ts.map +1 -1
- package/build/cog/cog.vrt.js +16 -18
- package/build/cog/constants.js +2 -5
- package/build/cog/cutline.d.ts +21 -21
- package/build/cog/cutline.d.ts.map +1 -1
- package/build/cog/cutline.js +53 -58
- package/build/cog/job.factory.d.ts +2 -2
- package/build/cog/job.factory.d.ts.map +1 -1
- package/build/cog/job.factory.js +25 -41
- package/build/cog/stac.d.ts +1 -1
- package/build/cog/stac.d.ts.map +1 -1
- package/build/cog/stac.js +2 -5
- package/build/cog/types.d.ts +1 -1
- package/build/cog/types.d.ts.map +1 -1
- package/build/cog/types.js +1 -2
- package/build/gdal/__test__/gdal.progress.test.js +11 -14
- package/build/gdal/__test__/gdal.test.js +35 -38
- package/build/gdal/gdal.cog.d.ts +2 -2
- package/build/gdal/gdal.cog.d.ts.map +1 -1
- package/build/gdal/gdal.cog.js +14 -18
- package/build/gdal/gdal.command.d.ts +1 -1
- package/build/gdal/gdal.command.d.ts.map +1 -1
- package/build/gdal/gdal.command.js +4 -9
- package/build/gdal/gdal.config.d.ts.map +1 -1
- package/build/gdal/gdal.config.js +4 -7
- package/build/gdal/gdal.d.ts +1 -1
- package/build/gdal/gdal.d.ts.map +1 -1
- package/build/gdal/gdal.docker.d.ts +1 -1
- package/build/gdal/gdal.docker.d.ts.map +1 -1
- package/build/gdal/gdal.docker.js +8 -13
- package/build/gdal/gdal.js +7 -11
- package/build/gdal/gdal.local.d.ts +1 -1
- package/build/gdal/gdal.local.d.ts.map +1 -1
- package/build/gdal/gdal.local.js +2 -6
- package/build/gdal/gdal.progress.d.ts.map +1 -1
- package/build/gdal/gdal.progress.js +2 -6
- package/build/index.d.ts +5 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -11
- package/{cogify → cogify.js} +1 -1
- package/package.json +15 -13
- package/basemaps +0 -2
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
1
|
+
import { EpsgCode, GoogleTms, Nztm2000Tms } from '@basemaps/geo';
|
|
2
|
+
import { fsa, LogConfig } from '@basemaps/shared';
|
|
3
|
+
import { qkToName } from '@basemaps/shared/build/proj/__test__/test.util.js';
|
|
4
|
+
import { round } from '@basemaps/test/build/rounding.js';
|
|
5
|
+
import o from 'ospec';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import url from 'url';
|
|
8
|
+
import { Gdal } from '../../gdal/gdal.js';
|
|
9
|
+
import { CogVrt } from '../cog.vrt.js';
|
|
10
|
+
import { Cutline } from '../cutline.js';
|
|
11
|
+
import { SourceTiffTestHelper } from './source.tiff.testhelper.js';
|
|
12
|
+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
13
|
+
o.spec('cog.vrt', () => {
|
|
14
14
|
const tmpFolder = '/tmp/my-tmp-folder';
|
|
15
|
-
const job =
|
|
16
|
-
const logger =
|
|
17
|
-
|
|
15
|
+
const job = SourceTiffTestHelper.makeCogJob();
|
|
16
|
+
const logger = LogConfig.get();
|
|
17
|
+
LogConfig.disable();
|
|
18
18
|
const testDir = `${__dirname}/../../../__test.assets__`;
|
|
19
|
-
const sourceBounds =
|
|
19
|
+
const sourceBounds = SourceTiffTestHelper.tiffNztmBounds(testDir);
|
|
20
20
|
const [tif1, tif2] = sourceBounds;
|
|
21
21
|
const [tif1Path, tif2Path] = sourceBounds.map(({ name }) => name);
|
|
22
22
|
let cutTiffArgs = [];
|
|
23
|
-
let runSpy =
|
|
24
|
-
const origFileOperatorWriteJson =
|
|
25
|
-
const { create } =
|
|
23
|
+
let runSpy = o.spy();
|
|
24
|
+
const origFileOperatorWriteJson = fsa.writeJson;
|
|
25
|
+
const { create } = Gdal;
|
|
26
26
|
let gdal;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
o.after(() => {
|
|
28
|
+
fsa.writeJson = origFileOperatorWriteJson;
|
|
29
|
+
Gdal.create = create;
|
|
30
30
|
});
|
|
31
|
-
|
|
32
|
-
runSpy =
|
|
33
|
-
job.output.tileMatrix =
|
|
34
|
-
job.source.epsg =
|
|
31
|
+
o.beforeEach(() => {
|
|
32
|
+
runSpy = o.spy();
|
|
33
|
+
job.output.tileMatrix = GoogleTms.identifier;
|
|
34
|
+
job.source.epsg = EpsgCode.Nztm2000;
|
|
35
35
|
job.source.gsd = 20;
|
|
36
36
|
gdal = { run: runSpy };
|
|
37
|
-
|
|
37
|
+
Gdal.create = () => gdal;
|
|
38
38
|
job.source.files = [tif1, tif2];
|
|
39
39
|
cutTiffArgs = [];
|
|
40
|
-
|
|
40
|
+
fsa.writeJson = ((...args) => {
|
|
41
41
|
cutTiffArgs.push(args);
|
|
42
42
|
});
|
|
43
43
|
job.output.cutline = undefined;
|
|
44
44
|
});
|
|
45
|
-
|
|
46
|
-
const cutline = new
|
|
47
|
-
const cl2 = new
|
|
45
|
+
o('1 crosses, 1 outside', async () => {
|
|
46
|
+
const cutline = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/kapiti.geojson'));
|
|
47
|
+
const cl2 = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/mana.geojson'));
|
|
48
48
|
cutline.clipPoly.push(...cl2.clipPoly);
|
|
49
|
-
const vrt = await
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const vrt = await CogVrt.buildVrt(tmpFolder, job, cutline, qkToName('31133322'), logger);
|
|
50
|
+
o(job.source.files).deepEquals([tif1, tif2]);
|
|
51
|
+
o(cutline.clipPoly.length).equals(2);
|
|
52
|
+
o(vrt).equals('/tmp/my-tmp-folder/cog.vrt');
|
|
53
53
|
});
|
|
54
|
-
|
|
55
|
-
const cutline = new
|
|
56
|
-
const vrt = await
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
o('not within tile', async () => {
|
|
55
|
+
const cutline = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/kapiti.geojson'));
|
|
56
|
+
const vrt = await CogVrt.buildVrt(tmpFolder, job, cutline, qkToName('3131110001'), logger);
|
|
57
|
+
o(cutTiffArgs.length).equals(0);
|
|
58
|
+
o(vrt).equals(null);
|
|
59
|
+
o(runSpy.callCount).equals(0);
|
|
60
60
|
});
|
|
61
|
-
|
|
62
|
-
const vrt = await
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
o('no cutline same projection', async () => {
|
|
62
|
+
const vrt = await CogVrt.buildVrt(tmpFolder, job, new Cutline(GoogleTms), qkToName('31'), logger);
|
|
63
|
+
o(job.source.files).deepEquals([tif1, tif2]);
|
|
64
|
+
o(cutTiffArgs.length).equals(0);
|
|
65
|
+
o(vrt).equals('/tmp/my-tmp-folder/cog.vrt');
|
|
66
|
+
o(runSpy.callCount).equals(2);
|
|
67
|
+
o(runSpy.args[0]).equals('gdalwarp');
|
|
68
68
|
});
|
|
69
|
-
|
|
70
|
-
job.output.tileMatrix =
|
|
71
|
-
const vrt = await
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
o('no cutline diff projection', async () => {
|
|
70
|
+
job.output.tileMatrix = Nztm2000Tms.identifier; //EpsgCode.Nztm2000;
|
|
71
|
+
const vrt = await CogVrt.buildVrt(tmpFolder, job, new Cutline(GoogleTms), qkToName('31'), logger);
|
|
72
|
+
o(job.source.files).deepEquals([tif1, tif2]);
|
|
73
|
+
o(cutTiffArgs.length).equals(0);
|
|
74
|
+
o(vrt).equals('/tmp/my-tmp-folder/cog.vrt');
|
|
75
|
+
o(runSpy.callCount).equals(2);
|
|
76
|
+
o(runSpy.args[0]).equals('gdalwarp');
|
|
77
77
|
});
|
|
78
|
-
|
|
79
|
-
const cutline = new
|
|
80
|
-
const name =
|
|
81
|
-
const vrt = await
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
o('fully within same projection', async () => {
|
|
79
|
+
const cutline = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/kapiti.geojson'), -100);
|
|
80
|
+
const name = qkToName('311333222321113310');
|
|
81
|
+
const vrt = await CogVrt.buildVrt(tmpFolder, job, cutline, name, logger);
|
|
82
|
+
o(vrt).equals('/tmp/my-tmp-folder/cog.vrt');
|
|
83
|
+
o(cutTiffArgs.length).equals(0);
|
|
84
|
+
o(runSpy.callCount).equals(2);
|
|
85
|
+
o(runSpy.args[0]).equals('gdalwarp');
|
|
86
86
|
});
|
|
87
|
-
|
|
88
|
-
const cutline = new
|
|
87
|
+
o('intersected cutline', async () => {
|
|
88
|
+
const cutline = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/kapiti.geojson'), 20);
|
|
89
89
|
job.output.cutline = { blend: 20, href: 'cutline.json' };
|
|
90
|
-
const name =
|
|
91
|
-
const vrt = await
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
const name = qkToName('311333222321113');
|
|
91
|
+
const vrt = await CogVrt.buildVrt(tmpFolder, job, cutline, name, logger);
|
|
92
|
+
o(vrt).equals('/tmp/my-tmp-folder/cog.vrt');
|
|
93
|
+
o(cutTiffArgs.length).equals(1);
|
|
94
|
+
o(cutTiffArgs[0][1]).deepEquals(cutline.toGeoJson());
|
|
95
|
+
o(round(cutTiffArgs[0], 6)).deepEquals([
|
|
96
96
|
'/tmp/my-tmp-folder/cutline.geojson',
|
|
97
97
|
{
|
|
98
98
|
type: 'FeatureCollection',
|
|
@@ -130,9 +130,9 @@ ospec_1.default.spec('cog.vrt', () => {
|
|
|
130
130
|
},
|
|
131
131
|
]);
|
|
132
132
|
});
|
|
133
|
-
|
|
134
|
-
const mount =
|
|
135
|
-
const setCredentials =
|
|
133
|
+
o('1 surrounded with s3 files', async () => {
|
|
134
|
+
const mount = o.spy();
|
|
135
|
+
const setCredentials = o.spy();
|
|
136
136
|
gdal.mount = mount;
|
|
137
137
|
gdal.setCredentials = setCredentials;
|
|
138
138
|
const vtif1 = '/vsis3' + tif1Path;
|
|
@@ -144,17 +144,17 @@ ospec_1.default.spec('cog.vrt', () => {
|
|
|
144
144
|
return o;
|
|
145
145
|
});
|
|
146
146
|
job.output.cutline = { blend: 10, href: 'cutline.json' };
|
|
147
|
-
const cutline = new
|
|
148
|
-
const vrt = await
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
const cutline = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/mana.geojson'));
|
|
148
|
+
const vrt = await CogVrt.buildVrt(tmpFolder, job, cutline, qkToName('3131110001'), logger);
|
|
149
|
+
o(vrt).equals('/tmp/my-tmp-folder/cog.vrt');
|
|
150
|
+
o(cutTiffArgs.length).equals(1);
|
|
151
|
+
o(cutTiffArgs[0][0]).equals(tmpFolder + '/cutline.geojson');
|
|
152
|
+
o(cutline.clipPoly.length).equals(1);
|
|
153
153
|
const geo = cutline.toGeoJson();
|
|
154
|
-
|
|
154
|
+
o(geo.type).equals('FeatureCollection');
|
|
155
155
|
const coordinates = geo.features[0].geometry.coordinates;
|
|
156
156
|
if (geo.type === 'FeatureCollection') {
|
|
157
|
-
|
|
157
|
+
o(geo.features).deepEquals([
|
|
158
158
|
{
|
|
159
159
|
type: 'Feature',
|
|
160
160
|
properties: {},
|
|
@@ -165,7 +165,7 @@ ospec_1.default.spec('cog.vrt', () => {
|
|
|
165
165
|
},
|
|
166
166
|
]);
|
|
167
167
|
}
|
|
168
|
-
|
|
168
|
+
o(round(coordinates, 5)).deepEquals([
|
|
169
169
|
[
|
|
170
170
|
[
|
|
171
171
|
[19455446.57501, -5025689.98761],
|
|
@@ -189,15 +189,15 @@ ospec_1.default.spec('cog.vrt', () => {
|
|
|
189
189
|
],
|
|
190
190
|
],
|
|
191
191
|
]);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
o(runSpy.callCount).equals(2);
|
|
193
|
+
o(mount.calls.map((c) => c.args[0])).deepEquals([tmpFolder, ...job.source.files.map((c) => c.name)]);
|
|
194
|
+
o(setCredentials.calls.map((c) => c.args[0].service.config.params.RoleArn)).deepEquals(['a:role:string']);
|
|
195
|
+
o(round(runSpy.calls[0].args)).deepEquals([
|
|
196
196
|
'gdalbuildvrt',
|
|
197
197
|
['-hidenodata', '-allow_projection_difference', '-addalpha', '/tmp/my-tmp-folder/source.vrt', vtif1, vtif2],
|
|
198
198
|
logger,
|
|
199
199
|
]);
|
|
200
|
-
|
|
200
|
+
o(round(runSpy.args)).deepEquals([
|
|
201
201
|
'gdalwarp',
|
|
202
202
|
[
|
|
203
203
|
'-of',
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
1
|
+
import { Bounds, EpsgCode, GoogleTms, Nztm2000Tms } from '@basemaps/geo';
|
|
2
|
+
import { qkToName } from '@basemaps/shared/build/proj/__test__/test.util.js';
|
|
3
|
+
import { round } from '@basemaps/test/build/rounding.js';
|
|
4
|
+
import o from 'ospec';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import url from 'url';
|
|
7
|
+
import { Cutline, polyContainsBounds } from '../cutline.js';
|
|
8
|
+
import { SourceTiffTestHelper } from './source.tiff.testhelper.js';
|
|
9
|
+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
10
|
+
o.spec('cutline', () => {
|
|
11
11
|
const testDir = `${__dirname}/../../../__test.assets__`;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
o.spec('filterSourcesForName', () => {
|
|
13
|
+
o('fully within same projection', async () => {
|
|
14
14
|
// convert poly to GoogleTms
|
|
15
|
-
const cutpoly = new
|
|
16
|
-
const cutline = new
|
|
17
|
-
const name =
|
|
18
|
-
const job =
|
|
19
|
-
job.output.tileMatrix =
|
|
20
|
-
job.source.epsg =
|
|
21
|
-
const sourceBounds =
|
|
15
|
+
const cutpoly = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/kapiti.geojson')).toGeoJson();
|
|
16
|
+
const cutline = new Cutline(GoogleTms, cutpoly, -100);
|
|
17
|
+
const name = qkToName('311333222321113310');
|
|
18
|
+
const job = SourceTiffTestHelper.makeCogJob();
|
|
19
|
+
job.output.tileMatrix = GoogleTms.identifier;
|
|
20
|
+
job.source.epsg = EpsgCode.Nztm2000;
|
|
21
|
+
const sourceBounds = SourceTiffTestHelper.tiffNztmBounds(testDir);
|
|
22
22
|
const [tif1, tif2] = sourceBounds;
|
|
23
23
|
job.source.files = [tif1, tif2];
|
|
24
|
-
|
|
24
|
+
o(cutline.filterSourcesForName(name, job)).deepEquals([tif2.name]);
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
o('polyContainsBounds', () => {
|
|
28
28
|
const polys = [
|
|
29
29
|
[
|
|
30
30
|
[
|
|
@@ -58,14 +58,14 @@ ospec_1.default.spec('cutline', () => {
|
|
|
58
58
|
],
|
|
59
59
|
],
|
|
60
60
|
];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
o(polyContainsBounds(polys, Bounds.fromBbox([-6, -6, -3, -3]))).equals(true);
|
|
62
|
+
o(polyContainsBounds(polys, Bounds.fromBbox([-3, -4, 4, 4]))).equals(false);
|
|
63
|
+
o(polyContainsBounds(polys, Bounds.fromBbox([6, -8, 5, 5]))).equals(false);
|
|
64
64
|
});
|
|
65
|
-
|
|
66
|
-
const cutline = new
|
|
67
|
-
const geojson =
|
|
68
|
-
|
|
65
|
+
o('loadCutline', async () => {
|
|
66
|
+
const cutline = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/mana.geojson'));
|
|
67
|
+
const geojson = round(cutline.toGeoJson());
|
|
68
|
+
o(geojson).deepEquals({
|
|
69
69
|
type: 'FeatureCollection',
|
|
70
70
|
features: [
|
|
71
71
|
{
|
|
@@ -115,24 +115,24 @@ ospec_1.default.spec('cutline', () => {
|
|
|
115
115
|
},
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
|
-
|
|
119
|
-
const cutline = new
|
|
120
|
-
const bounds =
|
|
121
|
-
|
|
122
|
-
cutline.findCovering({ projection:
|
|
123
|
-
|
|
118
|
+
o('findCovering', async () => {
|
|
119
|
+
const cutline = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/mana.geojson'));
|
|
120
|
+
const bounds = SourceTiffTestHelper.tiffNztmBounds();
|
|
121
|
+
o(cutline.clipPoly.length).equals(2);
|
|
122
|
+
cutline.findCovering({ projection: EpsgCode.Nztm2000, bounds, resZoom: 15 });
|
|
123
|
+
o(cutline.srcPoly.length).equals(1);
|
|
124
124
|
});
|
|
125
|
-
|
|
126
|
-
const bounds =
|
|
127
|
-
|
|
128
|
-
const cutline = new
|
|
125
|
+
o.spec('optmize', async () => {
|
|
126
|
+
const bounds = SourceTiffTestHelper.tiffNztmBounds();
|
|
127
|
+
o('one-cog', () => {
|
|
128
|
+
const cutline = new Cutline(Nztm2000Tms, undefined, 0, true);
|
|
129
129
|
const covering = cutline.optimizeCovering({
|
|
130
|
-
projection:
|
|
130
|
+
projection: EpsgCode.Nztm2000,
|
|
131
131
|
bounds,
|
|
132
132
|
resZoom: 14,
|
|
133
133
|
});
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
o(covering.length).equals(1);
|
|
135
|
+
o(covering[0]).deepEquals({
|
|
136
136
|
x: 274000,
|
|
137
137
|
y: 3087000,
|
|
138
138
|
width: 3053000,
|
|
@@ -140,14 +140,14 @@ ospec_1.default.spec('cutline', () => {
|
|
|
140
140
|
name: '0-0-0',
|
|
141
141
|
});
|
|
142
142
|
});
|
|
143
|
-
|
|
144
|
-
const cutline = new
|
|
143
|
+
o('full-extent 3857', () => {
|
|
144
|
+
const cutline = new Cutline(GoogleTms);
|
|
145
145
|
const covering = cutline.optimizeCovering({
|
|
146
|
-
projection:
|
|
147
|
-
bounds: [{ ...
|
|
146
|
+
projection: EpsgCode.Google,
|
|
147
|
+
bounds: [{ ...GoogleTms.extent, name: 'gebco' }],
|
|
148
148
|
resZoom: 5,
|
|
149
149
|
});
|
|
150
|
-
|
|
150
|
+
o(round(covering, 4)).deepEquals([
|
|
151
151
|
{
|
|
152
152
|
name: '1-0-0',
|
|
153
153
|
x: -20037508.3428,
|
|
@@ -178,21 +178,21 @@ ospec_1.default.spec('cutline', () => {
|
|
|
178
178
|
},
|
|
179
179
|
]);
|
|
180
180
|
});
|
|
181
|
-
|
|
182
|
-
const cutline = new
|
|
181
|
+
o('nztm', () => {
|
|
182
|
+
const cutline = new Cutline(Nztm2000Tms);
|
|
183
183
|
const covering = cutline.optimizeCovering({
|
|
184
|
-
projection:
|
|
184
|
+
projection: EpsgCode.Nztm2000,
|
|
185
185
|
bounds,
|
|
186
186
|
resZoom: 14,
|
|
187
187
|
});
|
|
188
|
-
|
|
188
|
+
o(covering[4]).deepEquals({
|
|
189
189
|
name: '7-153-253',
|
|
190
190
|
x: 1741760,
|
|
191
191
|
y: 5448320,
|
|
192
192
|
width: 17920,
|
|
193
193
|
height: 17920,
|
|
194
194
|
});
|
|
195
|
-
|
|
195
|
+
o(covering.map((c) => c.name)).deepEquals([
|
|
196
196
|
'7-152-252',
|
|
197
197
|
'7-152-253',
|
|
198
198
|
'7-152-254',
|
|
@@ -207,7 +207,7 @@ ospec_1.default.spec('cutline', () => {
|
|
|
207
207
|
'8-387-635',
|
|
208
208
|
]);
|
|
209
209
|
});
|
|
210
|
-
|
|
210
|
+
o('source polygon is smoothed', async () => {
|
|
211
211
|
const tiff1 = {
|
|
212
212
|
name: '/path/to/tiff1.tiff',
|
|
213
213
|
x: 1759315.9336568,
|
|
@@ -223,13 +223,13 @@ ospec_1.default.spec('cutline', () => {
|
|
|
223
223
|
height: 2275.3359155077487,
|
|
224
224
|
};
|
|
225
225
|
const bounds = [tiff1, tiff2];
|
|
226
|
-
const cutline = new
|
|
226
|
+
const cutline = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/kapiti.geojson'), 500);
|
|
227
227
|
const covering = cutline.optimizeCovering({
|
|
228
|
-
projection:
|
|
228
|
+
projection: EpsgCode.Nztm2000,
|
|
229
229
|
bounds,
|
|
230
230
|
resZoom: 22,
|
|
231
231
|
});
|
|
232
|
-
|
|
232
|
+
o(round(cutline.clipPoly, 4)).deepEquals([
|
|
233
233
|
[
|
|
234
234
|
[
|
|
235
235
|
[19468580.0838, -4993280.8853],
|
|
@@ -245,7 +245,7 @@ ospec_1.default.spec('cutline', () => {
|
|
|
245
245
|
],
|
|
246
246
|
],
|
|
247
247
|
]);
|
|
248
|
-
|
|
248
|
+
o(covering.map((c) => c.name)).deepEquals([
|
|
249
249
|
'14-16151-10232',
|
|
250
250
|
'14-16151-10233',
|
|
251
251
|
'14-16152-10231',
|
|
@@ -254,8 +254,8 @@ ospec_1.default.spec('cutline', () => {
|
|
|
254
254
|
'18-258444-163695',
|
|
255
255
|
]);
|
|
256
256
|
});
|
|
257
|
-
|
|
258
|
-
const cutline = new
|
|
257
|
+
o('boundary part inland, part coastal', async () => {
|
|
258
|
+
const cutline = new Cutline(GoogleTms, await Cutline.loadCutline(testDir + '/kapiti.geojson'), 500);
|
|
259
259
|
const bounds = [
|
|
260
260
|
{
|
|
261
261
|
name: 'tiff1',
|
|
@@ -266,11 +266,11 @@ ospec_1.default.spec('cutline', () => {
|
|
|
266
266
|
},
|
|
267
267
|
];
|
|
268
268
|
const covering = cutline.optimizeCovering({
|
|
269
|
-
projection:
|
|
269
|
+
projection: EpsgCode.Nztm2000,
|
|
270
270
|
bounds,
|
|
271
271
|
resZoom: 22,
|
|
272
272
|
});
|
|
273
|
-
|
|
273
|
+
o(round(cutline.clipPoly, 4)).deepEquals([
|
|
274
274
|
[
|
|
275
275
|
[
|
|
276
276
|
[19470015.7313, -4990337.1045],
|
|
@@ -282,31 +282,31 @@ ospec_1.default.spec('cutline', () => {
|
|
|
282
282
|
],
|
|
283
283
|
],
|
|
284
284
|
]);
|
|
285
|
-
|
|
285
|
+
o(covering.map((c) => c.name)).deepEquals([
|
|
286
286
|
'14-16152-10231',
|
|
287
287
|
'15-32304-20464',
|
|
288
288
|
'15-32305-20464',
|
|
289
289
|
'18-258444-163695',
|
|
290
290
|
]);
|
|
291
291
|
});
|
|
292
|
-
|
|
293
|
-
const cutline = new
|
|
292
|
+
o('low res', () => {
|
|
293
|
+
const cutline = new Cutline(GoogleTms);
|
|
294
294
|
const covering = cutline.optimizeCovering({
|
|
295
|
-
projection:
|
|
295
|
+
projection: EpsgCode.Nztm2000,
|
|
296
296
|
bounds,
|
|
297
297
|
resZoom: 13,
|
|
298
298
|
});
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
o(covering.length).equals(covering.length);
|
|
300
|
+
o(covering.map((c) => c.name)).deepEquals(['8-252-159', '8-252-160']);
|
|
301
301
|
});
|
|
302
|
-
|
|
303
|
-
const covering2 = new
|
|
304
|
-
projection:
|
|
302
|
+
o('hi res', () => {
|
|
303
|
+
const covering2 = new Cutline(GoogleTms).optimizeCovering({
|
|
304
|
+
projection: EpsgCode.Nztm2000,
|
|
305
305
|
bounds,
|
|
306
306
|
resZoom: 18,
|
|
307
307
|
});
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
o(covering2.length).equals(covering2.length);
|
|
309
|
+
o(covering2.map((c) => c.name)).deepEquals([
|
|
310
310
|
'10-1008-639',
|
|
311
311
|
'10-1008-640',
|
|
312
312
|
'10-1009-639',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.tiff.testhelper.d.ts","sourceRoot":"","sources":["../../../src/cog/__test__/source.tiff.testhelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAa,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"source.tiff.testhelper.d.ts","sourceRoot":"","sources":["../../../src/cog/__test__/source.tiff.testhelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAa,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,eAAO,MAAM,oBAAoB;kBACjB,UAAU;mCAgBW,WAAW,EAAE;+BAmBrB,WAAW,EAAE,GAAG,MAAM,EAAE;CAGpD,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const geo_1 = require("@basemaps/geo");
|
|
5
|
-
const cog_stac_job_1 = require("../cog.stac.job");
|
|
6
|
-
exports.SourceTiffTestHelper = {
|
|
1
|
+
import { EpsgCode, GoogleTms } from '@basemaps/geo';
|
|
2
|
+
import { CogStacJob } from '../cog.stac.job.js';
|
|
3
|
+
export const SourceTiffTestHelper = {
|
|
7
4
|
makeCogJob() {
|
|
8
|
-
return new
|
|
5
|
+
return new CogStacJob({
|
|
9
6
|
source: {
|
|
10
7
|
files: [],
|
|
11
|
-
epsg:
|
|
8
|
+
epsg: EpsgCode.Nztm2000,
|
|
12
9
|
gsd: 0.8,
|
|
13
10
|
},
|
|
14
11
|
output: {
|
|
15
|
-
tileMatrix:
|
|
12
|
+
tileMatrix: GoogleTms.identifier,
|
|
16
13
|
gsd: 0.75,
|
|
17
14
|
addAlpha: true,
|
|
18
15
|
oneCogCovering: false,
|
package/build/cog/builder.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Epsg, TileMatrixSet } from '@basemaps/geo';
|
|
2
2
|
import { LogType } from '@basemaps/shared';
|
|
3
|
-
import { ChunkSource } from '@
|
|
3
|
+
import { ChunkSource } from '@chunkd/core';
|
|
4
4
|
import { CogTiff } from '@cogeotiff/core';
|
|
5
5
|
import pLimit from 'p-limit';
|
|
6
|
-
import { Cutline } from './cutline';
|
|
7
|
-
import { CogBuilderMetadata, SourceMetadata } from './types';
|
|
6
|
+
import { Cutline } from './cutline.js';
|
|
7
|
+
import { CogBuilderMetadata, SourceMetadata } from './types.js';
|
|
8
8
|
export declare const InvalidProjectionCode = 32767;
|
|
9
9
|
export declare const CacheVersion = "v3";
|
|
10
10
|
export declare const CacheFolder = "./.cache";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/cog/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAyC,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/cog/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAyC,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAuB,MAAM,iBAAiB,CAAC;AAG/D,OAAO,MAAM,MAAM,SAAS,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAC3C,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,WAAW,aAAa,CAAC;AAEtC;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAO/D;AAED,qBAAa,UAAU;IACrB,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,IAAI,CAAC;IAGf,kBAAkB,cAAqB;IAEvC;;OAEG;gBACS,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,IAAI;IAO1F;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAoF7D,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAuBnC;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI;IAaxC,wFAAwF;YAC1E,WAAW;IA2BzB;;;;OAIG;IACG,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAWjF"}
|