diff --git a/packages/cli/package.json b/packages/cli/package.json index 16456ae5f..ad17105be 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -55,6 +55,7 @@ "ansi-colors": "^4.1.1", "deep-diff": "^1.0.2", "flatgeobuf": "^3.23.1", + "node-fetch": "^3.2.3", "p-limit": "^4.0.0", "pretty-json-log": "^1.0.0", "slugify": "^1.6.5", diff --git a/packages/cli/src/cog/builder.ts b/packages/cli/src/cog/builder.ts index 67838313b..6994ed300 100644 --- a/packages/cli/src/cog/builder.ts +++ b/packages/cli/src/cog/builder.ts @@ -5,7 +5,7 @@ import { CogTiff, TiffTag, TiffTagGeo } from '@cogeotiff/core'; import pLimit, { LimitFunction } from 'p-limit'; import { basename } from 'path'; import { Cutline } from './cutline.js'; // -import { ProjectionLoader } from '@basemaps/shared/src/cog/projection.loader.js'; +import { ProjectionLoader } from '@basemaps/geo/src/proj/projection.loader.js'; import { CogBuilderMetadata, SourceMetadata } from '@basemaps/shared/src/cog/types.js'; export const InvalidProjectionCode = 32767; diff --git a/packages/shared/package.json b/packages/shared/package.json index 835124dd2..d6bb721a8 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -32,7 +32,6 @@ "@linzjs/metrics": "^6.41.0", "aws-sdk": "^2.890.0", "entities": "^4.3.0", - "node-fetch": "^3.2.3", "pino": "^8.6.1", "source-map-support": "^0.5.19", "ulid": "^2.3.0" diff --git a/packages/shared/src/cog/projection.loader.ts b/packages/shared/src/cog/projection.loader.ts deleted file mode 100644 index 72cae9c9f..000000000 --- a/packages/shared/src/cog/projection.loader.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Epsg, Projection } from '@basemaps/geo'; -import fetch from 'node-fetch'; - -export class ProjectionLoader { - // Exposed for testing - static _fetch = fetch; - - /** - * Ensure that a projection EPSG code is avialable for use in Proj4js - * - * If its not already loaded, lookup definition from spatialreference.org - * @param code - */ - static async load(code: number): Promise { - if (Projection.tryGet(code) != null) return Epsg.get(code); - const url = `https://spatialreference.org/ref/epsg/${code}/ogcwkt/`; - - const res = await this._fetch(url); - if (!res.ok) throw new Error('Failed to load projection information for:' + code); - - let epsg = Epsg.tryGet(code); - if (epsg == null) epsg = new Epsg(code); - - const text = await res.text(); - Projection.define(epsg, text); - return epsg; - } -}