Skip to content

Commit

Permalink
feat: aggregation layer metadata (#234)
Browse files Browse the repository at this point in the history
* feat: aggregation layer metadata

* refactor: stricter footprint type

* refactor: naming convention
  • Loading branch information
vitaligi authored Nov 25, 2024
1 parent e680af3 commit 153c12c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/models/layerMetadata/aggregatedLayerMetadata.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { GeoJSON, MultiPolygon, Polygon } from 'geojson';
import type { IMetadataCommonModel } from './interfaces/metadataCommonModel';
import type { ILayerMetadata } from './layerMetadata';

type NonNullableRecord<T extends Record<PropertyKey, unknown>> = {
[K in keyof T]-?: NonNullable<T[K]>;
};

type FlatArraysInRecord<T extends Record<PropertyKey, unknown>> = {
[K in keyof T]: T[K] extends (infer I)[] ? I : T[K];
};

type MakePolygonalRecord<T, P extends keyof T, Q = GeoJSON> = NonNullable<T[P]> extends Q ? Record<P, Polygon | MultiPolygon> : never;

export interface AggregationLayerMetadata
extends NonNullableRecord<
Pick<
ILayerMetadata,
| 'imagingTimeBeginUTC'
| 'imagingTimeEndUTC'
| 'maxResolutionDeg'
| 'minResolutionDeg'
| 'maxResolutionMeter'
| 'minResolutionMeter'
| 'maxHorizontalAccuracyCE90'
| 'minHorizontalAccuracyCE90'
| 'productBoundingBox'
>
>,
FlatArraysInRecord<NonNullableRecord<Pick<ILayerMetadata, 'sensors'>>>,
MakePolygonalRecord<IMetadataCommonModel, 'footprint'> {}

0 comments on commit 153c12c

Please sign in to comment.