Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove shp file format from gis downloads #723

Merged
merged 4 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class ObservationDownloadComponent implements OnDestroy {

linkTimeout: any;

formats: FORMAT[] = ['tsv', 'ods', 'xlsx', 'shp', 'gpkg'];
formats: FORMAT[] = ['tsv', 'ods', 'xlsx', 'gpkg'];

private _originalSelected: string[];
private _settings?: UserSettingsResultList|null;
Expand Down Expand Up @@ -404,6 +404,6 @@ export class ObservationDownloadComponent implements OnDestroy {
}

private isGisDownload(fileType: FORMAT): boolean {
return fileType === 'shp' || fileType === 'gpkg';
return fileType === 'gpkg';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { SelectStyle } from '../select/metadata-select/metadata-select.component
import { FileCrs, FileGeometry } from '../../shared/service/geo-convert.service';
import { KeyValue } from '@angular/common';
import { ModalRef, ModalService } from 'projects/laji-ui/src/lib/modal/modal.service';
import { DialogService } from '../../shared/service/dialog.service';

export type FORMAT = 'csv'|'tsv'|'ods'|'xlsx'|'shp'|'gpkg';
export type FORMAT = 'csv'|'tsv'|'ods'|'xlsx'|'gpkg';

export interface DownloadParams {
fileType: FORMAT;
Expand Down Expand Up @@ -45,13 +44,10 @@ export interface DownloadParams {
<div class="radio" *ngIf="_formats.indexOf('xlsx') > -1">
<label><input type="radio" name="optradio" [(ngModel)]="fileType" value="xlsx">Excel (.xlsx)</label>
</div>
<div class="radio" *ngIf="_formats.indexOf('shp') > -1">
<label><input type="radio" name="optradio" [(ngModel)]="fileType" value="shp" (click)="shpFormatClick()">Shapefile (.shp)</label>
</div>
<div class="radio" *ngIf="_formats.indexOf('gpkg') > -1">
<label><input type="radio" name="optradio" [(ngModel)]="fileType" value="gpkg">GeoPackage (.gpkg)</label>
</div>
<ng-container *ngIf="fileType === 'shp' || fileType === 'gpkg'">
<ng-container *ngIf="fileType === 'gpkg'">
<div class="mb-3">
<label for="geometry">{{ 'download.geometry' | translate }}:</label>
<select id="geometry" name="geometry" class="form-control" [(ngModel)]="geometry">
Expand Down Expand Up @@ -126,8 +122,7 @@ export class DownloadComponent implements OnChanges {
}

constructor(
private modalService: ModalService,
private dialogService: DialogService
private modalService: ModalService
) { }

ngOnChanges() {
Expand All @@ -147,7 +142,7 @@ export class DownloadComponent implements OnChanges {
return;
}
const params: DownloadParams = {fileType: this.fileType};
if (this.fileType === 'shp' || this.fileType === 'gpkg') {
if (this.fileType === 'gpkg') {
params.geometry = this.geometry;
params.crs = this.crs;
}
Expand All @@ -161,10 +156,4 @@ export class DownloadComponent implements OnChanges {
this.disableDownLoad = this.downloadLoading ||
(this.showReason && (!this.reason || !this.reasonEnum));
}

shpFormatClick() {
if (this.fileType !== 'shp') {
this.dialogService.alert('download.shpDeprecationWarning');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export enum FileType {
@Injectable({providedIn: 'root'})
export class FileDownloadService {
fileType: FileType = FileType.standard;
format: FileFormat = FileFormat.shp;
format: FileFormat = FileFormat.gpkg;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File download service uses gpkg now that shp was removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, gpkg is the only gis download format now

geometry: FileGeometry = FileGeometry.point;
crs: FileCrs = FileCrs.euref;
loading = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
</div>
</div>
<div *ngIf="downloadService.fileType === fileTypeEnum.gis" class="row">
<div class="col-sm-12">
<div role="alert" class="alert alert-warning mb-3" [innerHTML]='"download.shpDeprecationWarning" | translate'></div>
</div>
<div class="col-sm-4">
<label for="format">{{ 'downloadRequest.fileDownload.format' | translate }}:</label>
<select id="format" name="format" class="form-control" [(ngModel)]="downloadService.format">
Expand Down
2 changes: 0 additions & 2 deletions projects/laji/src/app/shared/service/geo-convert.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { TranslateService } from '@ngx-translate/core';
export type GeoConversionStatus = 'pending'|'complete';

export enum FileFormat {
shp = 'shp',
gpkg = 'gpkg'
}
export enum FileGeometry {
Expand All @@ -20,7 +19,6 @@ export enum FileCrs {
wgs84 = 'wgs84'
}
export enum ErrorType {
tooComplex = 'too_complex',
tooLarge = 'too_large'
}

Expand Down
4 changes: 1 addition & 3 deletions projects/laji/src/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
"download.geometry": "Geometria",
"download.reason": "Mihin aineistoa käytetään?",
"download.reason-required": "Sinun täytyy valita aineiston käytön syy ja kirjoittaa lisätiedot",
"download.shpDeprecationWarning": "Tiedostolataus ESRI Shapefile (.shp) -muodossa loppuu 31.12.2024. Käytä sen sijaan Geopackage (.gpkg) -tiedostomuotoa. <a target='_blank' href='https://laji.fi/news/8363'>Lue lisää muutoksesta</a>.",
"downloadRequest.accessed": "haettu",
"downloadRequest.apiKey": "API-avain",
"downloadRequest.apiKeyExpires": "Voimassaolon päättymispäivä",
Expand Down Expand Up @@ -439,7 +438,6 @@
"friend.requests": "Kaveripyynnöt",
"friend.requestSent": "Kaveripyyntö lähetetty",
"gathering.section.outsideSection": "Ei osiota",
"geoConvert.error.too_complex": "Joidenkin havaintojen geometriat ovat liian monimutkaisia .shp-tiedostomuodolle (GeometryCollection). Käytä sen sijaan .gpkg-muotoa tai valitse toinen geometriatyyppi.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you delete references of "too_complex"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had forgotten to delete it, deleted it now

"geoConvert.error.too_large": "Tiedoston koko on liian suuri paikkatietomuotoiselle aineistolataukselle.",
"haseka.button": "Siirry Vihkoon",
"haseka.changelog": "Uudet ominaisuudet ja muutokset",
Expand Down Expand Up @@ -2167,4 +2165,4 @@
"whatsNew.message": "laji.fi on Suomen Lajitietokeskuksen testikäytössä oleva portaali. Tietoja täydennetään ja ominaisuuksia parannetaan jatkuvasti. Palaute on tervetullutta - sitä voi lähettää palautelomakkeella tai osoitteeseen info@laji.fi. Kiitos!<p>Voit katsoa tuoreimmat muutokset <a href=\"https://laji.fi\">etusivun</a> ajankohtaista osiosta.</p",
"wholeYear": "Koko vuosi {{year}}",
"yes": "Kyllä"
}
}