@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.
Files changed (99) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/basemaps.js +2 -0
  3. package/build/cli/base.cli.d.ts +1 -1
  4. package/build/cli/base.cli.d.ts.map +1 -1
  5. package/build/cli/base.cli.js +25 -27
  6. package/build/cli/basemaps/action.invalidate.d.ts +1 -1
  7. package/build/cli/basemaps/action.invalidate.d.ts.map +1 -1
  8. package/build/cli/basemaps/action.invalidate.js +14 -18
  9. package/build/cli/basemaps/action.tileset.info.d.ts +1 -1
  10. package/build/cli/basemaps/action.tileset.info.d.ts.map +1 -1
  11. package/build/cli/basemaps/action.tileset.info.js +18 -23
  12. package/build/cli/basemaps/index.d.ts +2 -2
  13. package/build/cli/basemaps/index.d.ts.map +1 -1
  14. package/build/cli/basemaps/index.js +10 -14
  15. package/build/cli/basemaps/tileset.action.d.ts.map +1 -1
  16. package/build/cli/basemaps/tileset.action.js +4 -8
  17. package/build/cli/basemaps/tileset.util.d.ts +1 -13
  18. package/build/cli/basemaps/tileset.util.d.ts.map +1 -1
  19. package/build/cli/basemaps/tileset.util.js +20 -63
  20. package/build/cli/cli.table.d.ts.map +1 -1
  21. package/build/cli/cli.table.js +2 -7
  22. package/build/cli/cogify/__test__/action.batch.test.js +11 -14
  23. package/build/cli/cogify/__test__/semver.test.js +50 -53
  24. package/build/cli/cogify/action.batch.d.ts +2 -2
  25. package/build/cli/cogify/action.batch.d.ts.map +1 -1
  26. package/build/cli/cogify/action.batch.js +16 -22
  27. package/build/cli/cogify/action.cog.d.ts +1 -1
  28. package/build/cli/cogify/action.cog.d.ts.map +1 -1
  29. package/build/cli/cogify/action.cog.js +29 -33
  30. package/build/cli/cogify/action.job.d.ts.map +1 -1
  31. package/build/cli/cogify/action.job.js +21 -26
  32. package/build/cli/cogify/index.d.ts +2 -2
  33. package/build/cli/cogify/index.d.ts.map +1 -1
  34. package/build/cli/cogify/index.js +9 -13
  35. package/build/cli/cogify/semver.util.d.ts.map +1 -1
  36. package/build/cli/cogify/semver.util.js +2 -5
  37. package/build/cli/folder.js +6 -11
  38. package/build/cli/tag.action.js +1 -4
  39. package/build/cli/util.js +11 -16
  40. package/build/cog/__test__/builder.test.js +31 -35
  41. package/build/cog/__test__/cog.stac.job.test.js +59 -62
  42. package/build/cog/__test__/cog.test.js +26 -29
  43. package/build/cog/__test__/cog.vrt.test.js +90 -90
  44. package/build/cog/__test__/cutline.test.js +71 -71
  45. package/build/cog/__test__/source.tiff.testhelper.d.ts +1 -1
  46. package/build/cog/__test__/source.tiff.testhelper.d.ts.map +1 -1
  47. package/build/cog/__test__/source.tiff.testhelper.js +6 -9
  48. package/build/cog/builder.d.ts +3 -3
  49. package/build/cog/builder.d.ts.map +1 -1
  50. package/build/cog/builder.js +43 -48
  51. package/build/cog/cog.d.ts +2 -2
  52. package/build/cog/cog.d.ts.map +1 -1
  53. package/build/cog/cog.js +15 -19
  54. package/build/cog/cog.stac.job.d.ts +10 -10
  55. package/build/cog/cog.stac.job.d.ts.map +1 -1
  56. package/build/cog/cog.stac.job.js +48 -52
  57. package/build/cog/cog.vrt.d.ts +2 -2
  58. package/build/cog/cog.vrt.d.ts.map +1 -1
  59. package/build/cog/cog.vrt.js +16 -18
  60. package/build/cog/constants.js +2 -5
  61. package/build/cog/cutline.d.ts +21 -21
  62. package/build/cog/cutline.d.ts.map +1 -1
  63. package/build/cog/cutline.js +53 -58
  64. package/build/cog/job.factory.d.ts +2 -2
  65. package/build/cog/job.factory.d.ts.map +1 -1
  66. package/build/cog/job.factory.js +25 -41
  67. package/build/cog/stac.d.ts +1 -1
  68. package/build/cog/stac.d.ts.map +1 -1
  69. package/build/cog/stac.js +2 -5
  70. package/build/cog/types.d.ts +1 -1
  71. package/build/cog/types.d.ts.map +1 -1
  72. package/build/cog/types.js +1 -2
  73. package/build/gdal/__test__/gdal.progress.test.js +11 -14
  74. package/build/gdal/__test__/gdal.test.js +35 -38
  75. package/build/gdal/gdal.cog.d.ts +2 -2
  76. package/build/gdal/gdal.cog.d.ts.map +1 -1
  77. package/build/gdal/gdal.cog.js +14 -18
  78. package/build/gdal/gdal.command.d.ts +1 -1
  79. package/build/gdal/gdal.command.d.ts.map +1 -1
  80. package/build/gdal/gdal.command.js +4 -9
  81. package/build/gdal/gdal.config.d.ts.map +1 -1
  82. package/build/gdal/gdal.config.js +4 -7
  83. package/build/gdal/gdal.d.ts +1 -1
  84. package/build/gdal/gdal.d.ts.map +1 -1
  85. package/build/gdal/gdal.docker.d.ts +1 -1
  86. package/build/gdal/gdal.docker.d.ts.map +1 -1
  87. package/build/gdal/gdal.docker.js +8 -13
  88. package/build/gdal/gdal.js +7 -11
  89. package/build/gdal/gdal.local.d.ts +1 -1
  90. package/build/gdal/gdal.local.d.ts.map +1 -1
  91. package/build/gdal/gdal.local.js +2 -6
  92. package/build/gdal/gdal.progress.d.ts.map +1 -1
  93. package/build/gdal/gdal.progress.js +2 -6
  94. package/build/index.d.ts +5 -5
  95. package/build/index.d.ts.map +1 -1
  96. package/build/index.js +4 -11
  97. package/{cogify → cogify.js} +1 -1
  98. package/package.json +15 -13
  99. package/basemaps +0 -2
package/build/cli/util.js CHANGED
@@ -1,44 +1,39 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invalidateCache = void 0;
4
- const tslib_1 = require("tslib");
5
- const shared_1 = require("@basemaps/shared");
6
- const cloudformation_1 = tslib_1.__importDefault(require("aws-sdk/clients/cloudformation"));
7
- const cloudfront_1 = tslib_1.__importDefault(require("aws-sdk/clients/cloudfront"));
8
- const base_cli_1 = require("./base.cli");
1
+ import { LogConfig } from '@basemaps/shared';
2
+ import CloudFormation from 'aws-sdk/clients/cloudformation.js';
3
+ import CloudFront from 'aws-sdk/clients/cloudfront.js';
4
+ import { CliId } from './base.cli.js';
9
5
  // Cloudfront has to be defined in us-east-1
10
- const cloudFormation = new cloudformation_1.default({ region: 'us-east-1' });
11
- const cloudFront = new cloudfront_1.default({ region: 'us-east-1' });
6
+ const cloudFormation = new CloudFormation({ region: 'us-east-1' });
7
+ const cloudFront = new CloudFront({ region: 'us-east-1' });
12
8
  /** cloudfront invalidation references need to be unique */
13
9
  let InvalidationId = 0;
14
10
  /**
15
11
  * Invalidate the cloudfront distribution cache when updating imagery sets
16
12
  */
17
- async function invalidateCache(path, commit = false) {
13
+ export async function invalidateCache(path, commit = false) {
18
14
  var _a, _b, _c;
19
15
  const stackInfo = await cloudFormation.describeStacks({ StackName: 'Edge' }).promise();
20
16
  if (((_a = stackInfo.Stacks) === null || _a === void 0 ? void 0 : _a[0].Outputs) == null) {
21
- shared_1.LogConfig.get().warn('Unable to find cloud front distribution');
17
+ LogConfig.get().warn('Unable to find cloud front distribution');
22
18
  return;
23
19
  }
24
20
  const cloudFrontDomain = stackInfo.Stacks[0].Outputs.find((f) => f.OutputKey === 'CloudFrontDomain');
25
21
  const cloudFrontDistributions = await cloudFront.listDistributions().promise();
26
22
  const cf = (_c = (_b = cloudFrontDistributions.DistributionList) === null || _b === void 0 ? void 0 : _b.Items) === null || _c === void 0 ? void 0 : _c.find((f) => f.DomainName === (cloudFrontDomain === null || cloudFrontDomain === void 0 ? void 0 : cloudFrontDomain.OutputValue));
27
23
  if (cloudFrontDomain == null || cf == null) {
28
- shared_1.LogConfig.get().warn('Unable to find cloud front distribution');
24
+ LogConfig.get().warn('Unable to find cloud front distribution');
29
25
  return;
30
26
  }
31
- shared_1.LogConfig.get().info({ path, cfId: cf.Id }, 'Invalidating');
27
+ LogConfig.get().info({ path, cfId: cf.Id }, 'Invalidating');
32
28
  if (commit) {
33
29
  await cloudFront
34
30
  .createInvalidation({
35
31
  DistributionId: cf.Id,
36
32
  InvalidationBatch: {
37
33
  Paths: { Quantity: 1, Items: [path] },
38
- CallerReference: `${base_cli_1.CliId}-${InvalidationId++}`,
34
+ CallerReference: `${CliId}-${InvalidationId++}`,
39
35
  },
40
36
  })
41
37
  .promise();
42
38
  }
43
39
  }
44
- exports.invalidateCache = invalidateCache;
@@ -1,39 +1,35 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const geo_1 = require("@basemaps/geo");
5
- const shared_1 = require("@basemaps/shared");
6
- const core_1 = require("@cogeotiff/core");
7
- const source_aws_1 = require("@cogeotiff/source-aws");
8
- const source_file_1 = require("@cogeotiff/source-file");
9
- const ospec_1 = tslib_1.__importDefault(require("ospec"));
10
- const builder_1 = require("../builder");
11
- ospec_1.default.spec('Builder', () => {
12
- ospec_1.default('should guess WKT', () => {
13
- ospec_1.default(builder_1.guessProjection('PCS Name = NZGD_2000_New_Zealand_Transverse_Mercator|GCS Name = GCS_NZGD_2000|Ellipsoid = GRS_1980|Primem = Greenwich||')).equals(geo_1.Epsg.Nztm2000);
14
- ospec_1.default(builder_1.guessProjection('NZGD2000_New_Zealand_Transverse_Mercator_2000|GCS Name = GCS_NZGD_2000|Primem = Greenwich||')).equals(geo_1.Epsg.Nztm2000);
1
+ import { Bounds, Epsg, EpsgCode, GoogleTms } from '@basemaps/geo';
2
+ import { LogConfig } from '@basemaps/shared';
3
+ import { fsa } from '@chunkd/fs';
4
+ import { CogTiff } from '@cogeotiff/core';
5
+ import o from 'ospec';
6
+ import { CogBuilder, guessProjection } from '../builder.js';
7
+ o.spec('Builder', () => {
8
+ o('should guess WKT', () => {
9
+ o(guessProjection('PCS Name = NZGD_2000_New_Zealand_Transverse_Mercator|GCS Name = GCS_NZGD_2000|Ellipsoid = GRS_1980|Primem = Greenwich||')).equals(Epsg.Nztm2000);
10
+ o(guessProjection('NZGD2000_New_Zealand_Transverse_Mercator_2000|GCS Name = GCS_NZGD_2000|Primem = Greenwich||')).equals(Epsg.Nztm2000);
15
11
  });
16
- ospec_1.default('should not guess unknown wkt', () => {
17
- ospec_1.default(builder_1.guessProjection('')).equals(null);
18
- ospec_1.default(builder_1.guessProjection('NZTM')).equals(null);
19
- ospec_1.default(builder_1.guessProjection('NZGD2000')).equals(null);
12
+ o('should not guess unknown wkt', () => {
13
+ o(guessProjection('')).equals(null);
14
+ o(guessProjection('NZTM')).equals(null);
15
+ o(guessProjection('NZGD2000')).equals(null);
20
16
  });
21
- ospec_1.default.spec('tiff', () => {
22
- const googleBuilder = new builder_1.CogBuilder(geo_1.GoogleTms, 1, shared_1.LogConfig.get());
23
- const origInit = core_1.CogTiff.prototype.init;
24
- const origGetImage = core_1.CogTiff.prototype.getImage;
25
- ospec_1.default.after(() => {
26
- core_1.CogTiff.prototype.init = origInit;
27
- core_1.CogTiff.prototype.getImage = origGetImage;
17
+ o.spec('tiff', () => {
18
+ const googleBuilder = new CogBuilder(GoogleTms, 1, LogConfig.get());
19
+ const origInit = CogTiff.prototype.init;
20
+ const origGetImage = CogTiff.prototype.getImage;
21
+ o.after(() => {
22
+ CogTiff.prototype.init = origInit;
23
+ CogTiff.prototype.getImage = origGetImage;
28
24
  });
29
- ospec_1.default('bounds', async () => {
30
- const localTiff = new source_file_1.SourceFile('/local/file.tiff');
31
- const s3Tiff = new source_aws_1.SourceAwsS3('bucket', 'file.tiff', null);
25
+ o('bounds', async () => {
26
+ const localTiff = fsa.source('/local/file.tiff');
27
+ const s3Tiff = fsa.source('s3://bucket/file.tiff');
32
28
  const imageLocal = {
33
29
  resolution: [0.1],
34
30
  value: () => [1],
35
- valueGeo: () => geo_1.EpsgCode.Nztm2000,
36
- bbox: geo_1.Bounds.fromJson({
31
+ valueGeo: () => EpsgCode.Nztm2000,
32
+ bbox: Bounds.fromJson({
37
33
  x: 1492000,
38
34
  y: 6198000,
39
35
  width: 24000,
@@ -43,20 +39,20 @@ ospec_1.default.spec('Builder', () => {
43
39
  const imageS3 = {
44
40
  resolution: [0.1],
45
41
  value: () => [1],
46
- valueGeo: () => geo_1.EpsgCode.Nztm2000,
47
- bbox: geo_1.Bounds.fromJson({
42
+ valueGeo: () => EpsgCode.Nztm2000,
43
+ bbox: Bounds.fromJson({
48
44
  x: 1492000 + 24000,
49
45
  y: 6198000,
50
46
  width: 24000,
51
47
  height: 36000,
52
48
  }).toBbox(),
53
49
  };
54
- core_1.CogTiff.prototype.init = ospec_1.default.spy();
55
- core_1.CogTiff.prototype.getImage = function () {
50
+ CogTiff.prototype.init = o.spy();
51
+ CogTiff.prototype.getImage = function () {
56
52
  return this.source === localTiff ? imageLocal : imageS3;
57
53
  };
58
54
  const ans = await googleBuilder.bounds([localTiff, s3Tiff]);
59
- ospec_1.default(ans).deepEquals({
55
+ o(ans).deepEquals({
60
56
  projection: 2193,
61
57
  nodata: 1,
62
58
  bands: 1,
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const geo_1 = require("@basemaps/geo");
5
- const shared_1 = require("@basemaps/shared");
6
- const file_operator_test_helper_1 = require("@basemaps/shared/build/file/__test__/file.operator.test.helper");
7
- const rounding_1 = require("@basemaps/test/build/rounding");
8
- const ospec_1 = tslib_1.__importDefault(require("ospec"));
9
- const cog_stac_job_1 = require("../cog.stac.job");
10
- ospec_1.default.spec('CogJob', () => {
11
- ospec_1.default.spec('build', () => {
1
+ import { Bounds, Epsg, EpsgCode, GoogleTms, Nztm2000Tms, Stac } from '@basemaps/geo';
2
+ import { Projection } from '@basemaps/shared';
3
+ import { mockFileOperator } from '@basemaps/shared/build/file/__test__/file.operator.test.helper.js';
4
+ import { round } from '@basemaps/test/build/rounding.js';
5
+ import o from 'ospec';
6
+ import { CogStacJob } from '../cog.stac.job.js';
7
+ o.spec('CogJob', () => {
8
+ o.spec('build', () => {
12
9
  const id = 'jobid1';
13
10
  const imageryName = 'auckland_rural_2010-2012_0-50m';
14
11
  const jobPath = 's3://target-bucket/path/3857/auckland_rural_2010-2012_0-50m/jobid1';
@@ -18,19 +15,19 @@ ospec_1.default.spec('CogJob', () => {
18
15
  [-177, -42],
19
16
  [175, -42],
20
17
  [170, -41],
21
- ].map(shared_1.Projection.get(geo_1.Epsg.Nztm2000).fromWgs84);
18
+ ].map(Projection.get(Epsg.Nztm2000).fromWgs84);
22
19
  const ring2 = [
23
20
  [-150, -40],
24
21
  [-140, -41],
25
22
  [-150, -41],
26
23
  [-150, -40],
27
- ].map(shared_1.Projection.get(geo_1.Epsg.Nztm2000).fromWgs84);
24
+ ].map(Projection.get(Epsg.Nztm2000).fromWgs84);
28
25
  const srcPoly = [[ring1], [ring2]];
29
- const bounds = srcPoly.map((poly, i) => ({ ...geo_1.Bounds.fromMultiPolygon([poly]), name: 'ring' + i }));
26
+ const bounds = srcPoly.map((poly, i) => ({ ...Bounds.fromMultiPolygon([poly]), name: 'ring' + i }));
30
27
  const metadata = {
31
28
  bands: 3,
32
29
  bounds,
33
- projection: geo_1.EpsgCode.Nztm2000,
30
+ projection: EpsgCode.Nztm2000,
34
31
  pixelScale: 0.075,
35
32
  resZoom: 22,
36
33
  nodata: 0,
@@ -39,16 +36,16 @@ ospec_1.default.spec('CogJob', () => {
39
36
  };
40
37
  const addAlpha = true;
41
38
  const ctx = {
42
- tileMatrix: geo_1.GoogleTms,
39
+ tileMatrix: GoogleTms,
43
40
  sourceLocation: { type: 's3', path: 's3://source-bucket/path' },
44
41
  outputLocation: { type: 's3', path: 's3://target-bucket/path' },
45
42
  cutline: { blend: 20, href: 's3://curline-bucket/path' },
46
43
  oneCogCovering: false,
47
44
  };
48
- const mockFs = file_operator_test_helper_1.mockFileOperator();
49
- ospec_1.default.beforeEach(mockFs.setup);
50
- ospec_1.default.afterEach(mockFs.teardown);
51
- ospec_1.default('with job.json', async () => {
45
+ const mockFs = mockFileOperator();
46
+ o.beforeEach(mockFs.setup);
47
+ o.afterEach(mockFs.teardown);
48
+ o('with job.json', async () => {
52
49
  mockFs.jsStore['s3://source-bucket/path/collection.json'] = {
53
50
  title: 'The Title',
54
51
  description: 'The Description',
@@ -63,34 +60,34 @@ ospec_1.default.spec('CogJob', () => {
63
60
  { name: 'unknown url', roles: ['processor'], url: 'unknown' },
64
61
  ],
65
62
  };
66
- const job = await cog_stac_job_1.CogStacJob.create({ id, imageryName, metadata, ctx, addAlpha, cutlinePoly: [] });
67
- ospec_1.default(job.getJobPath('job.json')).equals(jobPath + '/job.json');
68
- ospec_1.default(job.title).equals('The Title');
69
- ospec_1.default(job.description).equals('The Description');
70
- const stac = rounding_1.round(mockFs.jsStore[jobPath + '/collection.json'], 4);
71
- ospec_1.default(stac.title).equals('The Title');
72
- ospec_1.default(stac.description).equals('The Description');
73
- ospec_1.default(stac.license).equals('The License');
74
- ospec_1.default(stac.keywords).deepEquals(['keywords']);
75
- ospec_1.default(stac.providers).deepEquals([
63
+ const job = await CogStacJob.create({ id, imageryName, metadata, ctx, addAlpha, cutlinePoly: [] });
64
+ o(job.getJobPath('job.json')).equals(jobPath + '/job.json');
65
+ o(job.title).equals('The Title');
66
+ o(job.description).equals('The Description');
67
+ const stac = round(mockFs.jsStore[jobPath + '/collection.json'], 4);
68
+ o(stac.title).equals('The Title');
69
+ o(stac.description).equals('The Description');
70
+ o(stac.license).equals('The License');
71
+ o(stac.keywords).deepEquals(['keywords']);
72
+ o(stac.providers).deepEquals([
76
73
  { name: 'provider name', roles: ['licensor'], url: 'https://provider.com' },
77
74
  { name: 'unknown url', roles: ['processor'], url: undefined },
78
75
  ]);
79
- ospec_1.default(stac.links[2]).deepEquals({
76
+ o(stac.links[2]).deepEquals({
80
77
  href: 's3://source-bucket/path/collection.json',
81
78
  rel: 'sourceImagery',
82
79
  type: 'application/json',
83
80
  });
84
- ospec_1.default(rounding_1.round(stac.extent, 4)).deepEquals({
81
+ o(round(stac.extent, 4)).deepEquals({
85
82
  spatial: { bbox: [[169.3341, -51.8754, -146.1432, -32.8952]] },
86
83
  temporal: {
87
84
  interval: [['2020-01-01T00:00:00.000', '2020-08-08T19:18:23.456Z']],
88
85
  },
89
86
  });
90
87
  });
91
- ospec_1.default('no source collection.json', async () => {
88
+ o('no source collection.json', async () => {
92
89
  const startNow = Date.now();
93
- const job = await cog_stac_job_1.CogStacJob.create({
90
+ const job = await CogStacJob.create({
94
91
  id,
95
92
  imageryName,
96
93
  metadata,
@@ -99,8 +96,8 @@ ospec_1.default.spec('CogJob', () => {
99
96
  cutlinePoly: [],
100
97
  });
101
98
  const afterNow = Date.now();
102
- ospec_1.default(job.json).equals(mockFs.jsStore[jobPath + '/job.json']);
103
- ospec_1.default(rounding_1.round(job.json, 4)).deepEquals({
99
+ o(job.json).equals(mockFs.jsStore[jobPath + '/job.json']);
100
+ o(round(job.json, 4)).deepEquals({
104
101
  id: 'jobid1',
105
102
  name: 'auckland_rural_2010-2012_0-50m',
106
103
  title: 'Auckland rural 2010-2012 0.50m',
@@ -141,28 +138,28 @@ ospec_1.default.spec('CogJob', () => {
141
138
  oneCogCovering: true,
142
139
  },
143
140
  });
144
- ospec_1.default(job.id).equals(id);
145
- ospec_1.default(job.source.gsd).equals(0.075);
146
- ospec_1.default(rounding_1.round(job.output.gsd, 4)).equals(0.0373);
147
- ospec_1.default(job.output.oneCogCovering).equals(true);
148
- const stac = rounding_1.round(mockFs.jsStore[jobPath + '/collection.json'], 4);
141
+ o(job.id).equals(id);
142
+ o(job.source.gsd).equals(0.075);
143
+ o(round(job.output.gsd, 4)).equals(0.0373);
144
+ o(job.output.oneCogCovering).equals(true);
145
+ const stac = round(mockFs.jsStore[jobPath + '/collection.json'], 4);
149
146
  const stacMeta = stac.summaries;
150
147
  const generated = stacMeta['linz:generated'][0];
151
148
  const jobNow = +Date.parse(generated.datetime);
152
- ospec_1.default(startNow <= jobNow && jobNow <= afterNow).equals(true);
149
+ o(startNow <= jobNow && jobNow <= afterNow).equals(true);
153
150
  // split so that scripts/detect.unlinked.dep.js does not think it is an import
154
- ospec_1.default(generated.package).equals('@' + 'basemaps/cli');
151
+ o(generated.package).equals('@' + 'basemaps/cli');
155
152
  const exp = {
156
153
  id: 'jobid1',
157
154
  title: 'Auckland rural 2010-2012 0.50m',
158
155
  description: 'No description',
159
- stac_version: geo_1.Stac.Version,
160
- stac_extensions: [geo_1.Stac.BaseMapsExtension],
156
+ stac_version: Stac.Version,
157
+ stac_extensions: [Stac.BaseMapsExtension],
161
158
  extent: {
162
159
  spatial: { bbox: [[169.3341, -51.8754, -146.1432, -32.8952]] },
163
160
  temporal: { interval: [['2010-01-01T00:00:00Z', '2011-01-01T00:00:00Z']] },
164
161
  },
165
- license: geo_1.Stac.License,
162
+ license: Stac.License,
166
163
  keywords: ['Imagery', 'New Zealand'],
167
164
  providers: [],
168
165
  summaries: {
@@ -208,8 +205,8 @@ ospec_1.default.spec('CogJob', () => {
208
205
  { href: '0-0-0.json', type: 'application/geo+json', rel: 'item' },
209
206
  ],
210
207
  };
211
- ospec_1.default(stac).deepEquals(exp);
212
- ospec_1.default(rounding_1.round(mockFs.jsStore[jobPath + '/cutline.geojson.gz'], 4)).deepEquals({
208
+ o(stac).deepEquals(exp);
209
+ o(round(mockFs.jsStore[jobPath + '/cutline.geojson.gz'], 4)).deepEquals({
213
210
  type: 'FeatureCollection',
214
211
  features: [
215
212
  {
@@ -223,7 +220,7 @@ ospec_1.default.spec('CogJob', () => {
223
220
  properties: { name: 'urn:ogc:def:crs:EPSG::3857' },
224
221
  },
225
222
  });
226
- ospec_1.default(rounding_1.round(mockFs.jsStore[jobPath + '/0-0-0.json'], 4)).deepEquals({
223
+ o(round(mockFs.jsStore[jobPath + '/0-0-0.json'], 4)).deepEquals({
227
224
  type: 'Feature',
228
225
  geometry: {
229
226
  type: 'Polygon',
@@ -246,7 +243,7 @@ ospec_1.default.spec('CogJob', () => {
246
243
  bbox: [0, 0, 0, 0],
247
244
  id: 'jobid1/0-0-0',
248
245
  collection: 'jobid1',
249
- stac_version: geo_1.Stac.Version,
246
+ stac_version: Stac.Version,
250
247
  stac_extensions: ['projection'],
251
248
  links: [
252
249
  { href: jobPath + '/0-0-0.json', rel: 'self' },
@@ -260,7 +257,7 @@ ospec_1.default.spec('CogJob', () => {
260
257
  },
261
258
  },
262
259
  });
263
- ospec_1.default(rounding_1.round(mockFs.jsStore[jobPath + '/covering.geojson'], 4)).deepEquals({
260
+ o(round(mockFs.jsStore[jobPath + '/covering.geojson'], 4)).deepEquals({
264
261
  type: 'FeatureCollection',
265
262
  features: [
266
263
  {
@@ -282,7 +279,7 @@ ospec_1.default.spec('CogJob', () => {
282
279
  },
283
280
  ],
284
281
  });
285
- ospec_1.default(rounding_1.round(mockFs.jsStore[jobPath + '/source.geojson'], 4)).deepEquals({
282
+ o(round(mockFs.jsStore[jobPath + '/source.geojson'], 4)).deepEquals({
286
283
  type: 'FeatureCollection',
287
284
  features: [
288
285
  {
@@ -333,19 +330,19 @@ ospec_1.default.spec('CogJob', () => {
333
330
  ],
334
331
  });
335
332
  });
336
- ospec_1.default('should create with no tileMatrix', () => {
333
+ o('should create with no tileMatrix', () => {
337
334
  const cfg = { output: { epsg: 2193 } };
338
- const job = new cog_stac_job_1.CogStacJob(cfg);
339
- ospec_1.default(job.tileMatrix.identifier).equals(geo_1.Nztm2000Tms.identifier);
335
+ const job = new CogStacJob(cfg);
336
+ o(job.tileMatrix.identifier).equals(Nztm2000Tms.identifier);
340
337
  });
341
- ospec_1.default('should error with invalid tileMatrix', () => {
338
+ o('should error with invalid tileMatrix', () => {
342
339
  const cfg = { output: { tileMatrix: 'None' } };
343
- const job = new cog_stac_job_1.CogStacJob(cfg);
344
- ospec_1.default(() => job.tileMatrix).throws('Failed to find TileMatrixSet "None"');
340
+ const job = new CogStacJob(cfg);
341
+ o(() => job.tileMatrix).throws('Failed to find TileMatrixSet "None"');
345
342
  });
346
- ospec_1.default('no source collection.json and not nice name', async () => {
343
+ o('no source collection.json and not nice name', async () => {
347
344
  try {
348
- await cog_stac_job_1.CogStacJob.create({
345
+ await CogStacJob.create({
349
346
  id,
350
347
  imageryName: 'yucky-name',
351
348
  metadata,
@@ -353,10 +350,10 @@ ospec_1.default.spec('CogJob', () => {
353
350
  addAlpha,
354
351
  cutlinePoly: [],
355
352
  });
356
- ospec_1.default('').equals('create should not have exceeded');
353
+ o('').equals('create should not have exceeded');
357
354
  }
358
355
  catch (err) {
359
- ospec_1.default(err.message).equals('Missing date in imagery name: yucky-name');
356
+ o(err.message).equals('Missing date in imagery name: yucky-name');
360
357
  }
361
358
  });
362
359
  });
@@ -1,50 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const geo_1 = require("@basemaps/geo");
5
- const shared_1 = require("@basemaps/shared");
6
- const rounding_1 = require("@basemaps/test/build/rounding");
7
- const ospec_1 = tslib_1.__importDefault(require("ospec"));
8
- const gdal_cog_1 = require("../../gdal/gdal.cog");
9
- const cog_1 = require("../cog");
10
- const source_tiff_testhelper_1 = require("./source.tiff.testhelper");
11
- shared_1.LogConfig.disable();
12
- ospec_1.default.spec('cog', () => {
13
- ospec_1.default.spec('buildCogForName', () => {
14
- const origConvert = gdal_cog_1.GdalCogBuilder.prototype.convert;
15
- ospec_1.default.afterEach(() => {
16
- gdal_cog_1.GdalCogBuilder.prototype.convert = origConvert;
1
+ import { GoogleTms } from '@basemaps/geo';
2
+ import { LogConfig } from '@basemaps/shared';
3
+ import { round } from '@basemaps/test/build/rounding.js';
4
+ import o from 'ospec';
5
+ import { GdalCogBuilder } from '../../gdal/gdal.cog.js';
6
+ import { buildCogForName } from '../cog.js';
7
+ import { SourceTiffTestHelper } from './source.tiff.testhelper.js';
8
+ LogConfig.disable();
9
+ o.spec('cog', () => {
10
+ o.spec('buildCogForName', () => {
11
+ const origConvert = GdalCogBuilder.prototype.convert;
12
+ o.afterEach(() => {
13
+ GdalCogBuilder.prototype.convert = origConvert;
17
14
  });
18
- ospec_1.default('gdal_translate args', async () => {
15
+ o('gdal_translate args', async () => {
19
16
  let gdalCogBuilder = null;
20
17
  let convertArgs = null;
21
18
  const convert = function (...args) {
22
19
  gdalCogBuilder = this;
23
20
  convertArgs = args;
24
21
  };
25
- gdal_cog_1.GdalCogBuilder.prototype.convert = convert;
26
- const job = source_tiff_testhelper_1.SourceTiffTestHelper.makeCogJob();
27
- const logger = shared_1.LogConfig.get();
22
+ GdalCogBuilder.prototype.convert = convert;
23
+ const job = SourceTiffTestHelper.makeCogJob();
24
+ const logger = LogConfig.get();
28
25
  const name = '4-15-10';
29
26
  job.output.files = [{ name, ...job.tileMatrix.tileToSourceBounds({ x: 15, y: 10, z: 4 }) }];
30
- await cog_1.buildCogForName(job, name, '/tmp/test.vrt', '/tmp/out-tiff', logger, true);
31
- ospec_1.default(convertArgs[0].info).equals(logger.info);
27
+ await buildCogForName(job, name, '/tmp/test.vrt', '/tmp/out-tiff', logger, true);
28
+ o(convertArgs[0].info).equals(logger.info);
32
29
  const { config } = gdalCogBuilder;
33
- config.bbox = rounding_1.round(config.bbox, 4);
34
- config.targetRes = rounding_1.round(config.targetRes, 4);
35
- ospec_1.default(config).deepEquals({
30
+ config.bbox = round(config.bbox, 4);
31
+ config.targetRes = round(config.targetRes, 4);
32
+ o(config).deepEquals({
36
33
  bbox: [17532819.7999, -5009377.0857, 20037508.3428, -7514065.6285],
37
34
  alignmentLevels: 13,
38
35
  compression: 'webp',
39
- tileMatrix: geo_1.GoogleTms,
36
+ tileMatrix: GoogleTms,
40
37
  resampling: { warp: 'bilinear', overview: 'lanczos' },
41
38
  blockSize: 512,
42
39
  targetRes: 0.75,
43
40
  quality: 90,
44
41
  });
45
- ospec_1.default(gdalCogBuilder.source).equals('/tmp/test.vrt');
46
- ospec_1.default(gdalCogBuilder.target).equals('/tmp/out-tiff');
47
- ospec_1.default(rounding_1.round(gdalCogBuilder.args, 4)).deepEquals([
42
+ o(gdalCogBuilder.source).equals('/tmp/test.vrt');
43
+ o(gdalCogBuilder.target).equals('/tmp/out-tiff');
44
+ o(round(gdalCogBuilder.args, 4)).deepEquals([
48
45
  '-of',
49
46
  'COG',
50
47
  '-co',