generated from linz/template-javascript-hello-world
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: append slug and tile matrix metadata to generated Stac Item files
- Loading branch information
1 parent
7b8b839
commit 75dc131
Showing
5 changed files
with
65 additions
and
13 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/commands/basemaps-topo-import/mappers/map-epsg-to-slug.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { EpsgCode } from '@basemaps/geo'; | ||
|
||
import { logger } from '../../../log.js'; | ||
|
||
const slugs: { [key in EpsgCode]?: string } = { | ||
[EpsgCode.Nztm2000]: 'new-zealand-mainland', | ||
[EpsgCode.Citm2000]: 'chatham-islands', | ||
}; | ||
|
||
/** | ||
* Attempts to map the given EpsgCode enum to a slug. | ||
* | ||
* @param epsg: The EpsgCode enum to map to a slug | ||
* | ||
* @returns if succeeded, a slug string. Otherwise, null. | ||
*/ | ||
export function mapEpsgToSlug(epsg: EpsgCode): string | null { | ||
const slug = slugs[epsg]; | ||
|
||
if (slug == null) { | ||
logger.info({ found: false }, 'mapEpsgToSlug()'); | ||
return null; | ||
} | ||
|
||
logger.info({ found: true }, 'mapEpsgToSlug()'); | ||
return slug; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters