diff --git a/src/commands/basemaps-topo-import/gdal/gdal-build-cog.ts b/src/commands/basemaps-topo-import/gdal/gdal-build-cog.ts index 7739eee0..46e418ed 100644 --- a/src/commands/basemaps-topo-import/gdal/gdal-build-cog.ts +++ b/src/commands/basemaps-topo-import/gdal/gdal-build-cog.ts @@ -1,6 +1,5 @@ import { GdalCommand } from '@basemaps/cogify/build/cogify/gdal.runner.js'; - -import { urlToString } from '../../common.js'; +import { urlToString } from '@basemaps/shared'; export const DEFAULT_TRIM_PIXEL_RIGHT = 1.7; diff --git a/src/commands/basemaps-topo-import/gdal/gdal-build-vrt-warp.ts b/src/commands/basemaps-topo-import/gdal/gdal-build-vrt-warp.ts deleted file mode 100644 index d4ee448d..00000000 --- a/src/commands/basemaps-topo-import/gdal/gdal-build-vrt-warp.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { GdalCommand } from '@basemaps/cogify/build/cogify/gdal.runner.js'; -import { Epsg } from '@basemaps/geo'; - -import { urlToString } from '../../common.js'; - -/** - * Constructs a 'gdalwarp' GdalCommand. - * - * @param targetVrt - * @param sourceVrt - * @param sourceProj - * @param opts - * @returns - */ -export function gdalBuildVrtWarp(targetVrt: URL, sourceVrt: URL, sourceProj: Epsg): GdalCommand { - const command: GdalCommand = { - output: targetVrt, - command: 'gdalwarp', - args: [ - ['-multi'], // Mutithread IO - ['-of', 'vrt'], // Output as a VRT - ['-wo', 'NUM_THREADS=ALL_CPUS'], // Multithread the warp - ['-s_srs', sourceProj.toEpsgString()], // Source EPSG - - urlToString(sourceVrt), - urlToString(targetVrt), - ] - .filter((f) => f != null) - .flat() - .map(String), - }; - - return command; -} diff --git a/src/commands/basemaps-topo-import/gdal/gdal-build-vrt.ts b/src/commands/basemaps-topo-import/gdal/gdal-build-vrt.ts index 09892191..d9ac82ef 100644 --- a/src/commands/basemaps-topo-import/gdal/gdal-build-vrt.ts +++ b/src/commands/basemaps-topo-import/gdal/gdal-build-vrt.ts @@ -1,6 +1,5 @@ import { GdalCommand } from '@basemaps/cogify/build/cogify/gdal.runner.js'; - -import { urlToString } from '../../common.js'; +import { urlToString } from '@basemaps/shared'; /** * Constructs a 'gdalBuildVrt' GdalCommand. diff --git a/src/commands/basemaps-topo-import/topo-cog-creation.ts b/src/commands/basemaps-topo-import/topo-cog-creation.ts index bfa9a6e5..58b12bca 100644 --- a/src/commands/basemaps-topo-import/topo-cog-creation.ts +++ b/src/commands/basemaps-topo-import/topo-cog-creation.ts @@ -2,13 +2,13 @@ import { tmpdir } from 'node:os'; import { GdalRunner } from '@basemaps/cogify/build/cogify/gdal.runner.js'; import { createFileStats } from '@basemaps/cogify/build/cogify/stac.js'; -import { Epsg } from '@basemaps/geo'; import { fsa, Tiff } from '@basemaps/shared'; import { CliId } from '@basemaps/shared/build/cli/info.js'; import { command, number, option, optional, restPositionals, string } from 'cmd-ts'; import { mkdir, rm } from 'fs/promises'; import pLimit from 'p-limit'; import path from 'path'; +import ulid from 'ulid'; import { CliInfo } from '../../cli.info.js'; import { logger } from '../../log.js'; @@ -17,7 +17,6 @@ import { config, forceOutput, registerCli, tryParseUrl, verbose } from '../commo import { loadInput } from '../group/group.js'; import { gdalBuildCogCommands as gdalBuildCog } from './gdal/gdal-build-cog.js'; import { gdalBuildVrt } from './gdal/gdal-build-vrt.js'; -import { gdalBuildVrtWarp } from './gdal/gdal-build-vrt-warp.js'; import { MapSheetStacItem } from './types/map-sheet-stac-item.js'; const Q = pLimit(10); @@ -91,7 +90,8 @@ export const topoCogCreation = command({ async function createCogs(input: URL, tmp: URL, pixelTrim?: number): Promise { const startTime = performance.now(); const item = await fsa.readJson(input); - const tmpFolder = new URL(item.id, tmp); + const jobId = ulid.ulid(); + const tmpFolder = new URL(jobId, tmp); try { // Extract the source URL from the item logger.info({ item: item.id }, 'CogCreation:Start'); @@ -131,20 +131,6 @@ async function createCogs(input: URL, tmp: URL, pixelTrim?: number): Promise