Skip to content
Snippets Groups Projects
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
Branches
Tags
1 merge request!64v2.5.1
Pipeline #4763 passed
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
</div> </div>
<div class="resource-downloadable-files" *ngFor="let resource of downloadable.value"> <div class="resource-downloadable-files" *ngFor="let resource of downloadable.value">
<ng-container *ngFor="let format of resource.formats; let i=index"> <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"> [isQueryable]="true">
</app-resource-download-item> </app-resource-download-item>
</ng-container> </ng-container>
......
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { communeInsee } from '../../../../../../assets/resources/commune-insee'; import { communeInsee } from '../../../../../../assets/resources/commune-insee';
import { geosource } from '../../../../../../i18n/traductions'; 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 { Format, Projection, Resource } from '../../../../models';
import { DatasetDetailService } from '../../../../services'; import { DatasetDetailService } from '../../../../services';
...@@ -17,6 +17,7 @@ export class ResourceDownloadItemComponent implements OnInit { ...@@ -17,6 +17,7 @@ export class ResourceDownloadItemComponent implements OnInit {
@Input() format?: Format; @Input() format?: Format;
@Input() resource?: Resource; @Input() resource?: Resource;
@Input() projections?: Projection[]; @Input() projections?: Projection[];
@Input() metadata?: Metadata;
@Input() link: IMetadataLink; @Input() link: IMetadataLink;
@Input() isQueryable: boolean; @Input() isQueryable: boolean;
@Output() saveEvent = new EventEmitter(); @Output() saveEvent = new EventEmitter();
...@@ -153,6 +154,16 @@ export class ResourceDownloadItemComponent implements OnInit { ...@@ -153,6 +154,16 @@ export class ResourceDownloadItemComponent implements OnInit {
outputFormat + outputFormat +
projectionAndBbox.projection + projectionAndBbox.projection +
projectionAndBbox.bboxRequest; 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) { } else if (this.resource.type === linkFormats.ws) {
if (this.format.name === 'JSON') { if (this.format.name === 'JSON') {
queryableUrl += `/${this.resource.metadataLink.name}/all.json`; queryableUrl += `/${this.resource.metadataLink.name}/all.json`;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment