@terrestris/ol-util
Version:
A set of helper classes for working with openLayers
46 lines (45 loc) • 1.73 kB
TypeScript
import { Extent as OlExtent } from 'ol/extent';
import OlLayer from 'ol/layer/Layer';
import { WmsLayer, WmtsLayer } from '../typeUtils/typeUtils';
import { InkmapLayer } from './InkmapTypes';
/**
* Helper class for layer interaction.
*
* @class LayerUtil
*/
declare class LayerUtil {
/**
* Returns the configured URL of the given layer.
*
* @param { WmsLayer | WmtsLayer } layer The layer
* to get the URL from.
* @returns {string} The layer URL.
*/
static getLayerUrl: (layer: WmsLayer | WmtsLayer) => string;
/**
* Returns the extent of the given layer as defined in the
* appropriate Capabilities document.
*
* @param {WmsLayer} layer
* @param {RequestInit} fetchOpts Optional fetch options to make use of
* while requesting the Capabilities.
* @returns {Promise<[number, number, number, number]>} The extent of the layer.
*/
static getExtentForLayer(layer: WmsLayer, fetchOpts?: RequestInit): Promise<OlExtent>;
/**
* Converts a given OpenLayers layer to an inkmap layer spec.
*
*/
static mapOlLayerToInkmap(olLayer: OlLayer): Promise<InkmapLayer>;
/**
* Returns all attributions as text joined by a separator.
*
* @param {OlLayer} layer The layer to get the attributions from.
* @param {string} separator The separator separating multiple attributions.
* @param {boolean} removeDuplicates Whether to remove duplicated attribution
* strings or not.
* @returns {string} The attributions.
*/
static getLayerAttributionsText: (layer: OlLayer, separator?: string, removeDuplicates?: boolean) => string;
}
export default LayerUtil;