- add bar component wit d3.js
- new dataset-by-station-selector.component with angular/material/dialog - zoom.componentn: disable button at lasst zoom level
This commit is contained in:
parent
363cdb0681
commit
427b7b9c91
25 changed files with 1840 additions and 55 deletions
|
@ -11,7 +11,10 @@ import { HttpService } from './http.service';
|
|||
import { HttpRequestOptions } from '../../shared/models/http-requests';
|
||||
import { HttpParams } from '@angular/common/http';
|
||||
import { MessageService } from './message.service';
|
||||
import { GeomonPlatform } from '../../shared/models/platform';
|
||||
import { Dataset, GeomonTimeseries } from '../../shared/models/dataset';
|
||||
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
// @Injectable({
|
||||
// providedIn: 'root'
|
||||
|
@ -33,12 +36,60 @@ export class DatasetApiService {
|
|||
}
|
||||
|
||||
public getStations(apiUrl: string, params?: any, options?: HttpRequestOptions): Observable<Station[]> {
|
||||
const url = this.createRequestUrl(apiUrl, 'features');
|
||||
const url = this.createRequestUrl(apiUrl, 'features'); //https://geomon.geologie.ac.at/52n-sos-webapp/api/features
|
||||
let stations = this.requestApi<Station[]>(url, params, options);
|
||||
this.messageService.add('StationService: fetched stations');
|
||||
return stations;
|
||||
}
|
||||
|
||||
public getFeature(
|
||||
id: string,
|
||||
apiUrl: string,
|
||||
params?: any,
|
||||
options?: HttpRequestOptions
|
||||
): Observable<Station> {
|
||||
const url = this.createRequestUrl(apiUrl, 'features', id);
|
||||
return this.requestApi<Station>(url, params, options);
|
||||
}
|
||||
|
||||
public getPlatforms(apiUrl: string, params?: any, options?: HttpRequestOptions): Observable<GeomonPlatform[]> {
|
||||
// const url = this.createRequestUrl(apiUrl, 'platforms');
|
||||
// return this.requestApi<GeomonPlatform[]>(url, params, options);
|
||||
return this.getStations(apiUrl, params, options).pipe(map(res => res.map(f => this.createGeomonPlatform(f))));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public getPlatform(
|
||||
id: string,
|
||||
apiUrl: string,
|
||||
params?: any,
|
||||
options?: HttpRequestOptions
|
||||
): Observable<GeomonPlatform> {
|
||||
// const url = this.createRequestUrl(apiUrl, 'platforms', id);
|
||||
// return this.requestApi<GeomonPlatform>(url, params, options);
|
||||
return this.getFeature(id, apiUrl,params, options).pipe(map(res => this.createGeomonPlatform(res)));
|
||||
}
|
||||
|
||||
public getDataset(id: string, apiUrl: string, params?: any, options?: HttpRequestOptions): Observable<GeomonTimeseries> {
|
||||
const url = this.createRequestUrl(apiUrl, 'datasets', id);
|
||||
return this.requestApi<GeomonTimeseries>(url, params, options);
|
||||
//.pipe(
|
||||
// map((res) => this.prepareDataset(res, apiUrl))
|
||||
// );
|
||||
}
|
||||
|
||||
//#region Helper method
|
||||
|
||||
protected createGeomonPlatform(feature: Station): GeomonPlatform {
|
||||
const datasetIds = [];
|
||||
for (const key in feature.properties.datasets) {
|
||||
if (feature.properties.datasets.hasOwnProperty(key)) {
|
||||
datasetIds.push(key);
|
||||
}
|
||||
}
|
||||
return new GeomonPlatform(feature.id, feature.properties.label, datasetIds, feature.geometry);
|
||||
}
|
||||
|
||||
protected createRequestUrl(apiUrl: string, endpoint: string, id?: string) {
|
||||
// TODO Check whether apiUrl ends with slash
|
||||
|
@ -63,4 +114,5 @@ export class DatasetApiService {
|
|||
return headers;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue