From 8e32d46b64e02181ab8dfcbd9027052fc229e001 Mon Sep 17 00:00:00 2001 From: Blayne Chard Date: Wed, 15 Feb 2023 15:59:49 +1300 Subject: [PATCH 1/2] fix(cli): use the STAC title if it exists as the imagery title --- packages/cli/src/cli/cogify/action.make.cog.ts | 7 ++++--- packages/cli/src/cog/cog.stac.job.ts | 7 +++---- packages/cli/src/cog/job.factory.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/cli/cogify/action.make.cog.ts b/packages/cli/src/cli/cogify/action.make.cog.ts index 14678391e..b0800e8de 100644 --- a/packages/cli/src/cli/cogify/action.make.cog.ts +++ b/packages/cli/src/cli/cogify/action.make.cog.ts @@ -62,7 +62,7 @@ export class CommandMakeCog extends CommandLineAction { argumentName: 'NAME', parameterShortName: '-n', parameterLongName: '--name', - description: 'Custome imagery name', + description: 'Custom imagery name', required: false, }); this.tileMatrix = this.defineStringParameter({ @@ -141,6 +141,8 @@ export class CommandMakeCog extends CommandLineAction { if (tileMatrix == null) throw new Error(`Cannot find tile matrix: ${identifier}`); logger.info({ id, tileMatrix: tileMatrix.identifier }, 'SetTileMatrix'); const job = await this.makeCog(id, name, tileMatrix, source); + configLayer.title = job.title; + const jobLocation = job.getJobPath('job.json'); // Split the jobs into chunked tasks const chunkedJobs = await this.splitJob(job, logger); @@ -211,8 +213,7 @@ export class CommandMakeCog extends CommandLineAction { oneCogCovering: false, }; - const job = (await CogJobFactory.create(ctx)) as CogStacJob; - return job; + return await CogJobFactory.create(ctx); } async splitJob(job: CogStacJob, logger: LogType): Promise { diff --git a/packages/cli/src/cog/cog.stac.job.ts b/packages/cli/src/cog/cog.stac.job.ts index b5810cd0d..a73b40f42 100644 --- a/packages/cli/src/cog/cog.stac.job.ts +++ b/packages/cli/src/cog/cog.stac.job.ts @@ -131,10 +131,9 @@ export class CogStacJob implements CogJob { } /** - * Create job.json, collection.json, source.geojson, covering.geojson, cutlint.geojson.gz and - * stac descriptions of the target COGs - - */ + * Create job.json, collection.json, source.geojson, covering.geojson, cutlint.geojson.gz and + * stac descriptions of the target COGs + */ static async create({ id, imageryName, diff --git a/packages/cli/src/cog/job.factory.ts b/packages/cli/src/cog/job.factory.ts index 664727398..4951c396e 100644 --- a/packages/cli/src/cog/job.factory.ts +++ b/packages/cli/src/cog/job.factory.ts @@ -29,7 +29,7 @@ export const CogJobFactory = { /** * Create a COG Job and potentially submit it to AWS Batch for processing */ - async create(ctx: JobCreationContext): Promise { + async create(ctx: JobCreationContext): Promise { const id = ctx.override?.id ?? ulid.ulid(); let imageryName = ctx.imageryName; if (imageryName == null) imageryName = basename(ctx.sourceLocation.path); From d3ab6f49d270463c6fa28e43cbdf6fa1df4b3f68 Mon Sep 17 00:00:00 2001 From: Blayne Chard Date: Wed, 15 Feb 2023 16:02:49 +1300 Subject: [PATCH 2/2] refactor: fixup lint --- packages/cli/src/cog/job.factory.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/cog/job.factory.ts b/packages/cli/src/cog/job.factory.ts index 4951c396e..ee31549ae 100644 --- a/packages/cli/src/cog/job.factory.ts +++ b/packages/cli/src/cog/job.factory.ts @@ -1,12 +1,11 @@ import { Bounds } from '@basemaps/geo'; import { fsa, isConfigS3Role, isFileConfigPath, LogConfig } from '@basemaps/shared'; +import { basename } from 'path'; import * as ulid from 'ulid'; -import { CogBuilder } from '../index.js'; import { BatchJob } from '../cli/cogify/batch.job.js'; +import { CogBuilder } from '../index.js'; import { CogStacJob, JobCreationContext } from './cog.stac.job.js'; import { Cutline } from './cutline.js'; -import { CogJob } from './types.js'; -import { basename } from 'path'; export const MaxConcurrencyDefault = 50;