Commit 433bd2db authored by ext.sopra.ncastejon's avatar ext.sopra.ncastejon
Browse files

Add the fix for flatten images in WMS for the downloads pages.

parent 0133d3be
Pipeline #4763 passed with stage
in 3 minutes and 45 seconds
......@@ -9,7 +9,8 @@
</div>
<div class="resource-downloadable-files" *ngFor="let resource of downloadable.value">
<ng-container *ngFor="let format of resource.formats; let i=index">
<app-resource-download-item [format]="format" [resource]="resource" [projections]="projections"
<app-resource-download-item [metadata]="metadata"
[format]="format" [resource]="resource" [projections]="projections"
[isQueryable]="true">
</app-resource-download-item>
</ng-container>
......
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { communeInsee } from '../../../../../../assets/resources/commune-insee';
import { geosource } from '../../../../../../i18n/traductions';
import { IMetadataLink, linkFormats } from '../../../../../shared/models';
import { IMetadataLink, linkFormats, Metadata } from '../../../../../shared/models';
import { Format, Projection, Resource } from '../../../../models';
import { DatasetDetailService } from '../../../../services';
......@@ -17,6 +17,7 @@ export class ResourceDownloadItemComponent implements OnInit {
@Input() format?: Format;
@Input() resource?: Resource;
@Input() projections?: Projection[];
@Input() metadata?: Metadata;
@Input() link: IMetadataLink;
@Input() isQueryable: boolean;
@Output() saveEvent = new EventEmitter();
......@@ -153,6 +154,16 @@ export class ResourceDownloadItemComponent implements OnInit {
outputFormat +
projectionAndBbox.projection +
projectionAndBbox.bboxRequest;
// Set the dimension of the image based no the bbox aspect ratio
if (this.resource.type === linkFormats.wms) {
const width = 700;
const longDiff = this.metadata.max_east - this.metadata.max_west;
const latDiff = this.metadata.max_north - this.metadata.max_south;
const ratio = longDiff / latDiff;
const height = Math.round(width * ratio);
queryableUrl += `&WIDTH=${width}&HEIGHT=${height}`;
}
} else if (this.resource.type === linkFormats.ws) {
if (this.format.name === 'JSON') {
queryableUrl += `/${this.resource.metadataLink.name}/all.json`;
......
Markdown is supported
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