Skip to content

Commit

Permalink
Merge pull request #941 from geonetwork/ME-geographical-extent
Browse files Browse the repository at this point in the history
[ME] spatial extents field
  • Loading branch information
Angi-Kinas authored Aug 27, 2024
2 parents 10a614b + a9aa234 commit a6f221e
Show file tree
Hide file tree
Showing 45 changed files with 1,454 additions and 170 deletions.
1 change: 1 addition & 0 deletions apps/metadata-editor/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"styles": [
"tailwind.base.css",
"apps/metadata-editor/src/styles.css",
"node_modules/ol/ol.css",
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
],
"scripts": []
Expand Down
14 changes: 7 additions & 7 deletions apps/metadata-editor/src/app/edit/edit-page.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { ActivatedRoute, Router } from '@angular/router'
import { DATASET_RECORDS, EDITOR_CONFIG } from '@geonetwork-ui/common/fixtures'
import { BehaviorSubject, Subject } from 'rxjs'
import { NotificationsService } from '@geonetwork-ui/feature/notifications'
import { TranslateModule } from '@ngx-translate/core'
import { PageSelectorComponent } from './components/page-selector/page-selector.component'
import { EditorFacade } from '@geonetwork-ui/feature/editor'
import { MockBuilder } from 'ng-mocks'
import { TranslateModule } from '@ngx-translate/core'

const getRoute = () => ({
snapshot: {
Expand Down Expand Up @@ -41,13 +41,13 @@ describe('EditPageComponent', () => {
let facade: EditorFacade
let notificationsService: NotificationsService

beforeEach(() => {
return MockBuilder(EditPageComponent)
})

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
EditPageComponent,
TranslateModule.forRoot(),
PageSelectorComponent,
],
imports: [TranslateModule.forRoot()],
providers: [
{
provide: ActivatedRoute,
Expand Down
3 changes: 1 addition & 2 deletions apps/metadata-editor/src/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import '../../../jest.setup'

import { CommonModule } from '@angular/common'
import { getTestBed } from '@angular/core/testing'
import { MatDialogModule } from '@angular/material/dialog'
import { MatIconModule } from '@angular/material/icon'
import { BrowserModule } from '@angular/platform-browser'
import {
Expand All @@ -15,9 +14,9 @@ import { AvatarServiceInterface } from '@geonetwork-ui/api/repository'
import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface'
import { RecordsRepositoryInterface } from '@geonetwork-ui/common/domain/repository/records-repository.interface'
import { SearchFacade } from '@geonetwork-ui/feature/search'
import { TranslateModule } from '@ngx-translate/core'
import { ngMocks } from 'ng-mocks'
import { BehaviorSubject, EMPTY } from 'rxjs'
import { TranslateModule } from '@ngx-translate/core'

getTestBed().resetTestEnvironment()
getTestBed().initTestEnvironment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,6 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè
<gmd:description>
<gco:CharacterString>Emprise géographique d'Avrigny</gco:CharacterString>
</gmd:description>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>2.5587</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>2.5934</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>49.3677</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>49.4051</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
<gmd:temporalElement>
<gmd:EX_TemporalExtent>
<gmd:extent>
Expand All @@ -169,6 +153,31 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè
</gmd:extent>
</gmd:EX_TemporalExtent>
</gmd:temporalElement>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-11.5</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>43.2</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>35.3</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>81.4</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
<gmd:EX_GeographicDescription>
<gmd:geographicIdentifier>
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>http://www.naturalearthdata.com/ne_admin#Continent/Europe</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:geographicIdentifier>
</gmd:EX_GeographicDescription>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
<gmd:pointOfContact>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,6 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè
<gex:description>
<gco:CharacterString>Région wallonne</gco:CharacterString>
</gex:description>
<gex:geographicElement>
<gex:EX_GeographicBoundingBox>
<gex:westBoundLongitude>
<gco:Decimal>2.75</gco:Decimal>
</gex:westBoundLongitude>
<gex:eastBoundLongitude>
<gco:Decimal>6.50</gco:Decimal>
</gex:eastBoundLongitude>
<gex:southBoundLatitude>
<gco:Decimal>49.45</gco:Decimal>
</gex:southBoundLatitude>
<gex:northBoundLatitude>
<gco:Decimal>50.85</gco:Decimal>
</gex:northBoundLatitude>
</gex:EX_GeographicBoundingBox>
</gex:geographicElement>
<mdb:temporalElement>
<mdb:EX_TemporalExtent>
<mdb:extent>
Expand All @@ -209,6 +193,31 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè
</mdb:extent>
</mdb:EX_TemporalExtent>
</mdb:temporalElement>
<mdb:geographicElement>
<mdb:EX_GeographicBoundingBox>
<mdb:westBoundLongitude>
<gco:Decimal>-11.5</gco:Decimal>
</mdb:westBoundLongitude>
<mdb:eastBoundLongitude>
<gco:Decimal>43.2</gco:Decimal>
</mdb:eastBoundLongitude>
<mdb:southBoundLatitude>
<gco:Decimal>35.3</gco:Decimal>
</mdb:southBoundLatitude>
<mdb:northBoundLatitude>
<gco:Decimal>81.4</gco:Decimal>
</mdb:northBoundLatitude>
</mdb:EX_GeographicBoundingBox>
<mdb:EX_GeographicDescription>
<mdb:geographicIdentifier>
<mcc:MD_Identifier>
<mcc:code>
<gco:CharacterString>http://www.naturalearthdata.com/ne_admin#Continent/Europe</gco:CharacterString>
</mcc:code>
</mcc:MD_Identifier>
</mdb:geographicIdentifier>
</mdb:EX_GeographicDescription>
</mdb:geographicElement>
</gex:EX_Extent>
</mri:extent>
<mri:resourceMaintenance>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,31 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè
</mdb:extent>
</mdb:EX_TemporalExtent>
</mdb:temporalElement>
<mdb:geographicElement>
<mdb:EX_GeographicBoundingBox>
<mdb:westBoundLongitude>
<gco:Decimal>-11.5</gco:Decimal>
</mdb:westBoundLongitude>
<mdb:eastBoundLongitude>
<gco:Decimal>43.2</gco:Decimal>
</mdb:eastBoundLongitude>
<mdb:southBoundLatitude>
<gco:Decimal>35.3</gco:Decimal>
</mdb:southBoundLatitude>
<mdb:northBoundLatitude>
<gco:Decimal>81.4</gco:Decimal>
</mdb:northBoundLatitude>
</mdb:EX_GeographicBoundingBox>
<mdb:EX_GeographicDescription>
<mdb:geographicIdentifier>
<mcc:MD_Identifier>
<mcc:code>
<gco:CharacterString>http://www.naturalearthdata.com/ne_admin#Continent/Europe</gco:CharacterString>
</mcc:code>
</mcc:MD_Identifier>
</mdb:geographicIdentifier>
</mdb:EX_GeographicDescription>
</mdb:geographicElement>
</mdb:EX_Extent>
</mdb:extent>
</mri:MD_DataIdentification>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,31 @@ Cette section contient des *caractères internationaux* (ainsi que des "caractè
</gmd:extent>
</gmd:EX_TemporalExtent>
</gmd:temporalElement>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-11.5</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>43.2</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>35.3</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>81.4</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
<gmd:EX_GeographicDescription>
<gmd:geographicIdentifier>
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>http://www.naturalearthdata.com/ne_admin#Continent/Europe</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:geographicIdentifier>
</gmd:EX_GeographicDescription>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
export interface KeywordApiResponse {
values?: {
eng: string
}
definitions?: {
eng: string
}
values?: Record<string, string>
definitions?: Record<string, string>
coordEast?: string
coordWest?: string
coordSouth?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class Iso19139Converter extends BaseConverter<string> {
distributions: writeDistributions,
onlineResources: writeOnlineResources,
temporalExtents: writeTemporalExtents,
spatialExtents: () => writeSpatialExtents,
spatialExtents: writeSpatialExtents,
// TODO
extras: () => undefined,
landingPage: () => undefined,
Expand Down Expand Up @@ -317,6 +317,8 @@ export class Iso19139Converter extends BaseConverter<string> {
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ const keywords: KeywordApiResponse[] = [
value: 'Addresses',
uri: 'http://inspire.ec.europa.eu/theme/ad',
},
{
values: {
fre: 'France',
},
definitions: {
fre: '',
},
coordEast: '55.855',
coordWest: '-61.798',
coordSouth: '-21.371',
coordNorth: '51.088',
thesaurusKey: 'external.place.regions',
definition: '',
value: 'France',
uri: 'http://www.naturalearthdata.com/ne_admin#Country/FRA',
},
]
const thesaurus: ThesaurusApiResponse[] = [
{
Expand Down Expand Up @@ -77,12 +93,38 @@ describe('Gn4PlatformMapper', () => {
),
type: 'theme',
}
expect(result).toBeInstanceOf(Array)
expect(result[0].label).toBe('Addresses')
expect(result[0].type).toBe('theme')
expect(JSON.stringify(result[0].thesaurus)).toBe(
JSON.stringify(resultThesaurus)
)
expect(result).toEqual([
{
description:
'Location of properties based on address identifiers, usually by road name, house number, postal code.',
key: 'http://inspire.ec.europa.eu/theme/ad',
label: 'Addresses',
thesaurus: {
id: 'external.theme.httpinspireeceuropaeutheme-theme',
name: 'GEMET - INSPIRE themes, version 1.0',
type: 'theme',
url: new URL(
'http://localhost:8080/geonetwork/srv/api/registries/vocabularies/external.theme.httpinspireeceuropaeutheme-theme'
),
},
type: 'theme',
},
{
bbox: [-61.798, -21.371, 55.855, 51.088],
description: '',
key: 'http://www.naturalearthdata.com/ne_admin#Country/FRA',
label: 'France',
thesaurus: {
id: 'external.place.regions',
name: 'Continents, countries, sea regions of the world.',
type: 'place',
url: new URL(
'http://localhost:8080/geonetwork/srv/api/registries/vocabularies/external.place.regions'
),
},
type: 'place',
},
])
})
})
})
13 changes: 12 additions & 1 deletion libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ export class Gn4PlatformMapper {
(thes) => keyword.thesaurusKey === thes.key
)

let bbox: [number, number, number, number]
if (keyword.coordWest) {
bbox = [
parseFloat(keyword.coordWest),
parseFloat(keyword.coordSouth),
parseFloat(keyword.coordEast),
parseFloat(keyword.coordNorth),
]
}

return {
key,
label,
Expand All @@ -90,7 +100,8 @@ export class Gn4PlatformMapper {
url: new URL(matchedThesaurus?.url),
type: matchedThesaurus?.dname as KeywordType,
},
}
...(bbox && { bbox }),
} as Keyword
})
}

Expand Down
Loading

0 comments on commit a6f221e

Please sign in to comment.