Commit 7cb8107d authored by ncastejon's avatar ncastejon
Browse files

Fix table-map display for ATMO providers.

parent 9d6c6432
Pipeline #1791 passed with stages
in 6 minutes and 55 seconds
......@@ -79,13 +79,17 @@ export class DatasetMapComponent implements OnInit, OnDestroy {
this.mapOptions.vectorService = { ...this.metadata.link.find((e) => { return e.service === linkFormats.wfs; }) };
this.mapOptions.rasterService = { ...this.metadata.link.find((e) => { return e.service === linkFormats.wms; }) };
// For authentication reason, we do not use the open url of download.data for the WMS service.
// For authentication reason, we do not use the open url of download.data for the WMS service.
// We use a kong endpoint for the url to be proxyfied
if (!this.mapOptions.rasterService) {
return;
}
const domain = this.mapOptions.rasterService.url.split('wms')[1];
this.mapOptions.rasterService.url = APP_CONFIG.backendUrls.wms + domain;
// If download data, use config url.
if (this.mapOptions.rasterService.url.includes('download.data')) {
const domain = this.mapOptions.rasterService.url.split('wms')[1];
this.mapOptions.rasterService.url = APP_CONFIG.backendUrls.wms + domain;
}
// If the data are just a sample, we will use this sample as geojson to display the interaction layer on the map.
// Otherwise we use normally the MVT service.
......@@ -105,7 +109,7 @@ export class DatasetMapComponent implements OnInit, OnDestroy {
// Get bbox from the WMS service. If not exist, get it from metadata.
const wmsLink = this.metadata.link.find((e) => { return e.service === linkFormats.wms; });
if (wmsLink && wmsLink.bbox_by_projection) {
if (wmsLink && wmsLink.bbox_by_projection && wmsLink.bbox_by_projection['EPSG:4171']) {
const bbox = wmsLink.bbox_by_projection['EPSG:4171'];
this.mapOptions.bbox = [bbox['miny'], bbox['minx'], bbox['maxy'], bbox['maxx']];
} else {
......
......@@ -129,7 +129,7 @@ export class ElasticsearchOptions {
// Known licences
get knownLicences() {
return ['Licence Ouverte', 'Licence Engagée', 'Licence Associée'];
return ['Licence Ouverte', 'Licence ODbL', 'Licence de réutilisation des données d\'intérêt général'];
}
// Getters
......
......@@ -123,27 +123,30 @@ export class MapService {
addLayers() {
this.addWMSLayer();
// There is two ways to add tha data layers: from a geojson or from a MVT url
if (!this.isMVT) {
if (this.geojson) {
this._map.addSource('vector-source', {
type: 'geojson',
data: this.geojson,
});
this.addDataLayer();
}
} else {
if (this.vectorService && this.vectorService.url) {
const domain = this.vectorService.url.split('wfs')[1];
const url = `${this.mvtUrl}${domain}?LAYERS` +
`=${this.vectorService.name}&map.imagetype=mvt&tilemode=gmap&tile={x}+{y}+{z}&mode=tile`;
this._map.addSource('vector-source', {
type: 'vector',
tiles: [url],
});
this.addDataLayer();
// Add a geojson layer only if data from the metropole
if (this.rasterService.url.includes('download.data')) {
// There is two ways to add tha data layers: from a geojson or from a MVT url
if (!this.isMVT) {
if (this.geojson) {
this._map.addSource('vector-source', {
type: 'geojson',
data: this.geojson,
});
this.addDataLayer();
}
} else {
if (this.vectorService && this.vectorService.url) {
const domain = this.vectorService.url.split('wfs')[1];
const url = `${this.mvtUrl}${domain}?LAYERS` +
`=${this.vectorService.name}&map.imagetype=mvt&tilemode=gmap&tile={x}+{y}+{z}&mode=tile`;
this._map.addSource('vector-source', {
type: 'vector',
tiles: [url],
});
this.addDataLayer();
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment