Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions src/ingestion/validators/geoValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,24 @@ export class GeoValidator {
// combine all gpkgs sources files geometries (footprints)
const combinedExtent = combineExtentPolygons(features);
this.logger.debug({ msg: 'created combined extent', logContext: logCtx, metadata: { combinedExtent } });
const gpkgBufferedExtent = extentBuffer(this.extentBufferInMeters, combinedExtent);
if (gpkgBufferedExtent === undefined) {
throw new UnsupportedEntityError('buffered gpkg extent is undefined');
}
// read "product.shp" file to check is contained within gpkg extent
const hasFootprintCorrelation = this.hasFootprintCorrelation(gpkgBufferedExtent.geometry, productGeometry);
if (!hasFootprintCorrelation) {
const errorMessage = 'product footprint is not contained by gpkg combined extent';
this.logger.error({
msg: errorMessage,
logContext: logCtx,
metadata: { gpkgBufferedExtent, productGeometry },
});
throw new ValidationError(errorMessage);
if (!this.hasFootprintCorrelation(combinedExtent.geometry, productGeometry)) {
this.logger.info({ msg: 'product footprint is not contained by gpkg combined extent, checking buffered extent', logContext: logCtx });
const gpkgBufferedExtent = extentBuffer(this.extentBufferInMeters, combinedExtent);
if (gpkgBufferedExtent === undefined) {
const errorMessage = 'buffered gpkg extent is undefined';
this.logger.error({ msg: errorMessage, logContext: logCtx });
throw new UnsupportedEntityError(errorMessage);
}
if (!this.hasFootprintCorrelation(gpkgBufferedExtent.geometry, productGeometry)) {
const errorMessage = 'product footprint is not contained by gpkg combined buffered extent';
this.logger.error({
msg: errorMessage,
logContext: logCtx,
metadata: { gpkgBufferedExtent, productGeometry },
});
throw new ValidationError(errorMessage);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/configurations/integration/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = {
branches: 75,
functions: 80,
lines: 80,
statements: -27,
statements: -29,
},
},
};
Loading