@basemaps/cli 6.24.2 → 6.27.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 +42 -0
- package/build/cli/cogify/__test__/batch.job.test.d.ts +2 -0
- package/build/cli/cogify/__test__/batch.job.test.d.ts.map +1 -0
- package/build/cli/cogify/__test__/batch.job.test.js +69 -0
- 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 +103 -53
- package/build/cli/cogify/action.job.d.ts +1 -0
- package/build/cli/cogify/action.job.d.ts.map +1 -1
- package/build/cli/cogify/action.job.js +10 -3
- package/build/cli/cogify/{action.batch.d.ts → batch.job.d.ts} +11 -13
- package/build/cli/cogify/batch.job.d.ts.map +1 -0
- package/build/cli/cogify/{action.batch.js → batch.job.js} +88 -62
- package/build/cli/cogify/imagery.config.d.ts +13 -0
- package/build/cli/cogify/imagery.config.d.ts.map +1 -0
- package/build/cli/cogify/imagery.config.js +46 -0
- package/build/cli/cogify/index.d.ts.map +1 -1
- package/build/cli/cogify/index.js +0 -2
- package/build/cli/folder.d.ts +2 -0
- package/build/cli/folder.d.ts.map +1 -1
- package/build/cli/folder.js +6 -0
- package/build/cli/util.d.ts +5 -0
- package/build/cli/util.d.ts.map +1 -1
- package/build/cli/util.js +14 -1
- package/build/cog/__test__/cog.stac.job.test.js +1 -0
- package/build/cog/builder.d.ts +1 -5
- package/build/cog/builder.d.ts.map +1 -1
- package/build/cog/builder.js +4 -28
- package/build/cog/cog.stac.job.d.ts +11 -0
- package/build/cog/cog.stac.job.d.ts.map +1 -1
- package/build/cog/cog.stac.job.js +5 -4
- package/build/cog/constants.d.ts +1 -1
- package/build/cog/constants.d.ts.map +1 -1
- package/build/cog/constants.js +1 -1
- package/build/cog/cutline.d.ts +1 -1
- package/build/cog/cutline.d.ts.map +1 -1
- package/build/cog/cutline.js +2 -2
- package/build/cog/job.factory.d.ts.map +1 -1
- package/build/cog/job.factory.js +8 -9
- package/build/cog/types.d.ts +1 -0
- package/build/cog/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/build/cli/cogify/__test__/action.batch.test.d.ts +0 -2
- package/build/cli/cogify/__test__/action.batch.test.d.ts.map +0 -1
- package/build/cli/cogify/__test__/action.batch.test.js +0 -23
- package/build/cli/cogify/action.batch.d.ts.map +0 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { TileMatrixSet } from '@basemaps/geo';
|
|
2
2
|
import { Env, fsa, LogConfig, Projection } from '@basemaps/shared';
|
|
3
|
-
import { CommandLineAction } from '@rushstack/ts-command-line';
|
|
4
3
|
import Batch from 'aws-sdk/clients/batch.js';
|
|
5
4
|
import { createHash } from 'crypto';
|
|
6
|
-
import { CogStacJob } from '../../cog/cog.stac.job.js';
|
|
7
5
|
const JobQueue = 'CogBatchJobQueue';
|
|
8
6
|
const JobDefinition = 'CogBatchJob';
|
|
7
|
+
const ChunkJobMax = 1000;
|
|
8
|
+
const ChunkLargeUnit = 200; // Up to 5 large files in one job
|
|
9
|
+
const ChunkMiddleUnit = 50; // Up to 20 middle files in one job
|
|
10
|
+
const ChunkSmallUnit = 20; // Up to 50 small files in one job
|
|
9
11
|
/** The base alignment level used by GDAL, Tiffs that are bigger or smaller than this should scale the compute resources */
|
|
10
12
|
const MagicAlignmentLevel = 7;
|
|
11
13
|
const ResolutionRegex = /((?:\d[\.\-])?\d+)m/;
|
|
@@ -21,38 +23,38 @@ export function extractResolutionFromName(name) {
|
|
|
21
23
|
return -1;
|
|
22
24
|
return parseFloat(matches[1].replace('-', '.')) * 1000;
|
|
23
25
|
}
|
|
24
|
-
export class
|
|
25
|
-
constructor() {
|
|
26
|
-
super({
|
|
27
|
-
actionName: 'batch',
|
|
28
|
-
summary: 'AWS batch jobs',
|
|
29
|
-
documentation: 'Submit a list of cogs to a AWS Batch queue to be process',
|
|
30
|
-
});
|
|
31
|
-
}
|
|
26
|
+
export class BatchJob {
|
|
32
27
|
/**
|
|
33
28
|
* Create a id for a job
|
|
34
29
|
*
|
|
35
30
|
* This needs to be within `[a-Z_-]` upto 128 characters log
|
|
36
31
|
* @param job job to process
|
|
37
|
-
* @param
|
|
32
|
+
* @param fileNames output filename
|
|
38
33
|
* @returns job id
|
|
39
34
|
*/
|
|
40
|
-
static id(job,
|
|
35
|
+
static id(job, fileNames) {
|
|
41
36
|
// Job names are uncontrolled so hash the name and grab a small slice to use as a identifier
|
|
42
37
|
const jobName = createHash('sha256').update(job.name).digest('hex').slice(0, 16);
|
|
43
|
-
|
|
38
|
+
fileNames.sort((a, b) => a.localeCompare(b));
|
|
39
|
+
return `${job.id}-${jobName}-${fileNames.join('_')}`.slice(0, 128);
|
|
44
40
|
}
|
|
45
|
-
static async batchOne(jobPath, job, batch,
|
|
46
|
-
const jobName =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
static async batchOne(jobPath, job, batch, names, isCommit) {
|
|
42
|
+
const jobName = BatchJob.id(job, names);
|
|
43
|
+
let memory = 3900;
|
|
44
|
+
if (names.length === 1) {
|
|
45
|
+
// Calculate the larger file to provision memory if there is only one imagery in job.
|
|
46
|
+
const tile = TileMatrixSet.nameToTile(names[0]);
|
|
47
|
+
const alignmentLevels = Projection.findAlignmentLevels(job.tileMatrix, tile, job.source.gsd);
|
|
48
|
+
// Give 25% more memory to larger jobs
|
|
49
|
+
const resDiff = 1 + Math.max(alignmentLevels - MagicAlignmentLevel, 0) * 0.25;
|
|
50
|
+
memory *= resDiff;
|
|
51
|
+
}
|
|
52
52
|
if (!isCommit) {
|
|
53
53
|
return { jobName, jobId: '', memory };
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
let commandStr = ['-V', 'cog', '--job', jobPath, '--commit'];
|
|
56
|
+
for (const name of names)
|
|
57
|
+
commandStr = commandStr.concat(['--name', name]);
|
|
56
58
|
const batchJob = await batch
|
|
57
59
|
.submitJob({
|
|
58
60
|
jobName,
|
|
@@ -88,14 +90,7 @@ export class ActionBatchJob extends CommandLineAction {
|
|
|
88
90
|
}
|
|
89
91
|
return okMap;
|
|
90
92
|
}
|
|
91
|
-
async
|
|
92
|
-
var _a, _b, _c;
|
|
93
|
-
if (((_a = this.job) === null || _a === void 0 ? void 0 : _a.value) == null) {
|
|
94
|
-
throw new Error('Failed to read parameters');
|
|
95
|
-
}
|
|
96
|
-
await ActionBatchJob.batchJob(await CogStacJob.load(this.job.value), (_b = this.commit) === null || _b === void 0 ? void 0 : _b.value, (_c = this.oneCog) === null || _c === void 0 ? void 0 : _c.value, LogConfig.get());
|
|
97
|
-
}
|
|
98
|
-
static async batchJob(job, commit = false, oneCog, logger) {
|
|
93
|
+
static async batchJob(job, commit = false, logger) {
|
|
99
94
|
var _a;
|
|
100
95
|
const jobPath = job.getJobPath('job.json');
|
|
101
96
|
if (!jobPath.startsWith('s3://')) {
|
|
@@ -105,23 +100,38 @@ export class ActionBatchJob extends CommandLineAction {
|
|
|
105
100
|
const region = (_a = Env.get('AWS_DEFAULT_REGION')) !== null && _a !== void 0 ? _a : 'ap-southeast-2';
|
|
106
101
|
const batch = new Batch({ region });
|
|
107
102
|
fsa.configure(job.output.location);
|
|
108
|
-
const runningJobs = await
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
103
|
+
const runningJobs = await BatchJob.getCurrentJobList(batch);
|
|
104
|
+
// Prepare chunk job and individual jobs based on imagery size.
|
|
105
|
+
const jobs = await this.getJobs(job);
|
|
106
|
+
// Get all the existing output tiffs
|
|
107
|
+
const targetPath = job.getJobPath();
|
|
108
|
+
const existTiffs = [];
|
|
109
|
+
for await (const fileName of fsa.list(job.getJobPath())) {
|
|
110
|
+
if (fileName.endsWith('.tiff'))
|
|
111
|
+
existTiffs.push(fileName);
|
|
112
|
+
}
|
|
113
|
+
const toSubmit = [];
|
|
114
|
+
for (const names of jobs) {
|
|
115
|
+
// Check existence of batch job running
|
|
116
|
+
const jobName = BatchJob.id(job, names);
|
|
113
117
|
const isRunning = runningJobs.get(jobName);
|
|
114
118
|
if (isRunning) {
|
|
115
119
|
logger.info({ jobName }, 'JobRunning');
|
|
116
|
-
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
// Check existence of all the output tiffs.
|
|
123
|
+
let allExists = true;
|
|
124
|
+
for (const name of names) {
|
|
125
|
+
if (!existTiffs.includes(job.getJobPath(`${name}.tiff`)))
|
|
126
|
+
allExists = false;
|
|
117
127
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
if (allExists) {
|
|
129
|
+
logger.info({ targetPath, names }, 'FileExists');
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
// Ready to submit
|
|
133
|
+
toSubmit.push(names);
|
|
134
|
+
}
|
|
125
135
|
if (toSubmit.length === 0) {
|
|
126
136
|
logger.info('NoJobs');
|
|
127
137
|
return;
|
|
@@ -132,8 +142,8 @@ export class ActionBatchJob extends CommandLineAction {
|
|
|
132
142
|
jobQueue: JobQueue,
|
|
133
143
|
jobDefinition: JobDefinition,
|
|
134
144
|
}, 'JobSubmit');
|
|
135
|
-
for (const
|
|
136
|
-
const jobStatus = await
|
|
145
|
+
for (const names of toSubmit) {
|
|
146
|
+
const jobStatus = await BatchJob.batchOne(jobPath, job, batch, names, commit);
|
|
137
147
|
logger.info(jobStatus, 'JobSubmitted');
|
|
138
148
|
}
|
|
139
149
|
if (!commit) {
|
|
@@ -141,23 +151,39 @@ export class ActionBatchJob extends CommandLineAction {
|
|
|
141
151
|
return;
|
|
142
152
|
}
|
|
143
153
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Prepare the jobs from job files, and chunk the small images into single
|
|
156
|
+
* @returns List of jobs including single job and chunk jobs.
|
|
157
|
+
*/
|
|
158
|
+
static async getJobs(job) {
|
|
159
|
+
const jobs = [];
|
|
160
|
+
let chunkJob = [];
|
|
161
|
+
let chunkUnit = 0; // Calculate the chunkUnit based on the size
|
|
162
|
+
for (const file of job.output.files) {
|
|
163
|
+
const imageSize = file.width / job.output.gsd;
|
|
164
|
+
if (imageSize > 16385) {
|
|
165
|
+
jobs.push([file.name]);
|
|
166
|
+
}
|
|
167
|
+
else if (imageSize > 8193) {
|
|
168
|
+
chunkJob.push(file.name);
|
|
169
|
+
chunkUnit += ChunkLargeUnit;
|
|
170
|
+
}
|
|
171
|
+
else if (imageSize > 4097) {
|
|
172
|
+
chunkJob.push(file.name);
|
|
173
|
+
chunkUnit += ChunkMiddleUnit;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
chunkJob.push(file.name);
|
|
177
|
+
chunkUnit += ChunkSmallUnit;
|
|
178
|
+
}
|
|
179
|
+
if (chunkUnit >= ChunkJobMax) {
|
|
180
|
+
jobs.push(chunkJob);
|
|
181
|
+
chunkJob = [];
|
|
182
|
+
chunkUnit = 0;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (chunkJob.length > 0)
|
|
186
|
+
jobs.push(chunkJob);
|
|
187
|
+
return jobs;
|
|
162
188
|
}
|
|
163
189
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LogType } from '@basemaps/shared';
|
|
2
|
+
import { CogStacJob } from '../../cog/cog.stac.job';
|
|
3
|
+
/**
|
|
4
|
+
* Prepare and insert Imagery Config for the cog creation job.
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function insertConfigImagery(job: CogStacJob, logger: LogType): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Prepare and insert TileSet Config for the cog creation job.
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function insertConfigTileSet(job: CogStacJob, logger: LogType): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=imagery.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imagery.config.d.ts","sourceRoot":"","sources":["../../../src/cli/cogify/imagery.config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBzF;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBzF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Config, TileSetType } from '@basemaps/config';
|
|
2
|
+
import { ImageFormat } from '@basemaps/geo';
|
|
3
|
+
/**
|
|
4
|
+
* Prepare and insert Imagery Config for the cog creation job.
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export async function insertConfigImagery(job, logger) {
|
|
8
|
+
const now = Date.now();
|
|
9
|
+
const imgId = Config.Imagery.id(job.id);
|
|
10
|
+
const configImagery = {
|
|
11
|
+
id: imgId,
|
|
12
|
+
name: job.name,
|
|
13
|
+
createdAt: now,
|
|
14
|
+
updatedAt: now,
|
|
15
|
+
projection: job.tileMatrix.projection.code,
|
|
16
|
+
tileMatrix: job.tileMatrix.identifier,
|
|
17
|
+
uri: job.getJobPath(),
|
|
18
|
+
bounds: job.output.bounds,
|
|
19
|
+
files: job.output.files,
|
|
20
|
+
};
|
|
21
|
+
if (Config.Imagery.isWriteable())
|
|
22
|
+
Config.Imagery.put(configImagery);
|
|
23
|
+
logger.info({ imgId }, 'CogCreate:InsertConfigImagery');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Prepare and insert TileSet Config for the cog creation job.
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export async function insertConfigTileSet(job, logger) {
|
|
30
|
+
const now = Date.now();
|
|
31
|
+
const tsId = Config.TileSet.id(job.id);
|
|
32
|
+
const imId = Config.Imagery.id(job.id);
|
|
33
|
+
const tileSet = {
|
|
34
|
+
type: TileSetType.Raster,
|
|
35
|
+
format: ImageFormat.Webp,
|
|
36
|
+
id: tsId,
|
|
37
|
+
name: job.name,
|
|
38
|
+
layers: [{ [job.tileMatrix.projection.code]: imId, name: job.name, minZoom: 0, maxZoom: 32 }],
|
|
39
|
+
background: { r: 0, g: 0, b: 0, alpha: 0 },
|
|
40
|
+
createdAt: now,
|
|
41
|
+
updatedAt: now,
|
|
42
|
+
};
|
|
43
|
+
if (Config.TileSet.isWriteable())
|
|
44
|
+
Config.TileSet.put(tileSet);
|
|
45
|
+
logger.info({ tsId }, 'CogCreate:InsertConfigTileSet');
|
|
46
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/cogify/index.ts"],"names":[],"mappings":";AACA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/cogify/index.ts"],"names":[],"mappings":";AACA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIjD,qBAAa,iBAAkB,SAAQ,eAAe;;CASrD"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import 'source-map-support/register.js';
|
|
3
3
|
import { BaseCommandLine } from '../base.cli.js';
|
|
4
|
-
import { ActionBatchJob } from './action.batch.js';
|
|
5
4
|
import { ActionCogCreate } from './action.cog.js';
|
|
6
5
|
import { ActionJobCreate } from './action.job.js';
|
|
7
6
|
export class CogifyCommandLine extends BaseCommandLine {
|
|
@@ -12,7 +11,6 @@ export class CogifyCommandLine extends BaseCommandLine {
|
|
|
12
11
|
});
|
|
13
12
|
this.addAction(new ActionCogCreate());
|
|
14
13
|
this.addAction(new ActionJobCreate());
|
|
15
|
-
this.addAction(new ActionBatchJob());
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
16
|
new CogifyCommandLine().run();
|
package/build/cli/folder.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
/** Make a temp folder inside TEMP_FOLDER's path */
|
|
2
2
|
export declare function makeTempFolder(folder: string): Promise<string>;
|
|
3
|
+
/** Make a tiff folder inside TEMP_FOLDER's path */
|
|
4
|
+
export declare function makeTiffFolder(tmpFolder: string, name: string): Promise<string>;
|
|
3
5
|
//# sourceMappingURL=folder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder.d.ts","sourceRoot":"","sources":["../../src/cli/folder.ts"],"names":[],"mappings":"AAIA,mDAAmD;AACnD,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMpE"}
|
|
1
|
+
{"version":3,"file":"folder.d.ts","sourceRoot":"","sources":["../../src/cli/folder.ts"],"names":[],"mappings":"AAIA,mDAAmD;AACnD,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMpE;AAED,mDAAmD;AACnD,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKrF"}
|
package/build/cli/folder.js
CHANGED
|
@@ -9,3 +9,9 @@ export async function makeTempFolder(folder) {
|
|
|
9
9
|
await fs.mkdir(folderPath, { recursive: true });
|
|
10
10
|
return folderPath;
|
|
11
11
|
}
|
|
12
|
+
/** Make a tiff folder inside TEMP_FOLDER's path */
|
|
13
|
+
export async function makeTiffFolder(tmpFolder, name) {
|
|
14
|
+
const folderPath = path.join(tmpFolder, name);
|
|
15
|
+
await fs.mkdir(folderPath, { recursive: true });
|
|
16
|
+
return folderPath;
|
|
17
|
+
}
|
package/build/cli/util.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CogStacJob } from '../cog/cog.stac.job.js';
|
|
1
2
|
/**
|
|
2
3
|
* Invalidate the cloudfront distribution cache when updating imagery sets
|
|
3
4
|
*/
|
|
@@ -14,4 +15,8 @@ export declare function getStaticBucket(): Promise<string | null>;
|
|
|
14
15
|
* @returns whether the item was updated
|
|
15
16
|
*/
|
|
16
17
|
export declare function uploadStaticFile(filePath: string, target: string, contentType: string, cacheControl: string): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Prepare QA urls with center location
|
|
20
|
+
*/
|
|
21
|
+
export declare function prepareUrl(job: CogStacJob): Promise<string>;
|
|
17
22
|
//# sourceMappingURL=util.d.ts.map
|
package/build/cli/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAUpD;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,MAAM,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA+B5F;AAED,eAAO,MAAM,OAAO,cAAc,CAAC;AAEnC,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQjF;AAOD,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ9D;AAMD;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,CAAC,CA6BlB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CASjE"}
|
package/build/cli/util.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fsa, LogConfig } from '@basemaps/shared';
|
|
1
|
+
import { Env, fsa, LogConfig, Projection } from '@basemaps/shared';
|
|
2
2
|
import CloudFormation from 'aws-sdk/clients/cloudformation.js';
|
|
3
3
|
import CloudFront from 'aws-sdk/clients/cloudfront.js';
|
|
4
4
|
import S3 from 'aws-sdk/clients/s3.js';
|
|
@@ -113,3 +113,16 @@ export async function uploadStaticFile(filePath, target, contentType, cacheContr
|
|
|
113
113
|
.promise();
|
|
114
114
|
return true;
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Prepare QA urls with center location
|
|
118
|
+
*/
|
|
119
|
+
export async function prepareUrl(job) {
|
|
120
|
+
const bounds = job.output.bounds;
|
|
121
|
+
const center = { x: bounds.x + bounds.width / 2, y: bounds.y + bounds.height / 2 };
|
|
122
|
+
const proj = Projection.get(job.tileMatrix.projection);
|
|
123
|
+
const centerLatLon = proj.toWgs84([center.x, center.y]).map((c) => c.toFixed(6));
|
|
124
|
+
const targetZoom = Math.max(job.tileMatrix.findBestZoom(job.output.gsd) - 12, 0);
|
|
125
|
+
const base = Env.get(Env.PublicUrlBase);
|
|
126
|
+
const url = `${base}/?i=${job.id}&p=${job.tileMatrix.identifier}&debug#@${centerLatLon[1]},${centerLatLon[0]},z${targetZoom}`;
|
|
127
|
+
return url;
|
|
128
|
+
}
|
package/build/cog/builder.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ import { LimitFunction } from 'p-limit';
|
|
|
6
6
|
import { Cutline } from './cutline.js';
|
|
7
7
|
import { CogBuilderMetadata, SourceMetadata } from './types.js';
|
|
8
8
|
export declare const InvalidProjectionCode = 32767;
|
|
9
|
-
export declare const CacheVersion = "v3";
|
|
10
|
-
export declare const CacheFolder = "./.cache";
|
|
11
9
|
/**
|
|
12
10
|
* Attempt to guess the projection based off the WKT
|
|
13
11
|
*
|
|
@@ -41,13 +39,11 @@ export declare class CogBuilder {
|
|
|
41
39
|
* @param logger
|
|
42
40
|
*/
|
|
43
41
|
findNoData(tiff: CogTiff): number | null;
|
|
44
|
-
/** Cache the bounds lookup so we do not have to requery the bounds between CLI calls */
|
|
45
|
-
private getMetadata;
|
|
46
42
|
/**
|
|
47
43
|
* Generate a list of tiles that need to be generated to cover the source tiffs
|
|
48
44
|
* @param tiffs list of source imagery to be converted
|
|
49
45
|
* @returns List of Tile bounds covering tiffs
|
|
50
46
|
*/
|
|
51
|
-
build(tiffs: ChunkSource[], cutline: Cutline): Promise<CogBuilderMetadata>;
|
|
47
|
+
build(tiffs: ChunkSource[], cutline: Cutline, maxImageSize?: number): Promise<CogBuilderMetadata>;
|
|
52
48
|
}
|
|
53
49
|
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -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,
|
|
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,EAAoC,OAAO,EAAc,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAuB,MAAM,iBAAiB,CAAC;AAC/D,OAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAO/D;AAED,qBAAa,UAAU;IACrB,CAAC,EAAE,aAAa,CAAC;IACjB,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;;;;OAIG;IACG,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAaxG"}
|
package/build/cog/builder.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { Bounds, Epsg } from '@basemaps/geo';
|
|
2
|
-
import { CompositeError,
|
|
2
|
+
import { CompositeError, LoggerFatalError, Projection } from '@basemaps/shared';
|
|
3
3
|
import { CogTiff, TiffTag, TiffTagGeo } from '@cogeotiff/core';
|
|
4
|
-
import { createHash } from 'crypto';
|
|
5
|
-
import { existsSync, mkdirSync } from 'fs';
|
|
6
4
|
import pLimit from 'p-limit';
|
|
7
|
-
import * as path from 'path';
|
|
8
5
|
import { basename } from 'path';
|
|
9
6
|
import { ProjectionLoader } from './projection.loader.js';
|
|
10
7
|
export const InvalidProjectionCode = 32767;
|
|
11
|
-
export const CacheVersion = 'v3'; // bump this number to invalidate the cache
|
|
12
|
-
export const CacheFolder = './.cache';
|
|
13
8
|
/**
|
|
14
9
|
* Attempt to guess the projection based off the WKT
|
|
15
10
|
*
|
|
@@ -155,35 +150,16 @@ export class CogBuilder {
|
|
|
155
150
|
}
|
|
156
151
|
return noDataNum;
|
|
157
152
|
}
|
|
158
|
-
/** Cache the bounds lookup so we do not have to requery the bounds between CLI calls */
|
|
159
|
-
async getMetadata(tiffs) {
|
|
160
|
-
const cacheKey = path.join(CacheFolder, CacheVersion +
|
|
161
|
-
createHash('sha256')
|
|
162
|
-
.update(this.targetTms.projection.toString())
|
|
163
|
-
.update(tiffs.map((c) => c.uri).join('\n'))
|
|
164
|
-
.digest('hex')) + '.json';
|
|
165
|
-
if (existsSync(cacheKey)) {
|
|
166
|
-
this.logger.debug({ path: cacheKey }, 'MetadataCacheHit');
|
|
167
|
-
const metadata = await fsa.readJson(cacheKey);
|
|
168
|
-
metadata.resZoom = Projection.getTiffResZoom(this.targetTms, metadata.pixelScale);
|
|
169
|
-
return metadata;
|
|
170
|
-
}
|
|
171
|
-
const metadata = await this.bounds(tiffs);
|
|
172
|
-
mkdirSync(CacheFolder, { recursive: true });
|
|
173
|
-
await fsa.writeJson(cacheKey, metadata);
|
|
174
|
-
this.logger.debug({ path: cacheKey }, 'MetadataCacheMiss');
|
|
175
|
-
return metadata;
|
|
176
|
-
}
|
|
177
153
|
/**
|
|
178
154
|
* Generate a list of tiles that need to be generated to cover the source tiffs
|
|
179
155
|
* @param tiffs list of source imagery to be converted
|
|
180
156
|
* @returns List of Tile bounds covering tiffs
|
|
181
157
|
*/
|
|
182
|
-
async build(tiffs, cutline) {
|
|
183
|
-
const metadata = await this.
|
|
158
|
+
async build(tiffs, cutline, maxImageSize) {
|
|
159
|
+
const metadata = await this.bounds(tiffs);
|
|
184
160
|
// Ensure that the projection definition is loaded
|
|
185
161
|
await ProjectionLoader.load(metadata.projection);
|
|
186
|
-
const files = cutline.optimizeCovering(metadata);
|
|
162
|
+
const files = cutline.optimizeCovering(metadata, maxImageSize);
|
|
187
163
|
let union = null;
|
|
188
164
|
for (const bounds of files) {
|
|
189
165
|
if (union == null)
|
|
@@ -5,6 +5,8 @@ import { GdalCogBuilderResampling } from '../gdal/gdal.config.js';
|
|
|
5
5
|
import { CogBuilderMetadata, CogJob, CogJobJson, CogOutputProperties, CogSourceProperties, FeatureCollectionWithCrs } from './types.js';
|
|
6
6
|
export declare const MaxConcurrencyDefault = 50;
|
|
7
7
|
export interface JobCreationContext {
|
|
8
|
+
/** Custom Imagery Name if defined */
|
|
9
|
+
imageryName?: string;
|
|
8
10
|
/** Source config */
|
|
9
11
|
sourceLocation: FileConfig | FileConfigPath;
|
|
10
12
|
/** Output config */
|
|
@@ -32,11 +34,19 @@ export interface JobCreationContext {
|
|
|
32
34
|
* Override the source projection
|
|
33
35
|
*/
|
|
34
36
|
projection?: Epsg;
|
|
37
|
+
/**
|
|
38
|
+
* Override Maximum Image Pixel Size
|
|
39
|
+
*/
|
|
40
|
+
maxImageSize?: number;
|
|
35
41
|
/**
|
|
36
42
|
* Resampling method
|
|
37
43
|
* @Default GdalCogBuilderDefaults.resampling
|
|
38
44
|
*/
|
|
39
45
|
resampling?: GdalCogBuilderResampling;
|
|
46
|
+
/**
|
|
47
|
+
* Override job processing Id
|
|
48
|
+
*/
|
|
49
|
+
processingId?: string;
|
|
40
50
|
};
|
|
41
51
|
/**
|
|
42
52
|
* Should this job be submitted to batch now?
|
|
@@ -66,6 +76,7 @@ export interface CogJobCreateParams {
|
|
|
66
76
|
export declare class CogStacJob implements CogJob {
|
|
67
77
|
json: CogJobJson;
|
|
68
78
|
private cacheTargetZoom?;
|
|
79
|
+
processingId: string;
|
|
69
80
|
/**
|
|
70
81
|
* Load the job.json
|
|
71
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cog.stac.job.d.ts","sourceRoot":"","sources":["../../src/cog/cog.stac.job.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,IAAI,EAKJ,aAAa,EAEd,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,UAAU,EACV,cAAc,EAKf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAA8C,MAAM,iBAAiB,CAAC;AAE3F,OAAO,EAA0B,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAG1F,OAAO,EACL,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,MAAM,WAAW,kBAAkB;IACjC,oBAAoB;IACpB,cAAc,EAAE,UAAU,GAAG,cAAc,CAAC;IAE5C,oBAAoB;IACpB,cAAc,EAAE,UAAU,CAAC;IAE3B,6CAA6C;IAC7C,OAAO,CAAC,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAEF,UAAU,EAAE,aAAa,CAAC;IAE1B,QAAQ,CAAC,EAAE;QACT,sBAAsB;QACtB,EAAE,CAAC,EAAE,MAAM,CAAC;QAEZ;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QAEjB;;;WAGG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;QAErB;;WAEG;QACH,UAAU,CAAC,EAAE,IAAI,CAAC;QAElB;;;WAGG;QACH,UAAU,CAAC,EAAE,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"cog.stac.job.d.ts","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{
|
|
|
29
29
|
|
|
30
30
|
*/
|
|
31
31
|
static async create({ id, imageryName, metadata, ctx, cutlinePoly, addAlpha, }) {
|
|
32
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
32
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
33
33
|
let description;
|
|
34
34
|
const providers = [];
|
|
35
35
|
const links = [
|
|
@@ -101,6 +101,7 @@ export class CogStacJob {
|
|
|
101
101
|
bounds: metadata.targetBounds,
|
|
102
102
|
oneCogCovering: ctx.oneCogCovering,
|
|
103
103
|
},
|
|
104
|
+
processingId: (_l = ctx.override) === null || _l === void 0 ? void 0 : _l.processingId,
|
|
104
105
|
});
|
|
105
106
|
const nowStr = new Date().toISOString();
|
|
106
107
|
const sourceProj = Projection.get(job.source.epsg);
|
|
@@ -139,9 +140,9 @@ export class CogStacJob {
|
|
|
139
140
|
'proj:epsg': [ctx.tileMatrix.projection.code],
|
|
140
141
|
'linz:output': [
|
|
141
142
|
{
|
|
142
|
-
resampling: (
|
|
143
|
-
quality: (
|
|
144
|
-
cutlineBlend: (
|
|
143
|
+
resampling: (_o = (_m = ctx.override) === null || _m === void 0 ? void 0 : _m.resampling) !== null && _o !== void 0 ? _o : GdalCogBuilderDefaults.resampling,
|
|
144
|
+
quality: (_q = (_p = ctx.override) === null || _p === void 0 ? void 0 : _p.quality) !== null && _q !== void 0 ? _q : GdalCogBuilderDefaults.quality,
|
|
145
|
+
cutlineBlend: (_r = ctx.cutline) === null || _r === void 0 ? void 0 : _r.blend,
|
|
145
146
|
addAlpha,
|
|
146
147
|
nodata: metadata.nodata,
|
|
147
148
|
},
|
package/build/cog/constants.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/cog/constants.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/cog/constants.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,eAAO,MAAM,kBAAkB,SAAS,CAAC;AAEzC,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,OAAO,CAAC"}
|
package/build/cog/constants.js
CHANGED
package/build/cog/cutline.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare class Cutline {
|
|
|
44
44
|
* Generate an optimized WebMercator tile cover for the supplied source images
|
|
45
45
|
* @param sourceMetadata contains images bounds and projection info
|
|
46
46
|
*/
|
|
47
|
-
optimizeCovering(sourceMetadata: SourceMetadata): NamedBounds[];
|
|
47
|
+
optimizeCovering(sourceMetadata: SourceMetadata, maxImageSize?: number): NamedBounds[];
|
|
48
48
|
/**
|
|
49
49
|
* Convert JobCutline to geojson FeatureCollection
|
|
50
50
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cutline.d.ts","sourceRoot":"","sources":["../../src/cog/cutline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAQ,WAAW,EAAQ,aAAa,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAIL,YAAY,EAIb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAgB9E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAK9E;AAqBD,qBAAa,OAAO;IAClB,4CAA4C;IAC5C,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,EAAE,aAAa,CAAC;IAC1B,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,cAAc,EAAE,OAAO,CAAC;IACxB,kFAAkF;IAClF,OAAO,EAAE,YAAY,CAAM;IAE3B;;;;;;;;;;SAUK;gBACO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CAAC;IAI5D;;;;;;;OAOG;IACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAqCzD;;;OAGG;IACH,gBAAgB,CAAC,cAAc,EAAE,cAAc,EAAE,YAAY,GAAE,MAA2B,GAAG,WAAW,EAAE;IA0C1G;;OAEG;IACH,SAAS,CAAC,QAAQ,eAAgB,GAAG,wBAAwB;IAS7D;;;;;;;;OAQG;IACH,OAAO,CAAC,SAAS;IA0CjB;;;;;SAKK;IACL,OAAO,CAAC,YAAY;IAqCpB;;;;;SAKK;IACL,OAAO,CAAC,SAAS;CAQlB"}
|
package/build/cog/cutline.js
CHANGED
|
@@ -123,7 +123,7 @@ export class Cutline {
|
|
|
123
123
|
* Generate an optimized WebMercator tile cover for the supplied source images
|
|
124
124
|
* @param sourceMetadata contains images bounds and projection info
|
|
125
125
|
*/
|
|
126
|
-
optimizeCovering(sourceMetadata) {
|
|
126
|
+
optimizeCovering(sourceMetadata, maxImageSize = MaxImagePixelWidth) {
|
|
127
127
|
if (this.oneCogCovering) {
|
|
128
128
|
const extent = this.tileMatrix.extent.toJson();
|
|
129
129
|
return [{ ...extent, name: '0-0-0' }];
|
|
@@ -133,7 +133,7 @@ export class Cutline {
|
|
|
133
133
|
// Look for the biggest tile size we are allowed to create.
|
|
134
134
|
let minZ = resZoom - 1;
|
|
135
135
|
while (minZ > 0 &&
|
|
136
|
-
Projection.getImagePixelWidth(this.tileMatrix, { x: 0, y: 0, z: minZ }, resZoom) <
|
|
136
|
+
Projection.getImagePixelWidth(this.tileMatrix, { x: 0, y: 0, z: minZ }, resZoom) < maxImageSize) {
|
|
137
137
|
--minZ;
|
|
138
138
|
}
|
|
139
139
|
minZ = Math.max(1, minZ + 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.factory.d.ts","sourceRoot":"","sources":["../../src/cog/job.factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"job.factory.d.ts","sourceRoot":"","sources":["../../src/cog/job.factory.ts"],"names":[],"mappings":"AAKA,OAAO,EAAc,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAOxC,eAAO,MAAM,aAAa;IACxB;;OAEG;gBACe,kBAAkB,GAAG,QAAQ,MAAM,CAAC;CA4FvD,CAAC"}
|