Skip to content

feat(map): Resolve STAC inconsistencies across the codebase. BM-1578#87

Open
Wentao-Kuang wants to merge 59 commits intomasterfrom
feat/qgis-deploy-path
Open

feat(map): Resolve STAC inconsistencies across the codebase. BM-1578#87
Wentao-Kuang wants to merge 59 commits intomasterfrom
feat/qgis-deploy-path

Conversation

@Wentao-Kuang
Copy link
Copy Markdown
Contributor

@Wentao-Kuang Wentao-Kuang commented Mar 18, 2026

Motivation

Our current qgis project deployment structure is not correct to put the tag at the top level

./githash/nztopo50map/nz-topo50-map.qgs

We should revert the category as followed, so that we could include more map series in future

qgis:
  - catalog.json
  - nztopo50map:
    - catalog.json

    - latest:
        - collection.json
        - project.qgs # links to release=v0.2.3

    - next:
        - collection.json
        - project.qgs # links to commit=4aba34b5accb0002867af66f6a92a35e0a4be7ca

    - release=v0.0.1:
        - collection.json
        - project.qgs 

    - release=v0.2.3:
        - collection.json
        - project.qgs 

    - pull_request=1: # Mutable
        collection.json
        project.qgs # links to commit=36125a7fbbae012f2809c5f8c3af6a2363c0a305

    - pull_request=2: # Mutable
        collection.json
        project.qgs

    - commit_prefix=3: # Immutable
        - catalog.json
        - commit=36125a7fbbae012f2809c5f8c3af6a2363c0a305:
            collection.json
            project.qgs
        - commit=3dfee564ea82f3da4ae16b84f5fe4a833e4c89d1:
            collection.json
            project.qgs

    - commit_prefix=4: # Immutable
        - catalog.json
        - commit=4aba34b5accb0002867af66f6a92a35e0a4be7ca:
            collection.json
            project.qgs

Modifications

  • Correct all the paths.
  • Add addition catalog under the mapseries level as followed. ./nztopo50map/catalog.json

Verification

image image

https://github.com/linz/topographic-qgis/actions/runs/23275314183/job/67676963416?pr=16

@Wentao-Kuang Wentao-Kuang changed the title feat(map): Update the order of qgis project deployment path feat(map): Update the order of qgis project deployment path into hive structure. BM-1577 Mar 18, 2026
@Wentao-Kuang Wentao-Kuang added the container build pull request container for testing label Mar 18, 2026
@github-actions
Copy link
Copy Markdown

Changes Summary

Total Features Changed: 0
Datasets Affected: 0
Git Diff Lines: 1

Kart Diff

Kart Diff (0 features)

Git Diff

Git Diff (1 lines)

@Wentao-Kuang Wentao-Kuang added container build pull request container for testing and removed container build pull request container for testing labels Mar 19, 2026
@Wentao-Kuang Wentao-Kuang added container build pull request container for testing and removed container build pull request container for testing labels Mar 19, 2026
Comment on lines +232 to 233
// const rootCatalog = new URL('catalog.json', args.output);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// const rootCatalog = new URL('catalog.json', args.output);

export function qFromArgs(args: {} | { concurrency?: number }): LimitFunction {
if ('concurrency' in args && typeof args.concurrency === 'number') return pLimit(args.concurrency);
return pLimit(qLimitDefault);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does the limiter want to live in shared?

}

/**
* Recursively find the target data collection.json from the root catalog,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Recursively find the target data collection.json from the root catalog,
* Recursively find the target data latest/collection.json from the root catalog,

* @param stacUrl The URL of the root STAC catalog.
* @param layerName The name of the vector layer to find.
*
* @returns Target data collection.json URL if found, otherwise throws an error.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @returns Target data collection.json URL if found, otherwise throws an error.
* @returns Target data latest/collection.json URL if found, otherwise throws an error.

*
* @returns Target data collection.json URL if found, otherwise throws an error.
*/
export async function getDataFromCatalog(stacUrl: URL, layerName: string): Promise<URL> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this accept an optional version that defaults to latest?

}

const dataLink = catalog.links.find((link) => link.href.endsWith('/data/catalog.json'));
if (dataLink) return getDataFromCatalog(new URL(dataLink.href, stacUrl), layerName);
Copy link
Copy Markdown
Contributor

@schmidtnz schmidtnz Mar 31, 2026

Choose a reason for hiding this comment

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

Am I misreading this or does this only really recurse into nested layers of data/data/data/.../data/layer/ directories?
Can we just return a link to new URL('/data/layer/latest/collection.json', stacUrl) if that exists, instead of all this magic?

const name = col.meta_data.path_in_schema.join('.');
const current = (tableStats[name] ??= { name, type: col.meta_data.type.toLowerCase() });
aggregateStats(current, col);
if (createDateKey !== 'create_date' && name.endsWith('_date')) createDateKey = name;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

createDateKey will end up with the value create_date (if present) or the last column ending in _date.
It might make more sense to

  • use any known date field
    OR
  • rely on only one known field (in which case, updated would make more sense than created?)

for the temporal extents.

Comment on lines +9 to +10
const sourcefile = new URL('https://foo.com/foo/bar/collection.json');
const sourceDir = new URL('.', sourcefile);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
const sourcefile = new URL('https://foo.com/foo/bar/collection.json');
const sourceDir = new URL('.', sourcefile);
const sourceFile = new URL('https://foo.com/foo/bar/collection.json');
const sourceDir = new URL('https://foo.com/foo/bar/');

NIT - I'd prefer this to be set explicitly

});

it('should not make relative if protocol hosts or other parts differ', () => {
assert.equal(getRelativePath(new URL('s3://foo/a.txt'), new URL('s3://foo/b.txt')), './a.txt');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't testing what it says.

Suggested change
assert.equal(getRelativePath(new URL('s3://foo/a.txt'), new URL('s3://foo/b.txt')), './a.txt');
assert.equal(getRelativePath(new URL('s3://foo/a.txt'), new URL('s3://bar/b.txt')), 's3://foo/a.txt');


function extendItemFromCollection(base: StacItem, extension: StacCollection) {
const bounds = [];
if (base.geometry) bounds.push(normalizePolygonToMultiPolygon(base));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

extract bit that's shared between this and extendCollectionFromItem into a separate function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

container build pull request container for testing

Development

Successfully merging this pull request may close these issues.

3 participants