Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): use the STAC title if it exists as the imagery title BM-784 #2692

Merged
merged 2 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/cli/src/cli/cogify/action.make.cog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<string[][]> {
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/src/cog/cog.stac.job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/src/cog/job.factory.ts
Original file line number Diff line number Diff line change
@@ -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;

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