Skip to content

Commit

Permalink
docs: expand docs on attribution
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha committed Sep 23, 2024
1 parent 963e91e commit 81734fd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
40 changes: 40 additions & 0 deletions packages/geo/src/stac/stac.attribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,59 @@ import { StacCatalog, StacCollection, StacItem } from './index.js';
* A Single File STAC compliant collection with zoom and priority for calculating attribution of an extent
*/
export type AttributionCollection = StacCollection<{
/**
* Category of the layer
*
* @example "Urban Aerial Photos"
*/
'linz:category'?: string;

/**
* Zoom levels that the layer is visit
*/
'linz:zoom': { min: number; max: number };

/**
* Priority order for the layer
*
* The higher the number the higher the priority
*
* @example [1077]
*/
'linz:priority': [number];
}>;

/**
* A Single File STAC compliant feature for calculating attribution of an extent
*/
export type AttributionItem = StacItem<{
/**
* Human friendly title of the layer
*
* @example "Whanganui 0.075m Urban Aerial Photos (2017)"
*/
title: string;

/**
* Category of the layer
*
* @example "Urban Aerial Photos"
*/
category?: string;

/**
* datetime is null as per STAC requirement when {@link start_datetime} and {@link end_datetime} are set
*/
datetime?: null;

/**
* datetime of when the layer started being captured
*/
start_datetime?: string;

/**
* datetime of when the layer stopped being captured
*/
end_datetime?: string;
}>;

Expand Down
3 changes: 3 additions & 0 deletions packages/lambda-tiler/src/routes/attribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ async function tileSetAttribution(
for (const layer of tileSet.layers) {
const imgId = layer[proj.epsg.code];
if (imgId == null) continue;

const im = imagery.get(imgId);
if (im == null) continue;

const title = im.title;
const years = extractYearRangeFromTitle(im.title) ?? extractYearRangeFromName(im.name);

if (years == null) continue;
const interval = yearRangeToInterval(years);

Expand Down

0 comments on commit 81734fd

Please sign in to comment.