Skip to content

Commit

Permalink
fix (geo) : Composite catalog goes down if a layer is down (#1008)
Browse files Browse the repository at this point in the history
* Fix broken composite catalog when one layer is down
* added condition for broken capabilities of layers
* Adding an error message for broken layer capabilities
Co-authored-by: Philippe Lafreniere <philippe.lafreniere@msp.gouv.qc.ca>
  • Loading branch information
mneige authored Mar 28, 2022
1 parent df4078e commit f0366a0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
38 changes: 33 additions & 5 deletions demo/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,40 @@ export const environment: Environment = {
url: 'https://ws.mapserver.transports.gouv.qc.ca/swtq'
},
{
id: 'rn_wmts',
id: 'arcgisrestcompletecatalog',
title: 'ArcGIS Rest complete catalog',
url: 'https://gisp.dfo-mpo.gc.ca/arcgis/rest/services/FGP/CSAS_Corals_Sponges_2010_FR/MapServer',
type: 'arcgisrest',
regFilters: ["^0$"]
},
{ // dead ESRI link
id: "38",
externalProvider: true,
url: "https://gisp.dfo-mpo.gc.ca/arcgis/rest/services/FGP/Canadas_Marine_Conservation_Targets_FR/MapServer",
type: "imagearcgisrest",
groupImpose: {"id": "conserve", "title": "Conservation"},
regFilters: ["^0$"]
},
{// wmts regFilters error link
id: 'wmts_error',
url:
'https://servicesmatriciels.mern.gouv.qc.ca/erdas-iws/ogc/wmts/Cartes_Images',
'https://servicesmatriciels.mern.gouv.qc.ca/erdas-iws/ogc/wmts/Elevation?SERVICE=WMTS&REQUEST=GetCapabilities',
type: 'wmts',
crossOrigin: true,
matrixSet: 'EPSG_3857',
version: '1.0.0'
regFilters: ["^100$"]
},
{// wms CORS error link
id: 'wms_cors_error',
url: 'https://daata.chs-shc.ca/geoserver/wms',
type: "wms",
version: "1.3.0"
},
{// wms working link
id: 'wms_cors_error',
url: 'https://cartes.geogratis.gc.ca/wms/canvec_fr',
type: "wms",
version: "1.3.0",
regFilters: ["hydro_obstacle_polygon_50k"]
}
]
},
Expand Down Expand Up @@ -130,7 +157,7 @@ export const environment: Environment = {
groupImpose: { id: 'zpegt', title: 'zpegt' }
},
{
id: 'rn_wmts',
id: 'rn_wmts_1',
url:
'https://servicesmatriciels.mern.gouv.qc.ca/erdas-iws/ogc/wmts/Cartes_Images',
type: 'wmts',
Expand All @@ -141,6 +168,7 @@ export const environment: Environment = {
id: 'cartetopo',
title: 'Carte topo échelle 1/20 000'
}
//regFilters: ["^100$"]
}
]
},
Expand Down
10 changes: 9 additions & 1 deletion packages/geo/src/lib/catalog/shared/catalog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,15 @@ export class CatalogService {
if (!capabilities) {
return [];
}
const layers = capabilities.layers.filter(layer => !layer.type || layer.type === 'Feature Layer');
const layers =
!capabilities.layers ? [] : capabilities.layers.filter(layer => !layer.type || layer.type === 'Feature Layer');
if (!capabilities.layers) {
this.messageService.error(
this.languageService.translate.instant('igo.geo.catalog.someUnavailable'),
this.languageService.translate.instant('igo.geo.catalog.unavailableTitle')
);
}

const regexes = (catalog.regFilters || []).map(
(pattern: string) => new RegExp(pattern)
);
Expand Down

0 comments on commit f0366a0

Please sign in to comment.