@basemaps/cli 6.9.1 → 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 +17 -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 -1
- package/build/cli/basemaps/tileset.util.d.ts.map +1 -1
- package/build/cli/basemaps/tileset.util.js +20 -28
- 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,54 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ospec_1.default(builder.config.blockSize).equals(512);
|
|
16
|
-
ospec_1.default(builder.config.alignmentLevels).equals(1);
|
|
17
|
-
ospec_1.default(builder.config).deepEquals({ ...gdal_config_1.GdalCogBuilderDefaults, bbox: undefined });
|
|
1
|
+
import o from 'ospec';
|
|
2
|
+
import { GdalCogBuilder } from '../gdal.cog.js';
|
|
3
|
+
import { normalizeAwsEnv } from '../gdal.command.js';
|
|
4
|
+
import { GdalCogBuilderDefaults } from '../gdal.config.js';
|
|
5
|
+
import { GdalDocker } from '../gdal.docker.js';
|
|
6
|
+
o.spec('GdalCogBuilder', () => {
|
|
7
|
+
o('should default all options', () => {
|
|
8
|
+
const builder = new GdalCogBuilder('/foo', 'bar.tiff');
|
|
9
|
+
o(builder.config.bbox).equals(undefined);
|
|
10
|
+
o(builder.config.compression).equals('webp');
|
|
11
|
+
o(builder.config.resampling).deepEquals({ warp: 'bilinear', overview: 'lanczos' });
|
|
12
|
+
o(builder.config.blockSize).equals(512);
|
|
13
|
+
o(builder.config.alignmentLevels).equals(1);
|
|
14
|
+
o(builder.config).deepEquals({ ...GdalCogBuilderDefaults, bbox: undefined });
|
|
18
15
|
});
|
|
19
|
-
|
|
20
|
-
const builder = new
|
|
16
|
+
o('should create a docker command', () => {
|
|
17
|
+
const builder = new GdalCogBuilder('/foo/foo.tiff', '/bar/bar.tiff');
|
|
21
18
|
const args = builder.args;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
o(args.includes('TILING_SCHEME=GoogleMapsCompatible')).equals(true);
|
|
20
|
+
o(args.includes('COMPRESS=webp')).equals(true);
|
|
21
|
+
o(builder.args.includes('BLOCKSIZE=512')).equals(true);
|
|
25
22
|
builder.config.compression = 'jpeg';
|
|
26
|
-
|
|
23
|
+
o(builder.args.includes('COMPRESS=jpeg')).equals(true);
|
|
27
24
|
builder.config.blockSize = 256;
|
|
28
|
-
|
|
25
|
+
o(builder.args.includes('BLOCKSIZE=256')).equals(true);
|
|
29
26
|
});
|
|
30
|
-
|
|
31
|
-
const gdalDocker = new
|
|
27
|
+
o('should mount folders', () => {
|
|
28
|
+
const gdalDocker = new GdalDocker();
|
|
32
29
|
gdalDocker.mount('/foo/bar');
|
|
33
|
-
|
|
30
|
+
o(gdalDocker.mounts).deepEquals(['/foo']);
|
|
34
31
|
});
|
|
35
|
-
|
|
36
|
-
const gdalDocker = new
|
|
32
|
+
o('should not duplicate folders', () => {
|
|
33
|
+
const gdalDocker = new GdalDocker();
|
|
37
34
|
gdalDocker.mount('/foo/bar.html');
|
|
38
35
|
gdalDocker.mount('/foo/bar.tiff');
|
|
39
|
-
|
|
36
|
+
o(gdalDocker.mounts).deepEquals(['/foo']);
|
|
40
37
|
});
|
|
41
|
-
|
|
42
|
-
const gdalDocker = new
|
|
38
|
+
o('should ignore s3 uris', () => {
|
|
39
|
+
const gdalDocker = new GdalDocker();
|
|
43
40
|
gdalDocker.mount('s3://foo/bar.html');
|
|
44
41
|
gdalDocker.mount('s3://foo/bar.tiff');
|
|
45
|
-
|
|
42
|
+
o(gdalDocker.mounts).deepEquals([]);
|
|
46
43
|
});
|
|
47
|
-
|
|
48
|
-
const env =
|
|
49
|
-
|
|
44
|
+
o('should normalize aws environment vars', () => {
|
|
45
|
+
const env = normalizeAwsEnv({ AWS_PROFILE: 'lake' });
|
|
46
|
+
o(env).deepEquals({ AWS_PROFILE: 'lake', AWS_DEFAULT_PROFILE: 'lake' });
|
|
50
47
|
});
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
o('should error if aws config is not sane', () => {
|
|
49
|
+
o(() => normalizeAwsEnv({ AWS_PROFILE: 'lake', AWS_DEFAULT_PROFILE: 'other-lake' })).throws(Error);
|
|
53
50
|
});
|
|
54
51
|
});
|
package/build/gdal/gdal.cog.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { LogType } from '@basemaps/shared';
|
|
3
3
|
import { ChildProcessWithoutNullStreams } from 'child_process';
|
|
4
|
-
import { GdalCommand } from './gdal.command';
|
|
5
|
-
import { GdalCogBuilderOptions } from './gdal.config';
|
|
4
|
+
import { GdalCommand } from './gdal.command.js';
|
|
5
|
+
import { GdalCogBuilderOptions } from './gdal.config.js';
|
|
6
6
|
/** 1% Buffer to the tiff to help prevent gaps between tiles */
|
|
7
7
|
/**
|
|
8
8
|
* A docker based GDAL Cog Builder
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gdal.cog.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.cog.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"gdal.cog.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.cog.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAA0B,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEjF,+DAA+D;AAG/D;;;;;;GAMG;AACH,qBAAa,cAAc;IACzB,MAAM,EAAE,qBAAqB,CAAC;IAE9B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,8BAA8B,GAAG,IAAI,CAAC;IAC7C;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9B,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB;IACnB,IAAI,EAAE,WAAW,CAAC;gBAEN,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,qBAAqB,CAAM;IAmBvF,SAAS,IAAI,MAAM,EAAE;IAYrB,IAAI,kBAAkB,IAAI,MAAM,CAO/B;IAED,IAAI,IAAI,IAAI,MAAM,EAAE,CA+CnB;IAEK,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3C"}
|
package/build/gdal/gdal.cog.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const geo_1 = require("@basemaps/geo");
|
|
5
|
-
const gdal_1 = require("./gdal");
|
|
6
|
-
const gdal_config_1 = require("./gdal.config");
|
|
1
|
+
import { GoogleTms, Nztm2000Tms } from '@basemaps/geo';
|
|
2
|
+
import { Gdal } from './gdal.js';
|
|
3
|
+
import { GdalCogBuilderDefaults } from './gdal.config.js';
|
|
7
4
|
/** 1% Buffer to the tiff to help prevent gaps between tiles */
|
|
8
5
|
// const TiffBuffer = 1.01;
|
|
9
6
|
/**
|
|
@@ -13,22 +10,22 @@ const gdal_config_1 = require("./gdal.config");
|
|
|
13
10
|
*
|
|
14
11
|
* When GDAL 3.1 is released docker could be removed from this process.
|
|
15
12
|
*/
|
|
16
|
-
class GdalCogBuilder {
|
|
13
|
+
export class GdalCogBuilder {
|
|
17
14
|
constructor(source, target, config = {}) {
|
|
18
15
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
19
16
|
this.source = source;
|
|
20
17
|
this.target = target;
|
|
21
18
|
this.config = {
|
|
22
19
|
bbox: config.bbox,
|
|
23
|
-
alignmentLevels: (_a = config.alignmentLevels) !== null && _a !== void 0 ? _a :
|
|
24
|
-
compression: (_b = config.compression) !== null && _b !== void 0 ? _b :
|
|
25
|
-
tileMatrix: (_c = config.tileMatrix) !== null && _c !== void 0 ? _c :
|
|
26
|
-
resampling: (_d = config.resampling) !== null && _d !== void 0 ? _d :
|
|
27
|
-
blockSize: (_e = config.blockSize) !== null && _e !== void 0 ? _e :
|
|
28
|
-
targetRes: (_f = config.targetRes) !== null && _f !== void 0 ? _f :
|
|
29
|
-
quality: (_g = config.quality) !== null && _g !== void 0 ? _g :
|
|
20
|
+
alignmentLevels: (_a = config.alignmentLevels) !== null && _a !== void 0 ? _a : GdalCogBuilderDefaults.alignmentLevels,
|
|
21
|
+
compression: (_b = config.compression) !== null && _b !== void 0 ? _b : GdalCogBuilderDefaults.compression,
|
|
22
|
+
tileMatrix: (_c = config.tileMatrix) !== null && _c !== void 0 ? _c : GdalCogBuilderDefaults.tileMatrix,
|
|
23
|
+
resampling: (_d = config.resampling) !== null && _d !== void 0 ? _d : GdalCogBuilderDefaults.resampling,
|
|
24
|
+
blockSize: (_e = config.blockSize) !== null && _e !== void 0 ? _e : GdalCogBuilderDefaults.blockSize,
|
|
25
|
+
targetRes: (_f = config.targetRes) !== null && _f !== void 0 ? _f : GdalCogBuilderDefaults.targetRes,
|
|
26
|
+
quality: (_g = config.quality) !== null && _g !== void 0 ? _g : GdalCogBuilderDefaults.quality,
|
|
30
27
|
};
|
|
31
|
-
this.gdal =
|
|
28
|
+
this.gdal = Gdal.create();
|
|
32
29
|
(_j = (_h = this.gdal).mount) === null || _j === void 0 ? void 0 : _j.call(_h, source);
|
|
33
30
|
(_l = (_k = this.gdal).mount) === null || _l === void 0 ? void 0 : _l.call(_k, target);
|
|
34
31
|
}
|
|
@@ -43,9 +40,9 @@ class GdalCogBuilder {
|
|
|
43
40
|
get tileMatrixFileName() {
|
|
44
41
|
const tileMatrix = this.config.tileMatrix;
|
|
45
42
|
// Gdal built in TileMatrixSets
|
|
46
|
-
if (tileMatrix.identifier ===
|
|
43
|
+
if (tileMatrix.identifier === GoogleTms.identifier)
|
|
47
44
|
return 'GoogleMapsCompatible';
|
|
48
|
-
if (tileMatrix.identifier ===
|
|
45
|
+
if (tileMatrix.identifier === Nztm2000Tms.identifier)
|
|
49
46
|
return 'NZTM2000';
|
|
50
47
|
return 'https://raw.githubusercontent.com/linz/NZTM2000TileMatrixSet/master/raw/NZTM2000Quad.json';
|
|
51
48
|
}
|
|
@@ -100,4 +97,3 @@ class GdalCogBuilder {
|
|
|
100
97
|
await this.gdal.run('gdal_translate', this.args, log);
|
|
101
98
|
}
|
|
102
99
|
}
|
|
103
|
-
exports.GdalCogBuilder = GdalCogBuilder;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { LogType } from '@basemaps/shared';
|
|
3
3
|
import { ChildProcessWithoutNullStreams } from 'child_process';
|
|
4
|
-
import { GdalProgressParser } from './gdal.progress';
|
|
4
|
+
import { GdalProgressParser } from './gdal.progress.js';
|
|
5
5
|
/**
|
|
6
6
|
* GDAL uses AWS_DEFAULT_PROFILE while node uses AWS_PROFILE
|
|
7
7
|
* this validates the configuration is sane
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gdal.command.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.command.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAS,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"gdal.command.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.command.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAS,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAY3G;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,IAAI,OAAO,CAAC;IACxB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,8BAAsB,WAAW;IAC/B,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,SAAS,CAAC,KAAK,EAAE,8BAA8B,CAAC;IAChD,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAE5B,kBAAkB;IAClB,SAAS,CAAC,WAAW,CAAC,EAAE,eAAe,CAAC;IAExC,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAC3B,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAEnD,8CAA8C;IAC9C,cAAc,CAAC,WAAW,CAAC,EAAE,eAAe,GAAG,IAAI;IAInD;;;;;OAKG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CA4DlG"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GdalCommand = exports.normalizeAwsEnv = void 0;
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
1
|
+
import { spawn } from 'child_process';
|
|
5
2
|
/**
|
|
6
3
|
* GDAL uses AWS_DEFAULT_PROFILE while node uses AWS_PROFILE
|
|
7
4
|
* this validates the configuration is sane
|
|
8
5
|
*
|
|
9
6
|
* @param env environment to normalize
|
|
10
7
|
*/
|
|
11
|
-
function normalizeAwsEnv(env) {
|
|
8
|
+
export function normalizeAwsEnv(env) {
|
|
12
9
|
const awsProfile = env['AWS_PROFILE'];
|
|
13
10
|
const awsDefaultProfile = env['AWS_DEFAULT_PROFILE'];
|
|
14
11
|
if (awsProfile == null)
|
|
@@ -21,8 +18,7 @@ function normalizeAwsEnv(env) {
|
|
|
21
18
|
}
|
|
22
19
|
return env;
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
class GdalCommand {
|
|
21
|
+
export class GdalCommand {
|
|
26
22
|
/** Pass AWS credentials into the container */
|
|
27
23
|
setCredentials(credentials) {
|
|
28
24
|
this.credentials = credentials;
|
|
@@ -40,7 +36,7 @@ class GdalCommand {
|
|
|
40
36
|
(_a = this.parser) === null || _a === void 0 ? void 0 : _a.reset();
|
|
41
37
|
this.startTime = Date.now();
|
|
42
38
|
const env = normalizeAwsEnv(this.env ? await this.env() : process.env);
|
|
43
|
-
const child =
|
|
39
|
+
const child = spawn(cmd, args, { env });
|
|
44
40
|
this.child = child;
|
|
45
41
|
const outputBuff = [];
|
|
46
42
|
const errBuff = [];
|
|
@@ -88,4 +84,3 @@ class GdalCommand {
|
|
|
88
84
|
return this.promise;
|
|
89
85
|
}
|
|
90
86
|
}
|
|
91
|
-
exports.GdalCommand = GdalCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gdal.config.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,oBAAY,+BAA+B,
|
|
1
|
+
{"version":3,"file":"gdal.config.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,oBAAY,+BAA+B,GACvC,SAAS,GACT,UAAU,GACV,OAAO,GACP,aAAa,GACb,SAAS,GACT,SAAS,GACT,MAAM,CAAC;AAEX,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,IAAI,EAAE,+BAA+B,CAAC;IACtC;;;OAGG;IACH,QAAQ,EAAE,+BAA+B,CAAC;CAC3C;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,UAAU,EAAE,aAAa,CAAC;IAC1B;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;OACG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;OAGG;IACH,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAE7B;;OAEG;IACH,UAAU,EAAE,wBAAwB,CAAC;IACrC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,sBAAsB,EAAE,qBAWpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,+BAA+B,CAQjF,CAAC"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.GdalResamplingOptions = exports.GdalCogBuilderDefaults = void 0;
|
|
4
|
-
const geo_1 = require("@basemaps/geo");
|
|
5
|
-
exports.GdalCogBuilderDefaults = {
|
|
1
|
+
import { GoogleTms } from '@basemaps/geo';
|
|
2
|
+
export const GdalCogBuilderDefaults = {
|
|
6
3
|
resampling: {
|
|
7
4
|
warp: 'bilinear',
|
|
8
5
|
overview: 'lanczos',
|
|
9
6
|
},
|
|
10
7
|
compression: 'webp',
|
|
11
|
-
tileMatrix:
|
|
8
|
+
tileMatrix: GoogleTms,
|
|
12
9
|
alignmentLevels: 1,
|
|
13
10
|
targetRes: 0,
|
|
14
11
|
blockSize: 512,
|
|
15
12
|
quality: 90,
|
|
16
13
|
};
|
|
17
|
-
|
|
14
|
+
export const GdalResamplingOptions = {
|
|
18
15
|
nearest: 'nearest',
|
|
19
16
|
bilinear: 'bilinear',
|
|
20
17
|
cubic: 'cubic',
|
package/build/gdal/gdal.d.ts
CHANGED
package/build/gdal/gdal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gdal.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"gdal.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,qBAAa,IAAI;IACf;;;;;OAKG;IACH,MAAM,CAAC,MAAM,IAAI,WAAW;IAK5B;;;;;OAKG;WACU,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;CAKvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gdal.docker.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.docker.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"gdal.docker.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.docker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,qBAAa,UAAW,SAAQ,WAAW;IACzC,MAAM,EAAE,MAAM,EAAE,CAAC;;IAOjB,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ7B,OAAO,CAAC,SAAS;YAYH,cAAc;IAiB5B,6DAA6D;YAC/C,aAAa;IAoB3B,uFAAuF;IACvF,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAO5B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAalG"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const os = tslib_1.__importStar(require("os"));
|
|
7
|
-
const path = tslib_1.__importStar(require("path"));
|
|
8
|
-
const gdal_command_1 = require("./gdal.command");
|
|
9
|
-
class GdalDocker extends gdal_command_1.GdalCommand {
|
|
1
|
+
import { Env } from '@basemaps/shared';
|
|
2
|
+
import * as os from 'os';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import { GdalCommand } from './gdal.command.js';
|
|
5
|
+
export class GdalDocker extends GdalCommand {
|
|
10
6
|
constructor() {
|
|
11
7
|
super();
|
|
12
8
|
this.mounts = [];
|
|
13
9
|
}
|
|
14
10
|
mount(filePath) {
|
|
15
|
-
if (
|
|
11
|
+
if (filePath.startsWith('s3://'))
|
|
16
12
|
return;
|
|
17
13
|
const basePath = path.dirname(filePath);
|
|
18
14
|
if (this.mounts.includes(basePath))
|
|
@@ -49,8 +45,8 @@ class GdalDocker extends gdal_command_1.GdalCommand {
|
|
|
49
45
|
/** this could contain sensitive info like AWS access keys */
|
|
50
46
|
async getDockerArgs() {
|
|
51
47
|
var _a, _b;
|
|
52
|
-
const DOCKER_CONTAINER = (_a =
|
|
53
|
-
const DOCKER_CONTAINER_TAG = (_b =
|
|
48
|
+
const DOCKER_CONTAINER = (_a = Env.get(Env.Gdal.DockerContainer)) !== null && _a !== void 0 ? _a : 'osgeo/gdal';
|
|
49
|
+
const DOCKER_CONTAINER_TAG = (_b = Env.get(Env.Gdal.DockerContainerTag)) !== null && _b !== void 0 ? _b : 'ubuntu-small-3.3.0';
|
|
54
50
|
const userInfo = os.userInfo();
|
|
55
51
|
const credentials = await this.getCredentials();
|
|
56
52
|
return [
|
|
@@ -83,4 +79,3 @@ class GdalDocker extends gdal_command_1.GdalCommand {
|
|
|
83
79
|
return super.run('docker', [...dockerArgs, cmd, ...args], log);
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
|
-
exports.GdalDocker = GdalDocker;
|
package/build/gdal/gdal.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const gdal_docker_1 = require("./gdal.docker");
|
|
6
|
-
const gdal_local_1 = require("./gdal.local");
|
|
7
|
-
class Gdal {
|
|
1
|
+
import { Env } from '@basemaps/shared';
|
|
2
|
+
import { GdalDocker } from './gdal.docker.js';
|
|
3
|
+
import { GdalLocal } from './gdal.local.js';
|
|
4
|
+
export class Gdal {
|
|
8
5
|
/**
|
|
9
6
|
* Create a new GdalCommand instance ready to run commands
|
|
10
7
|
*
|
|
@@ -12,9 +9,9 @@ class Gdal {
|
|
|
12
9
|
* @see Env.Gdal.UseDocker
|
|
13
10
|
*/
|
|
14
11
|
static create() {
|
|
15
|
-
if (
|
|
16
|
-
return new
|
|
17
|
-
return new
|
|
12
|
+
if (Env.get(Env.Gdal.UseDocker))
|
|
13
|
+
return new GdalDocker();
|
|
14
|
+
return new GdalLocal();
|
|
18
15
|
}
|
|
19
16
|
/**
|
|
20
17
|
* Run a `gdal_translate --version` to extract the current gdal version
|
|
@@ -28,4 +25,3 @@ class Gdal {
|
|
|
28
25
|
return stdout;
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
|
-
exports.Gdal = Gdal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogType } from '@basemaps/shared';
|
|
2
|
-
import { GdalCommand } from './gdal.command';
|
|
2
|
+
import { GdalCommand } from './gdal.command.js';
|
|
3
3
|
export declare class GdalLocal extends GdalCommand {
|
|
4
4
|
env(): Promise<Record<string, string | undefined>>;
|
|
5
5
|
run(cmd: string, args: string[], log: LogType): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gdal.local.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"gdal.local.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,qBAAa,SAAU,SAAQ,WAAW;IAClC,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAelD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAIlG"}
|
package/build/gdal/gdal.local.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.GdalLocal = void 0;
|
|
4
|
-
const gdal_command_1 = require("./gdal.command");
|
|
5
|
-
class GdalLocal extends gdal_command_1.GdalCommand {
|
|
1
|
+
import { GdalCommand } from './gdal.command.js';
|
|
2
|
+
export class GdalLocal extends GdalCommand {
|
|
6
3
|
async env() {
|
|
7
4
|
if (this.credentials == null) {
|
|
8
5
|
return process.env;
|
|
@@ -22,4 +19,3 @@ class GdalLocal extends gdal_command_1.GdalCommand {
|
|
|
22
19
|
return super.run(cmd, args, log);
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
|
-
exports.GdalLocal = GdalLocal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gdal.progress.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.progress.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;
|
|
1
|
+
{"version":3,"file":"gdal.progress.d.ts","sourceRoot":"","sources":["../../src/gdal/gdal.progress.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAElD,WAAW,UAAQ;IACnB,QAAQ,SAAK;IACb,SAAS,SAAK;IAEd,iCAAiC;IACjC,KAAK,IAAI,IAAI;IAMb,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CA6BzB"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GdalProgressParser = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
5
2
|
/**
|
|
6
3
|
* Emit a "progress" event every time a "." is recorded in the output
|
|
7
4
|
*/
|
|
8
|
-
class GdalProgressParser extends
|
|
5
|
+
export class GdalProgressParser extends EventEmitter {
|
|
9
6
|
constructor() {
|
|
10
7
|
super(...arguments);
|
|
11
8
|
// Progress starts with "Input file size is .., ..\n"
|
|
@@ -50,4 +47,3 @@ class GdalProgressParser extends events_1.EventEmitter {
|
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
exports.GdalProgressParser = GdalProgressParser;
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { CogBuilder } from './cog/builder';
|
|
2
|
-
export { CogJobFactory } from './cog/job.factory';
|
|
3
|
-
export { Gdal } from './gdal/gdal';
|
|
4
|
-
export { GdalCogBuilder } from './gdal/gdal.cog';
|
|
5
|
-
export { GdalCogBuilderOptions } from './gdal/gdal.config';
|
|
1
|
+
export { CogBuilder } from './cog/builder.js';
|
|
2
|
+
export { CogJobFactory } from './cog/job.factory.js';
|
|
3
|
+
export { Gdal } from './gdal/gdal.js';
|
|
4
|
+
export { GdalCogBuilder } from './gdal/gdal.cog.js';
|
|
5
|
+
export { GdalCogBuilderOptions } from './gdal/gdal.config.js';
|
|
6
6
|
//# 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":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GdalCogBuilder = exports.Gdal = exports.CogJobFactory = exports.CogBuilder = void 0;
|
|
4
1
|
// export * from './cli/basemaps/tileset.updater';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var gdal_1 = require("./gdal/gdal");
|
|
10
|
-
Object.defineProperty(exports, "Gdal", { enumerable: true, get: function () { return gdal_1.Gdal; } });
|
|
11
|
-
var gdal_cog_1 = require("./gdal/gdal.cog");
|
|
12
|
-
Object.defineProperty(exports, "GdalCogBuilder", { enumerable: true, get: function () { return gdal_cog_1.GdalCogBuilder; } });
|
|
2
|
+
export { CogBuilder } from './cog/builder.js';
|
|
3
|
+
export { CogJobFactory } from './cog/job.factory.js';
|
|
4
|
+
export { Gdal } from './gdal/gdal.js';
|
|
5
|
+
export { GdalCogBuilder } from './gdal/gdal.cog.js';
|
package/{cogify → cogify.js}
RENAMED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basemaps/cli",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"main": "./build/index.js",
|
|
17
17
|
"types": "./build/index.d.ts",
|
|
18
18
|
"bin": {
|
|
19
|
-
"cogify": "./cogify",
|
|
20
|
-
"basemaps": "./basemaps"
|
|
19
|
+
"cogify": "./cogify.js",
|
|
20
|
+
"basemaps": "./basemaps.js"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc",
|
|
@@ -33,19 +33,21 @@
|
|
|
33
33
|
]
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
|
+
"type": "module",
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
39
|
+
},
|
|
36
40
|
"dependencies": {
|
|
37
|
-
"@basemaps/config": "^6.
|
|
38
|
-
"@basemaps/geo": "^6.
|
|
39
|
-
"@basemaps/shared": "^6.
|
|
40
|
-
"@
|
|
41
|
-
"@cogeotiff/
|
|
42
|
-
"@
|
|
43
|
-
"@cogeotiff/source-url": "^4.3.0",
|
|
44
|
-
"@linzjs/geojson": "^6.9.1",
|
|
41
|
+
"@basemaps/config": "^6.10.0",
|
|
42
|
+
"@basemaps/geo": "^6.10.0",
|
|
43
|
+
"@basemaps/shared": "^6.10.0",
|
|
44
|
+
"@chunkd/fs": "^7.3.1",
|
|
45
|
+
"@cogeotiff/core": "^6.0.2",
|
|
46
|
+
"@linzjs/geojson": "^6.10.0",
|
|
45
47
|
"@rushstack/ts-command-line": "^4.3.13",
|
|
46
48
|
"ansi-colors": "^4.1.1",
|
|
47
49
|
"p-limit": "^3.0.1",
|
|
48
|
-
"pretty-json-log": "^0.
|
|
50
|
+
"pretty-json-log": "^1.0.0",
|
|
49
51
|
"zod": "^3.2.0"
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
@@ -58,5 +60,5 @@
|
|
|
58
60
|
"files": [
|
|
59
61
|
"build/"
|
|
60
62
|
],
|
|
61
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "c88706ff58f4dfe83bf2b757d1483194accdb4c9"
|
|
62
64
|
}
|
package/basemaps
DELETED