Skip to content

Commit

Permalink
Fix formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RobQuincey-DC committed Jul 16, 2024
1 parent afb4c89 commit 057c3a6
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 71 deletions.
2 changes: 1 addition & 1 deletion app/src/components/wfs/WfsFeatureTypeInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default {
'geometry type': this.featureType.geometryType,
}),
...('keywords' in this.featureType && {
'keywords': this.featureType.keywords,
keywords: this.featureType.keywords,
}),
};
},
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/wms/WmsLayerInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default {
this.layer.attribution.title && {
attribution: this.layer.attribution.title,
}),
...(this.layer.keywords && {keywords: this.layer.keywords})
...(this.layer.keywords && { keywords: this.layer.keywords }),
};
},
fullMapSrc() {
Expand Down
21 changes: 4 additions & 17 deletions src/wfs/capabilities.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ describe('WFS capabilities', () => {
abstract:
'Registre Parcellaire Graphique 2010 en Aquitaine - Agence de Service et de Paiement',
defaultCrs: 'EPSG:2154',
keywords: [
"features",
"rpg2010",
],
keywords: ['features', 'rpg2010'],
latLonBoundingBox: [
-1.9540704007796161, 42.73286181824404, 1.496463327812538,
45.717071228823876,
Expand All @@ -57,10 +54,7 @@ describe('WFS capabilities', () => {
abstract:
'Représentation des moyennes journalières des trafics routiers sur les routes départementales de la\n Charente (16) au 1er Janvier 2021.\n\n Mise à jour : Mars 2021\n ',
defaultCrs: 'EPSG:2154',
keywords: [
"features",
"comptages_routiers_l",
],
keywords: ['features', 'comptages_routiers_l'],
latLonBoundingBox: [
-0.4906009184568518, 45.175543885638376, 0.9778719979726385,
46.14349349624617,
Expand All @@ -80,10 +74,7 @@ describe('WFS capabilities', () => {
abstract:
'Hiérarchisation du réseau routier départemental en fonction des caractéristiques de chaque section\n de route et de son usage au 1er Janvier 2021.\n\n Mise à jour : Mars 2021\n ',
defaultCrs: 'EPSG:2154',
keywords: [
"features",
"hierarchisation_l",
],
keywords: ['features', 'hierarchisation_l'],
latLonBoundingBox: [
-0.4832134559131876, 45.18037755571674, 0.9725372441782966,
46.13877580094452,
Expand Down Expand Up @@ -143,11 +134,7 @@ describe('WFS capabilities', () => {
expect(featureTypes[0]).toEqual({
abstract: 'Domaine public',
defaultCrs: 'EPSG:2154',
keywords: [
"domaine_public_hdf_com",
"domaine",
"public"
],
keywords: ['domaine_public_hdf_com', 'domaine', 'public'],
latLonBoundingBox: [
1.3472171890368316, 48.82764887581316, 4.285589467078578,
51.0896786738123,
Expand Down
21 changes: 10 additions & 11 deletions src/wfs/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,15 @@ function parseFeatureType(
).map(getElementText);

const keywords = serviceVersion.startsWith('1.0')
? getElementText(
findChildElement(featureTypeEl, 'Keywords'))
.split(',')
.map(keyword => keyword.trim())
: findChildrenElement(
findChildElement(featureTypeEl, 'Keywords'),
'Keyword'
)
.map(getElementText)
.filter((v, i, arr) => arr.indexOf(v) === i);
? getElementText(findChildElement(featureTypeEl, 'Keywords'))
.split(',')
.map((keyword) => keyword.trim())
: findChildrenElement(
findChildElement(featureTypeEl, 'Keywords'),
'Keyword'
)
.map(getElementText)
.filter((v, i, arr) => arr.indexOf(v) === i);
return {
name: getElementText(findChildElement(featureTypeEl, 'Name')),
title: getElementText(findChildElement(featureTypeEl, 'Title')),
Expand All @@ -182,6 +181,6 @@ function parseFeatureType(
latLonBoundingBox: serviceVersion.startsWith('1.0')
? parseBBox100()
: parseBBox(),
keywords: keywords
keywords: keywords,
};
}
10 changes: 2 additions & 8 deletions src/wfs/endpoint.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,7 @@ describe('WfsEndpoint', () => {
46.13877580094452,
],
defaultCrs: 'EPSG:2154',
"keywords": [
"features",
"hierarchisation_l",
],
keywords: ['features', 'hierarchisation_l'],
otherCrs: ['EPSG:32615', 'EPSG:32616', 'EPSG:32617', 'EPSG:32618'],
outputFormats: [
'application/gml+xml; version=3.2',
Expand Down Expand Up @@ -174,10 +171,7 @@ describe('WfsEndpoint', () => {
46.13877580094452,
],
defaultCrs: 'EPSG:2154',
"keywords": [
"features",
"hierarchisation_l",
],
keywords: ['features', 'hierarchisation_l'],
otherCrs: ['EPSG:32615', 'EPSG:32616', 'EPSG:32617', 'EPSG:32618'],
outputFormats: [
'application/gml+xml; version=3.2',
Expand Down
2 changes: 1 addition & 1 deletion src/wfs/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default class WfsEndpoint {
defaultCrs: featureType.defaultCrs,
otherCrs: featureType.otherCrs,
outputFormats: featureType.outputFormats,
keywords: featureType.keywords
keywords: featureType.keywords,
} as WfsFeatureTypeSummary;
}

Expand Down
4 changes: 2 additions & 2 deletions src/wfs/featuretypeinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function parseFeatureTypeInfo(
otherCrs,
outputFormats,
latLonBoundingBox: boundingBox,
keywords
keywords,
} = featureType;

const hitsAttr = serviceVersion.startsWith('2.0')
Expand Down Expand Up @@ -78,7 +78,7 @@ export function parseFeatureTypeInfo(
...(geometryName && { geometryName }),
...(geometryType && { geometryType }),
...(!Number.isNaN(objectCount) && { objectCount }),
...(keywords && {keywords})
...(keywords && { keywords }),
};
}

Expand Down
36 changes: 12 additions & 24 deletions src/wms/capabilities.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ describe('WMS capabilities', () => {
'EPSG:4326': ['-180', '-90', '180', '90'],
},
keywords: [
"Géologie",
"BRGM",
"INSPIRE:ViewService",
"infoMapAccessService",
"WMS 1.1.1",
"WMS 1.3.0",
"SLD 1.1.0",
],
'Géologie',
'BRGM',
'INSPIRE:ViewService',
'infoMapAccessService',
'WMS 1.1.1',
'WMS 1.3.0',
'SLD 1.1.0',
],
name: 'GEOSERVICES_GEOLOGIE',
styles: [
{
Expand Down Expand Up @@ -127,11 +127,7 @@ describe('WMS capabilities', () => {
],
'EPSG:4326': ['-5.86764', '41.1701', '11.0789', '51.1419'],
},
"keywords": [
"Geologie",
"INSPIRE:Geology",
"Geology",
],
keywords: ['Geologie', 'INSPIRE:Geology', 'Geology'],
name: 'SCAN_F_GEOL1M',
styles: [
{
Expand Down Expand Up @@ -182,11 +178,7 @@ describe('WMS capabilities', () => {
],
'EPSG:4326': ['-6.20495', '41.9671', '12.2874', '51.2917'],
},
"keywords": [
"Geologie",
"INSPIRE:Geology",
"Geology",
],
keywords: ['Geologie', 'INSPIRE:Geology', 'Geology'],
name: 'SCAN_F_GEOL250',
styles,
title: 'Carte géologique image de la France au 1/250000',
Expand Down Expand Up @@ -224,11 +216,7 @@ describe('WMS capabilities', () => {
],
'EPSG:4326': ['-12.2064', '40.681', '11.894', '52.1672'],
},
"keywords": [
"Geologie",
"INSPIRE:Geology",
"Geology",
],
keywords: ['Geologie', 'INSPIRE:Geology', 'Geology'],
name: 'SCAN_D_GEOL50',
styles,
title: 'Carte géologique image de la France au 1/50 000e',
Expand All @@ -254,7 +242,7 @@ describe('WMS capabilities', () => {
'EPSG:4171': ['-180', '-90', '180', '90'],
'EPSG:4326': ['-180', '-90', '180', '90'],
},
"keywords": [],
keywords: [],
name: 'INHERIT_BBOX',
styles: [
{
Expand Down
10 changes: 5 additions & 5 deletions src/wms/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ function parseLayer(
: inheritedBoundingBoxes;

const keywords = findChildrenElement(
findChildElement(layerEl, 'KeywordList'),
'Keyword'
)
.map(getElementText)
.filter((v, i, arr) => arr.indexOf(v) === i);
findChildElement(layerEl, 'KeywordList'),
'Keyword'
)
.map(getElementText)
.filter((v, i, arr) => arr.indexOf(v) === i);

const children = findChildrenElement(layerEl, 'Layer').map((layer) =>
parseLayer(layer, version, availableCrs, styles, attribution, boundingBoxes)
Expand Down
2 changes: 1 addition & 1 deletion src/wms/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type WmsLayerFull = {
*/
boundingBoxes: Record<CrsCode, BoundingBox>;
attribution?: WmsLayerAttribution;
keywords?: string[],
keywords?: string[];
/**
* Not defined if the layer is a leaf in the tree
*/
Expand Down

0 comments on commit 057c3a6

Please sign in to comment.