feat(map): Resolve STAC inconsistencies across the codebase. BM-1578#87
feat(map): Resolve STAC inconsistencies across the codebase. BM-1578#87Wentao-Kuang wants to merge 59 commits intomasterfrom
Conversation
Changes SummaryTotal Features Changed: 0 Kart DiffKart Diff (0 features)Git DiffGit Diff (1 lines) |
| // const rootCatalog = new URL('catalog.json', args.output); | ||
|
|
There was a problem hiding this comment.
| // 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); | ||
| } |
There was a problem hiding this comment.
does the limiter want to live in shared?
| } | ||
|
|
||
| /** | ||
| * Recursively find the target data collection.json from the root catalog, |
There was a problem hiding this comment.
| * 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. |
There was a problem hiding this comment.
| * @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> { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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,
updatedwould make more sense thancreated?)
for the temporal extents.
| const sourcefile = new URL('https://foo.com/foo/bar/collection.json'); | ||
| const sourceDir = new URL('.', sourcefile); |
There was a problem hiding this comment.
| 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'); |
There was a problem hiding this comment.
This isn't testing what it says.
| 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)); |
There was a problem hiding this comment.
extract bit that's shared between this and extendCollectionFromItem into a separate function?
Motivation
Our current qgis project deployment structure is not correct to put the tag at the top level
We should revert the category as followed, so that we could include more map series in future
Modifications
./nztopo50map/catalog.jsonVerification
https://github.com/linz/topographic-qgis/actions/runs/23275314183/job/67676963416?pr=16