From 321ae563119182a30e6e68f772e0573ce1568bba Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Mon, 26 Aug 2024 16:01:56 +0200 Subject: [PATCH] fix(converter): properly write and read spatial extents in XML --- ...eneric-dataset+geo2france-plu.iso19139.xml | 41 +++++++++++-------- .../generic-dataset+metawal.iso19115-3.xml | 41 +++++++++++-------- .../fixtures/generic-dataset.iso19115-3.xml | 25 +++++++++++ .../lib/fixtures/generic-dataset.iso19139.xml | 25 +++++++++++ .../src/lib/fixtures/generic.records.ts | 7 +++- .../src/lib/iso19139/iso19139.converter.ts | 4 +- 6 files changed, 109 insertions(+), 34 deletions(-) diff --git a/libs/api/metadata-converter/src/lib/fixtures/generic-dataset+geo2france-plu.iso19139.xml b/libs/api/metadata-converter/src/lib/fixtures/generic-dataset+geo2france-plu.iso19139.xml index cb39432b77..fd5058ace3 100644 --- a/libs/api/metadata-converter/src/lib/fixtures/generic-dataset+geo2france-plu.iso19139.xml +++ b/libs/api/metadata-converter/src/lib/fixtures/generic-dataset+geo2france-plu.iso19139.xml @@ -134,22 +134,6 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè Emprise géographique d'Avrigny - - - - 2.5587 - - - 2.5934 - - - 49.3677 - - - 49.4051 - - - @@ -169,6 +153,31 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè + + + + -11.5 + + + 43.2 + + + 35.3 + + + 81.4 + + + + + + + http://www.naturalearthdata.com/ne_admin#Continent/Europe + + + + + diff --git a/libs/api/metadata-converter/src/lib/fixtures/generic-dataset+metawal.iso19115-3.xml b/libs/api/metadata-converter/src/lib/fixtures/generic-dataset+metawal.iso19115-3.xml index a4ac9733a8..66d395dd94 100644 --- a/libs/api/metadata-converter/src/lib/fixtures/generic-dataset+metawal.iso19115-3.xml +++ b/libs/api/metadata-converter/src/lib/fixtures/generic-dataset+metawal.iso19115-3.xml @@ -174,22 +174,6 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè Région wallonne - - - - 2.75 - - - 6.50 - - - 49.45 - - - 50.85 - - - @@ -209,6 +193,31 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè + + + + -11.5 + + + 43.2 + + + 35.3 + + + 81.4 + + + + + + + http://www.naturalearthdata.com/ne_admin#Continent/Europe + + + + + diff --git a/libs/api/metadata-converter/src/lib/fixtures/generic-dataset.iso19115-3.xml b/libs/api/metadata-converter/src/lib/fixtures/generic-dataset.iso19115-3.xml index 8e9f5ba9a3..3895cbf194 100644 --- a/libs/api/metadata-converter/src/lib/fixtures/generic-dataset.iso19115-3.xml +++ b/libs/api/metadata-converter/src/lib/fixtures/generic-dataset.iso19115-3.xml @@ -459,6 +459,31 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè + + + + -11.5 + + + 43.2 + + + 35.3 + + + 81.4 + + + + + + + http://www.naturalearthdata.com/ne_admin#Continent/Europe + + + + + diff --git a/libs/api/metadata-converter/src/lib/fixtures/generic-dataset.iso19139.xml b/libs/api/metadata-converter/src/lib/fixtures/generic-dataset.iso19139.xml index 51ae0d83c6..ddbbfd6455 100644 --- a/libs/api/metadata-converter/src/lib/fixtures/generic-dataset.iso19139.xml +++ b/libs/api/metadata-converter/src/lib/fixtures/generic-dataset.iso19139.xml @@ -412,6 +412,31 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè + + + + -11.5 + + + 43.2 + + + 35.3 + + + 81.4 + + + + + + + http://www.naturalearthdata.com/ne_admin#Continent/Europe + + + + + diff --git a/libs/api/metadata-converter/src/lib/fixtures/generic.records.ts b/libs/api/metadata-converter/src/lib/fixtures/generic.records.ts index f020b13392..ba81be6494 100644 --- a/libs/api/metadata-converter/src/lib/fixtures/generic.records.ts +++ b/libs/api/metadata-converter/src/lib/fixtures/generic.records.ts @@ -194,7 +194,12 @@ As such, **it is not very interesting at all.**`, text: 'Contains sensitive information related to national defense', }, ], - spatialExtents: [], + spatialExtents: [ + { + bbox: [-11.5, 35.3, 43.2, 81.4], + description: 'http://www.naturalearthdata.com/ne_admin#Continent/Europe', + }, + ], temporalExtents: [ { start: new Date('2024-05-24'), diff --git a/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts b/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts index 5cea18f02e..06ace0505a 100644 --- a/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts +++ b/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts @@ -141,7 +141,7 @@ export class Iso19139Converter extends BaseConverter { distributions: writeDistributions, onlineResources: writeOnlineResources, temporalExtents: writeTemporalExtents, - spatialExtents: () => writeSpatialExtents, + spatialExtents: writeSpatialExtents, // TODO extras: () => undefined, landingPage: () => undefined, @@ -317,6 +317,8 @@ export class Iso19139Converter extends BaseConverter { fieldChanged('overviews') && this.writers['overviews'](record, rootEl) fieldChanged('temporalExtents') && this.writers['temporalExtents'](record, rootEl) + fieldChanged('spatialExtents') && + this.writers['spatialExtents'](record, rootEl) fieldChanged('distributions') && this.writers['distributions'](record, rootEl) fieldChanged('lineage') && this.writers['lineage'](record, rootEl)