UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

101 lines (100 loc) • 4.26 kB
import { TileLayer } from './TileLayer.js'; import type { Coords, Defaults, TileLayerEventMap, WMSParams, WMSTileLayerDefaults, WMSTileLayerOptions } from '../../types.js'; import type { CRS } from '../../geo/crs/CRS.js'; import type { LeafletMap } from '../../map/Map.js'; /** @import {Coords, Defaults, TileLayerEventMap, TileLayerOptions, WMSParams, WMSTileLayerDefaults, * WMSTileLayerOptions} from '../../types.js' */ /** @import {CRS} from '../../geo/crs/CRS.js' */ /** @import {LeafletMap} from '../../map/Map.js' */ declare const defaultWmsParams: { service: string; request: string; /** **(required)** Comma-separated list of WMS layers to show. */ layers: string; /** Comma-separated list of WMS styles. */ styles: string; /** WMS image format (use `'image/png'` for layers with transparency). */ format: string; /** If `true`, the WMS service will return images with transparency. */ transparent: boolean; /** Version of the WMS service to use */ version: string; }; export type WMSParamsDefaults = typeof defaultWmsParams; /** @typedef {typeof defaultWmsParams} WMSParamsDefaults */ declare const defaultOptions: { /** * Coordinate Reference System to use for the WMS requests, defaults * to map CRS. Don't change this if you're not sure what it means. * @type {typeof CRS | null} */ crs: typeof CRS | null; /** If `true`, WMS request parameter keys will be uppercase. */ uppercase: boolean; }; export type WMSTileLayerDefaultsValues = typeof defaultOptions; /** @typedef {typeof defaultOptions} WMSTileLayerDefaultsValues */ /** * Used to display [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) * services as tile layers on the map. Extends `TileLayer`. * * If any custom options not documented here are used, they will be sent to the WMS server as extra * parameters in each request URL. This can be useful for [non-standard vendor WMS * parameters](https://docs.geoserver.org/stable/en/user/services/wms/vendor.html). * @example * ```js * const nexrad = new WMSTileLayer("http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", { * layers: 'nexrad-n0r-900913', * format: 'image/png', * transparent: true, * attribution: "Weather data © 2012 IEM Nexrad" * }); * ``` * @template {WMSTileLayerOptions} [O=WMSTileLayerOptions] * @template {TileLayerEventMap} [E=TileLayerEventMap] * @extends {TileLayer<O & WMSTileLayerDefaults, E>} */ export declare class WMSTileLayer<O extends WMSTileLayerOptions = WMSTileLayerOptions, E extends TileLayerEventMap = TileLayerEventMap> extends TileLayer<O & WMSTileLayerDefaults, E> { /** The WMS request parameters. */ wmsParams: WMSParams; /** @type {typeof CRS} */ _crs: typeof CRS; /** @type {number} */ _wmsVersion: number; static initHooks: boolean; static defaultWmsParams: { service: string; request: string; /** **(required)** Comma-separated list of WMS layers to show. */ layers: string; /** Comma-separated list of WMS styles. */ styles: string; /** WMS image format (use `'image/png'` for layers with transparency). */ format: string; /** If `true`, the WMS service will return images with transparency. */ transparent: boolean; /** Version of the WMS service to use */ version: string; }; /** @type {Defaults<WMSTileLayerOptions>} */ static defaultOptions: Defaults<WMSTileLayerOptions>; /** * Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object. * @param {string} url * @param {NoInfer<Partial<O>>} options */ constructor(url: string, options: NoInfer<Partial<O>>); /** @param {LeafletMap} map */ onAdd(map: LeafletMap): void; _updateCrsParam(): void; /** @param {Coords} coords */ getTileUrl(coords: Coords): string; /** * Merges an object with the new parameters and re-requests tiles * on the current screen (unless `noRedraw` was set to true). * @param {Partial<WMSParams>} params * @param {boolean} [noRedraw] */ setParams(params: Partial<WMSParams>, noRedraw?: boolean): this; } export {};