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

feat(basemaps): Topo raster maps standardisation workflow. BM-1128 #932

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Wentao-Kuang
Copy link
Contributor

@Wentao-Kuang Wentao-Kuang commented Jan 12, 2025

Motivation

As a Basemaps user, I want to consume the NZTopo 50 & 250 Maps as a tile service.

Modification

This work defines a new Argo Workflow. The workflow's purpose is to coordinate the standardisation of an NZTopo Map Series imagery collection. We have designed the workflow to process the following collections stored in the AWS S3 TopoReleaseArchive directory:

s3://topographic-upload/TopoReleaseArchive/NZTopo50_GeoTif_Gridless/
s3://topographic-upload/TopoReleaseArchive/NZTopo250_GeoTif_Gridless/

This workflow has two key steps:

For a NZTopo Map Series imagery collection:

  1. Generate STAC Item and Collection files
  2. Standardise the containing imagery

Checklist

If not applicable, provide explanation of why.

  • Tests updated
  • Docs updated
  • Issue linked in Title

Comment on lines 227 to 241
container:
image: 019359803926.dkr.ecr.ap-southeast-2.amazonaws.com/argo-tasks:{{workflow.parameters.version_argo_tasks}}
command: [node, /app/index.js]
env:
- name: AWS_ROLE_CONFIG_PATH
value: s3://linz-bucket-config/config.json
args:
- 'bmc'
- 'topo-stac-creation'
- '--source={{ inputs.parameters.source }}'
- '--target={{ inputs.parameters.target }}'
- '--title={{ inputs.parameters.title }}'
- '--scale={{ inputs.parameters.scale }}'
- '--resolution={{ inputs.parameters.resolution }}'
- '--latest-only={{ inputs.parameters.latest-only }}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
container:
image: 019359803926.dkr.ecr.ap-southeast-2.amazonaws.com/argo-tasks:{{workflow.parameters.version_argo_tasks}}
command: [node, /app/index.js]
env:
- name: AWS_ROLE_CONFIG_PATH
value: s3://linz-bucket-config/config.json
args:
- 'bmc'
- 'topo-stac-creation'
- '--source={{ inputs.parameters.source }}'
- '--target={{ inputs.parameters.target }}'
- '--title={{ inputs.parameters.title }}'
- '--scale={{ inputs.parameters.scale }}'
- '--resolution={{ inputs.parameters.resolution }}'
- '--latest-only={{ inputs.parameters.latest-only }}'
container:
image: ghcr.io/linz/basemaps/cli:{{ workflow.parameters.version_basemaps_cli }}
command: [node, /app/node_modules/@basemaps/cogify/dist/index.cjs]
env:
- name: AWS_ROLE_CONFIG_PATH
value: s3://linz-bucket-config/config.json
args:
- 'stac'
- '--source={{ inputs.parameters.source }}'
- '--target={{ inputs.parameters.target }}'
- '--title={{ inputs.parameters.title }}'
- '--scale={{ inputs.parameters.scale }}'
- '--resolution={{ inputs.parameters.resolution }}'
- '--latest-only={{ inputs.parameters.latest-only }}'

We are in the process of migrating the Argo Task work to Basemaps. The former topo-stac-creation Argo Task can now be executed by way of the Cogify CLI's stac command. The workflow should be updated as per this suggestion.

@tawera-manaena
Copy link

tawera-manaena commented Feb 24, 2025

@Wentao-Kuang - I've made a minor adjustment to the workflow in Argo. We need to bring those changes here.

Before

        artifacts:
          - name: tiles
            path: /tmp/topo-stac-creation/tiles.json
          - name: brokenTiffs
            path: /tmp/topo-stac-creation/brokenTiffs.json

After

        artifacts:
          - name: tiles
            path: /tmp/topo-stac-creation/tiles.json
          - name: brokenTiffs
            path: /tmp/topo-stac-creation/broken-tiffs.json

@tawera-manaena tawera-manaena changed the title feat(basemaps): Topo raster maps standerised workflow. BM-1128 feat(basemaps): Topo raster maps standardisation workflow. BM-1128 Feb 26, 2025
@Wentao-Kuang Wentao-Kuang marked this pull request as ready for review February 27, 2025 00:39
@Wentao-Kuang Wentao-Kuang requested review from a team as code owners February 27, 2025 00:39
github-merge-queue bot pushed a commit to linz/basemaps that referenced this pull request Feb 27, 2025
…1116 (#3388)

### Motivation

As a Basemaps user, I want to consume the NZTopo 50 & 250 Maps [as a
tile service].

### Modifications

This work comprises a series of additions and modifications to the
`basemaps/cogify` package.

These changes allow us to generate [STAC] files for an NZTopo Map Series
imagery collection. They also allow us to generate standardised and
cloud-optimised GeoTIFFs from the map sheet files of such collections.
We have adjusted the `basemaps/cogify` package to handle the following
collections stored in the AWS S3 [TopoReleaseArchive] directory:

```
s3://topographic-upload/TopoReleaseArchive/NZTopo50_GeoTif_Gridless/
s3://topographic-upload/TopoReleaseArchive/NZTopo250_GeoTif_Gridless/
``` 

There is also a [new Argo workflow in development][pr-argo-workflow]
that depends on this work as part of its process flow. The workflow's
purpose is to automate the standardisation of an NZTopo Map Series
imagery collection.

### Generating STAC files

This works defines a new process for generating a nested directory
structure of STAC files for an NZTopo Map Series imagery collection. The
process operates as follows:

1. Loads the collection of GeoTiff images into memory
6. Extracts the map code, version, and metadata (e.g. EPSG) from each
image
7. Identifies the latest version of each map sheet by code
8. Groups the images by EPSG
9. Generates a StacItem file for each image, and a StacCollection file
for each EPSG grouping
10. Structures the groups of StacItem and StacCollection files into a
directory tree
11. Saves the files as they are structured to a target location

#### Outputs

The command groups the images by EPSG and then structures the generated
StacItem and StacCollection files, as illustrated:

| Schema | Example |
| - | - |
| ![][schema] | ![][example] |

The command then saves the generated tree of folders and files into the
target location directory.

### Processing Map Sheet files

This work extends the `create` CLI command of the `basemaps/cogify`
package. This extension allows the command to recognise and process the
map sheet files of an NZTopo Map Series imagery collection by way of
particular properties added to the accompanying STAC files.

[as a tile service]:
#3365 (comment)
[STAC]: https://stacspec.org/en
[TopoReleaseArchive]:
https://linz-topographic-upload.s3.ap-southeast-2.amazonaws.com/topographic/TopoReleaseArchive/

[pr-argo-workflow]: linz/topo-workflows#932

[schema]:
https://github.com/user-attachments/assets/2f4eddd7-eb2c-4796-8ab7-b3d9eca9140f
[example]:
https://github.com/user-attachments/assets/8f111ba6-befd-44b5-9566-db07a07089ed

---------

Co-authored-by: Blayne Chard <bchard@linz.govt.nz>
Co-authored-by: Tawera Manaena <TManaena@linz.govt.nz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants