Skip to content

Commit

Permalink
feat: updated models (#93)
Browse files Browse the repository at this point in the history
* feat: updated models

* fix: remove numeric length from maxResolutionMeter

* fix: incloded in bast db type override

* feat: added product bbox field

* fix: change resolution filed db type to varchar
  • Loading branch information
cl-shaharshavit-rnd authored Oct 10, 2021
1 parent 3c02cb8 commit 7ccb8cd
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/models/layerMetadata/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ export enum SensorType {
// eslint-disable-next-line
Pan_Sharpen = 'Pan_Sharpen',
OTHER = 'OTHER',
UNDEFINED = 'UNDEFINED',
}

export enum ProductType {
ORTHOPHOTO = 'Orthophoto',
ORTHOPHOTO_HISTORY = 'OrthophotoHistory',
RASTER_MAP = 'RasterMap',
VECTOR_MAP = 'VectorMap',
VECTOR = 'Vector',
Expand Down
104 changes: 89 additions & 15 deletions src/models/layerMetadata/layerMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
//#region COMMON: creationDate
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:creationDate',
queryableField: 'mc:creationDate',
xmlElement: 'mc:creationDateUTC',
queryableField: 'mc:creationDateUTC',
pycswField: 'pycsw:CreationDate',
})
@catalogDB({
Expand Down Expand Up @@ -252,8 +252,8 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
//#region COMMON: updateDate
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:updateDate',
queryableField: 'mc:updateDate',
xmlElement: 'mc:updateDateUTC',
queryableField: 'mc:updateDateUTC',
pycswField: 'pycsw:UpdateDate',
})
@catalogDB({
Expand Down Expand Up @@ -282,8 +282,8 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
//#region COMMON: sourceDateStart
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:imagingTime_begin',
queryableField: 'mc:imagingTime_begin',
xmlElement: 'mc:imagingTime_beginUTC',
queryableField: 'mc:imagingTime_beginUTC',
pycswField: 'pycsw:TempExtent_begin',
})
@catalogDB({
Expand Down Expand Up @@ -312,8 +312,8 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
//#region COMMON: sourceDateEnd
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:imagingTime_end',
queryableField: 'mc:imagingTime_end',
xmlElement: 'mc:imagingTime_endUTC',
queryableField: 'mc:imagingTime_endUTC',
pycswField: 'pycsw:TempExtent_end',
})
@catalogDB({
Expand Down Expand Up @@ -342,8 +342,8 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
//#region COMMON: accuracyCE90
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:horizontalAccuracyCE90',
queryableField: 'mc:horizontalAccuracyCE90',
xmlElement: 'mc:minHorizontalAccuracyCE90',
queryableField: 'mc:minHorizontalAccuracyCE90',
pycswField: 'pycsw:horizontalAccuracyCE90',
})
@catalogDB({
Expand Down Expand Up @@ -371,8 +371,8 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
//#region COMMON: sensorType //sensors
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:sensorType',
queryableField: 'mc:sensorType',
xmlElement: 'mc:sensors',
queryableField: 'mc:sensors',
pycswField: 'pycsw:sensorType',
})
@catalogDB({
Expand Down Expand Up @@ -552,14 +552,14 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
//#region RASTER: resolution
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:resolution',
queryableField: 'mc:resolution',
xmlElement: 'mc:maxResolutionDeg',
queryableField: 'mc:maxResolutionDeg',
pycswField: 'pycsw:Resolution',
})
@catalogDB({
column: {
name: 'resolution',
type: 'real', // check if 'decimal' type is needed
type: 'text',
},
})
@inputDataMapping({
Expand All @@ -578,6 +578,35 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
//#endregion
public resolution: number | undefined = undefined;

//#region RASTER: maxResolutionMeter
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:maxResolutionMeter',
queryableField: 'mc:maxResolutionMeter',
pycswField: 'pycsw:maxResolutionMeter',
})
@catalogDB({
column: {
name: 'max_resolution_meter',
type: 'varchar', // varchar(10) as pycsw only support unicode/binary values
},
})
@inputDataMapping({
dataFile: DataFileType.SHAPE_METADATA,
valuePath: 'features[0].properties.Resolution',
})
@tsTypes({
mappingType: TsTypes.NUMBER,
})
@graphql({
nullable: true,
})
@fieldConfig({
category: FieldCategory.MAIN,
})
//#endregion
public maxResolutionMeter: number | undefined = undefined;

//#region RASTER: rms
@pycsw({
profile: 'mc_raster',
Expand Down Expand Up @@ -701,6 +730,9 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
type: 'text',
nullable: true,
},
field: {
overrideType: TsTypes.STRING,
},
})
@tsTypes({
mappingType: TsTypes.STRING_ARRAY,
Expand All @@ -710,6 +742,48 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
})
//#endregion
public includedInBests: string[] | undefined = undefined;

//#region RASTER: rawProductData
@catalogDB({
column: {
name: 'raw_product_data',
type: 'jsonb',
},
})
@inputDataMapping({
isCustomLogic: true,
dataFile: DataFileType.PRODUCT,
valuePath: '*** entire product shape file geo json ***',
})
@tsTypes({
mappingType: TsTypes.OBJECT,
})
//#endregion
public rawProductData: GeoJSON | undefined = undefined;

//#region RASTER: productBoundingBox
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:productBBox',
queryableField: 'mc:productBBox',
pycswField: 'pycsw:productBBox',
})
@catalogDB({
column: {
name: 'product_bbox',
type: 'varchar', // VARCHAR(255)
nullable: true,
},
})
@tsTypes({
mappingType: TsTypes.STRING,
})
@graphql({
nullable: true,
})
//#endregion
public productBoundingBox: string | undefined = undefined;

//#endregion

public static getPyCSWMapping(prop: string): IPYCSWMapping | undefined {
Expand Down
10 changes: 10 additions & 0 deletions src/yaml/updateLayerMetadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ components:
type: string
enum:
- Orthophoto
- OrthophotoHistory
- RasterMap
- VectorMap
- Vector
Expand Down Expand Up @@ -75,6 +76,9 @@ components:
resolution:
type: number
description: Resolution of tiff files
maxResolutionMeter:
type: number
description: max (rounded) resolution of layer in meters/pixel
accuracyCE90:
type: number
description: Horizontal Accuracy
Expand All @@ -87,6 +91,7 @@ components:
- RGB
- Pan_Sharpen
- OTHER
- UNDEFINED
description: The sensor type
region:
type: string
Expand All @@ -99,6 +104,11 @@ components:
$ref: geojson.yaml#/components/schemas/Geometry
layerPolygonParts:
$ref: geojson.yaml#/components/schemas/FeatureCollection
rawProductData:
$ref: geojson.yaml#/components/schemas/FeatureCollection
productBoundingBox:
type: string

updateStatusLayerMetadata:
type: object
description: Metadata for layer status
Expand Down

0 comments on commit 7ccb8cd

Please sign in to comment.