diff --git a/src/ingestion/validators/geoValidator.ts b/src/ingestion/validators/geoValidator.ts index 9b83145d..8c052b42 100644 --- a/src/ingestion/validators/geoValidator.ts +++ b/src/ingestion/validators/geoValidator.ts @@ -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); + } } } diff --git a/tests/configurations/integration/jest.config.js b/tests/configurations/integration/jest.config.js index 9e40e7ef..00343b5d 100644 --- a/tests/configurations/integration/jest.config.js +++ b/tests/configurations/integration/jest.config.js @@ -39,7 +39,7 @@ module.exports = { branches: 75, functions: 80, lines: 80, - statements: -27, + statements: -29, }, }, };