Skip to content

Commit f7d45f6

Browse files
authored
fix(cli): use the STAC title if it exists as the imagery title BM-784 (#2692)
* fix(cli): use the STAC title if it exists as the imagery title * refactor: fixup lint
1 parent cd43cb4 commit f7d45f6

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

packages/cli/src/cli/cogify/action.make.cog.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class CommandMakeCog extends CommandLineAction {
6262
argumentName: 'NAME',
6363
parameterShortName: '-n',
6464
parameterLongName: '--name',
65-
description: 'Custome imagery name',
65+
description: 'Custom imagery name',
6666
required: false,
6767
});
6868
this.tileMatrix = this.defineStringParameter({
@@ -141,6 +141,8 @@ export class CommandMakeCog extends CommandLineAction {
141141
if (tileMatrix == null) throw new Error(`Cannot find tile matrix: ${identifier}`);
142142
logger.info({ id, tileMatrix: tileMatrix.identifier }, 'SetTileMatrix');
143143
const job = await this.makeCog(id, name, tileMatrix, source);
144+
configLayer.title = job.title;
145+
144146
const jobLocation = job.getJobPath('job.json');
145147
// Split the jobs into chunked tasks
146148
const chunkedJobs = await this.splitJob(job, logger);
@@ -211,8 +213,7 @@ export class CommandMakeCog extends CommandLineAction {
211213
oneCogCovering: false,
212214
};
213215

214-
const job = (await CogJobFactory.create(ctx)) as CogStacJob;
215-
return job;
216+
return await CogJobFactory.create(ctx);
216217
}
217218

218219
async splitJob(job: CogStacJob, logger: LogType): Promise<string[][]> {

packages/cli/src/cog/cog.stac.job.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,9 @@ export class CogStacJob implements CogJob {
131131
}
132132

133133
/**
134-
* Create job.json, collection.json, source.geojson, covering.geojson, cutlint.geojson.gz and
135-
* stac descriptions of the target COGs
136-
137-
*/
134+
* Create job.json, collection.json, source.geojson, covering.geojson, cutlint.geojson.gz and
135+
* stac descriptions of the target COGs
136+
*/
138137
static async create({
139138
id,
140139
imageryName,

packages/cli/src/cog/job.factory.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { Bounds } from '@basemaps/geo';
22
import { fsa, isConfigS3Role, isFileConfigPath, LogConfig } from '@basemaps/shared';
3+
import { basename } from 'path';
34
import * as ulid from 'ulid';
4-
import { CogBuilder } from '../index.js';
55
import { BatchJob } from '../cli/cogify/batch.job.js';
6+
import { CogBuilder } from '../index.js';
67
import { CogStacJob, JobCreationContext } from './cog.stac.job.js';
78
import { Cutline } from './cutline.js';
8-
import { CogJob } from './types.js';
9-
import { basename } from 'path';
109

1110
export const MaxConcurrencyDefault = 50;
1211

@@ -29,7 +28,7 @@ export const CogJobFactory = {
2928
/**
3029
* Create a COG Job and potentially submit it to AWS Batch for processing
3130
*/
32-
async create(ctx: JobCreationContext): Promise<CogJob> {
31+
async create(ctx: JobCreationContext): Promise<CogStacJob> {
3332
const id = ctx.override?.id ?? ulid.ulid();
3433
let imageryName = ctx.imageryName;
3534
if (imageryName == null) imageryName = basename(ctx.sourceLocation.path);

0 commit comments

Comments
 (0)