UNPKG

@terrestris/ol-util

Version:

A set of helper classes for working with openLayers

49 lines (48 loc) 2.35 kB
import OlLayerImage from 'ol/layer/Image'; import OlSourceImageWMS from 'ol/source/ImageWMS'; import { WmsLayer } from '../typeUtils/typeUtils'; /** * Helper class to parse capabilities of WMS layers * * @class CapabilitiesUtil */ declare class CapabilitiesUtil { /** * Fetches and parses the WMS Capabilities document for the given URL. * * @param {string} capabilitiesUrl Url to WMS capabilities document. * @param {RequestInit} fetchOpts Optional fetch options to make use of * while requesting the Capabilities. * @return {Promise<any>} An object representing the WMS capabilities. */ static getWmsCapabilities(capabilitiesUrl: string, fetchOpts?: RequestInit): Promise<any>; /** * Fetches and parses the WMS Capabilities document for the given layer. * * @param {WmsLayer} layer The layer to the get the Capabilites for. * @param {RequestInit} fetchOpts Optional fetch options to make use of * while requesting the Capabilities. * @return {Promise<any>} An object representing the WMS capabilities. */ static getWmsCapabilitiesByLayer(layer: WmsLayer, fetchOpts?: RequestInit): Promise<any>; /** * Returns the Capabilities URL for the given layer. * * @param {import("../types").WMSLayer} layer The layer to the get the Capabilities URL for. * @return {string} The Capabilities URL. */ static getCapabilitiesUrl(layer: WmsLayer): string; /** * Returns the layers from a parsed WMS GetCapabilities object. * * @param {Object} capabilities A capabilities object. * @param {string} nameField Configure the field which should be set as the * 'name' property in the openlayers layer. * @param {(url: string) => string} [proxyFn] Optional proxy function which can be applied to * `GetMap`, `GetFeatureInfo` and `GetLegendGraphic` * requests to avoid CORS issues. * @return {import("ol/layer/Image").default<any>[]} Array of OlLayerImage */ static getLayersFromWmsCapabilities(capabilities: any, nameField?: string, proxyFn?: (proxyUrl: string) => string): OlLayerImage<OlSourceImageWMS>[]; } export default CapabilitiesUtil;