UNPKG

@dlr-eoc/services-ogc

Version:

This module bundles our clients for OGC standards. E.g. parse OWS Context JSON, WMS, WMTS or WPS.

205 lines (204 loc) 9.94 kB
import { IOwsContext, IOwsResource, IOwsOffering, IOwsOperation, IOwsContent } from './types/owc-json'; import { IEocOwsContext, IEocOwsResource, IEocOwsOffering, IEocOwsResourceDimension, IEocOwsTimeDimension } from './types/eoc-owc-json'; import { VectorLayer, RasterLayer, Layer, TLayertype, ILayerDimensions, ILayerIntervalAndPeriod, TFiltertypes, LayerGroup, ILayerTimeDimension, ILayerElevationDimension, StackedLayer } from '@dlr-eoc/services-layers'; import { TGeoExtent } from '@dlr-eoc/services-map-state'; import { WmtsClientService } from '../wmts/wmtsclient.service'; import { Observable } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import * as i0 from "@angular/core"; export declare function shardsExpand(v: string): string[]; /** * OWS Context Service * OGC OWS Context Geo Encoding Standard Version: 1.0 * http://docs.opengeospatial.org/is/14-055r2/14-055r2.html * http://www.owscontext.org/owc_user_guide/C0_userGuide.html * * This service allows you to read and write OWC-data. * We have added some custom fields to the OWC standard. * - accepts the OWC-standard-data-types as function inputs (so as to be as general as possible) * - returns our extended OWC-data-types as function outputs (so as to be as information-rich as possible) * * As a policy, this services does *not* make any HTTP requests to GetCapabilities (or similar) to gather * additional information (with very few exceptions) - we want to save on network traffic. * However there are scripts that auto-generate OWC files from Capabilities, those, of course, * *do* scrape as much information online as possible; But they are not intended to be used in * a live-application. Run them batch-wise and server-side instead. */ export declare class OwcJsonService { private wmtsClient; private http; constructor(wmtsClient: WmtsClientService, http: HttpClient); checkContext(context: IOwsContext): boolean; getContextTitle(context: IOwsContext): string; getContextPublisher(context: IOwsContext): string; getContextExtent(context: IOwsContext): import("geojson").BBox; getResources(context: IOwsContext): IOwsResource[]; /** * Get Resources whith Folder property but not including Layer-Filtertypes */ getGroupResources(context: IOwsContext): IOwsResource[]; /** * Get Resources without Folder property or Folder is only Layer-Filtertypes */ getSingleResources(context: IOwsContext): IOwsResource[]; /** Resource --------------------------------------------------- */ getResourceTitle(resource: IOwsResource): string; /** * The Folder property of IOwsResource * @returns string | `${TFiltertypes}/string` */ getResourceFolder(resource: IOwsResource): string; /** * returns name from Resource Folder if it is not only a Filtertype `TFiltertypes` */ private getLayerGroupFromFolder; /** * FilterType in IOwsResource Folder property */ getFilterType(resource: IOwsResource): TFiltertypes; getResourceUpdated(resource: IOwsResource): string; getResourceDate(resource: IOwsResource): string; getResourceOfferings(resource: IOwsResource): IOwsOffering[]; /** * retrieve layer status active / inactive based on IOwsResource * @param resource: IOwsResource */ isActive(resource: IOwsResource): boolean; getResourceDescription(resource: IOwsResource): string; /** OWS Extenson IEocOwsResource */ getResourceOpacity(resource: IEocOwsResource): number; /** OWS Extenson IEocOwsResource */ getResourceAttribution(resource: IEocOwsResource): string; /** OWS Extenson IEocOwsResource */ getResourceShards(resource: IEocOwsResource): string; /** OWS Extenson IEocOwsResource */ getResourceMinMaxZoom(resource: IEocOwsResource, targetProjection?: string): { minZoom: number; maxZoom: number; }; /** * e.g. * (array) value: '1984-01-01T00:00:00.000Z/1989-12-31T23:59:59.000Z/PT1S,1990-01-01T00:00:00.000Z/1994-12-31T23:59:59.000Z/PT1S,...' * (array) value: '1984-01-01T00:00:00.000Z/P1D,P1D/2000-01-01T00:00:00.000Z,...' * (array) value: '2000-01-01T00:00:00.000Z,2001-01-01T00:00:00.000Z,2002-01-01T00:00:00.000Z,...' * (single) value: '2016-01-01T00:00:00.000Z/2018-01-01T00:00:00.000Z/P1Y' */ getTimeValueFromDimensions(values: IEocOwsTimeDimension['values'], period?: IEocOwsTimeDimension['display']['period']): ILayerIntervalAndPeriod | Array<string | ILayerIntervalAndPeriod>; /** * time could be: * * - date * - start/end/duration //Geoserver specific * - start/end * - start/duration, and duration/end */ private parseSingleTimeOrPeriod; private parseISO8601Period; getResourceDimensions(resource: IEocOwsResource): ILayerDimensions; getTimeDimensions(dimensions: IEocOwsResourceDimension[]): ILayerTimeDimension; getElevationDimension(dimensions: IEocOwsResourceDimension[]): ILayerElevationDimension; /** Offering --------------------------------------------------- */ getLayertypeFromOfferingCode(offering: IOwsOffering): TLayertype; checkIfServiceOffering(offering: IOwsOffering): boolean; checkIfDataOffering(offering: IOwsOffering): boolean; /** * Helper function to extract legendURL from project specific ows Context * @param offering layer offering */ getLegendUrl(offering: IOwsOffering): string; /** * Get all Layers from the IOwsContext. * * The order of the layers is reversed to get the context drawing order! */ getLayers(owc: IOwsContext, targetProjection: string): Observable<(Layer | LayerGroup)[]>; /** * Creates Layers or LayerGroups from IOwsResource and IOwsContext * Add uniqueGroups array to track already created groups */ private createLayerOrGroupFromResource; /** * * @param groupName string | `${TFiltertypes}/string` */ createLayerGroup(groupName: string, includedResources: IOwsResource[], owc: IOwsContext, targetProjection: string): Observable<LayerGroup | StackedLayer>; createLayerFromDefaultOffering(resource: IOwsResource, owc: IOwsContext, targetProjection: string): Observable<Layer>; createLayerFromOffering(offering: IOwsOffering, resource: IOwsResource, context: IOwsContext, targetProjection: string): Observable<Layer>; createVectorLayerFromOffering(offering: IOwsOffering, resource: IOwsResource, context?: IOwsContext, targetProjection?: string): Observable<VectorLayer>; /** * TmsLayertype can be raster and vector */ private isVectorLayerType; private getVectorLayerOptions; /** * https://opengeospatial.github.io/e-learning/wfs/text/operations.html#getfeature */ private getWfsOptions; private checkWfsParams; createRasterLayerFromOffering(offering: IOwsOffering, resource: IOwsResource, context: IOwsContext, targetProjection: string): Observable<RasterLayer>; /** * TmsLayertype can be raster and vector */ private isRasterLayerType; private createVectorTileLayerFromOffering; private createWfsLayerFromOffering; private createDataVectorLayerFromOffering; private createTmsRasterLayerFromOffering; private createWmtsLayerFromOffering; private createWmsLayerFromOffering; private createXyzLayerFromOffering; /** * https://docs.opengeospatial.org/is/13-082r2/13-082r2.html - OGC WMTS Simple Profile * http://schemas.opengis.net/wmts/1.0/wmtsGetTile_request.xsd * https://opengeospatial.github.io/e-learning/wmts/text/main.html#example-gettile-request */ private getWmtsOptions; private parseOperationUrl; private getMatrixSetForWMTS; /** * TODO: add more vendor params ?? * https://docs.geoserver.org/latest/en/user/services/wms/reference.html#getmap */ private getWmsOptions; private getRasterLayerOptions; private getLayerOptions; /** Misc --------------------------------------------------- */ /** * Based on the WMS Standard (https://portal.ogc.org/files/?artifact_id=14416), * to which the OWC Standard refers for the scale-denominator-field, * and the way that openlayers calculates zoom and resolution * (https://openlayers.org/en/latest/doc/tutorials/concepts.html) */ private scaleDenominatorToZoom; /** * helper to pack query-parameters of a uri into a JSON * Makes all Params UpperCase * * @param uri any uri with query-parameters */ private getJsonFromUri; /** ------------ DATA TO FILE ----------------------------------------- */ /** * The order of created features is Overlays, Layers, Baselayers from top to bottom * set on the folder property */ generateOwsContextFrom(id: string, layers: (Layer | LayerGroup)[], extent?: TGeoExtent, properties?: IEocOwsContext['properties']): IEocOwsContext; private generateAbstractFromLayerDescription; generateResourceFromLayer(layer: Layer, folderName?: string): IEocOwsResource; generateOfferingFromLayer(layer: Layer): IEocOwsOffering; getOfferingCodeFromLayer(layer: Layer): string; getContentsFromLayer(layer: VectorLayer): IOwsContent[]; /** * For Service Offerings */ getOperationsFromLayer(layer: Layer): IOwsOperation[]; getXyzOperationsFromLayer(layer: RasterLayer): IOwsOperation[]; private getTMSRasterOperationsFromLayer; getWfsOperationsFromLayer(layer: VectorLayer): IOwsOperation[]; private getTMSVectorOperationsFromLayer; getWmsOperationsFromLayer(layer: RasterLayer): IOwsOperation[]; getWmtsOperationsFromLayer(layer: RasterLayer): IOwsOperation[]; private generateDimensionsFromLayer; static ɵfac: i0.ɵɵFactoryDeclaration<OwcJsonService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<OwcJsonService>; }