Classes
Functions
-
import {optionsFromCapabilities} from 'ol/source/WMTS';Generate source options from a capabilities object.
Name Type Description wmtsCapObject An object representing the capabilities document.
configObject Configuration properties for the layer. Defaults for the layer will apply if not provided.
Required config properties:
- layer - {string} The layer identifier.
Optional config properties:
- matrixSet - {string} The matrix set identifier, required if there is more than one matrix set in the layer capabilities.
- projection - {string} The desired CRS when no matrixSet is specified. eg: "EPSG:3857". If the desired projection is not available, an error is thrown.
- requestEncoding - {string} url encoding format for the layer. Default is the first tile url format found in the GetCapabilities response.
- style - {string} The name of the style
- format - {string} Image format for the layer. Default is the first format returned in the GetCapabilities response.
- crossOrigin - {string|null|undefined} Cross origin. Default is
undefined.
Returns:
WMTS source options object ornullif the layer was not found.
Type Definitions
-
Options{Object}
-
Properties:
Name Type Description attributionsAttributionLike | undefined Attributions.
attributionsCollapsibleboolean
(defaults to true)Attributions are collapsible.
cacheSizenumber | undefined Deprecated. Use the cacheSize option on the layer instead.
crossOriginnull | string | undefined The
crossOriginattribute for loaded images. Note that you must provide acrossOriginvalue if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.interpolateboolean
(defaults to true)Use interpolated values when resampling. By default, linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
tileGridWMTSTileGrid Tile grid.
projectionProjectionLike | undefined Projection. Default is the view projection.
reprojectionErrorThresholdnumber
(defaults to 0.5)Maximum allowed reprojection error (in pixels). Higher values can increase reprojection performance, but decrease precision.
requestEncodingRequestEncoding
(defaults to 'KVP')Request encoding.
layerstring Layer name as advertised in the WMTS capabilities.
stylestring Style name as advertised in the WMTS capabilities.
tileClassClass<ImageTile> | undefined Class used to instantiate image tiles. Default is
ImageTile.tilePixelRationumber
(defaults to 1)The pixel ratio used by the tile service. For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px by 512px images (for retina/hidpi devices) then
tilePixelRatioshould be set to2.formatstring
(defaults to 'image/jpeg')Image format. Only used when
requestEncodingis'KVP'.versionstring
(defaults to '1.0.0')WMTS version.
matrixSetstring Matrix set.
dimensionsObject | undefined Additional "dimensions" for tile requests. This is an object with properties named like the advertised WMTS dimensions.
urlstring | undefined A URL for the service. For the RESTful request encoding, this is a URL template. For KVP encoding, it is normal URL. A
{?-?}template pattern, for examplesubdomain{a-f}.domain.com, may be used instead of defining each one separately in theurlsoption.tileLoadFunctionLoadFunction | undefined Optional function to load a tile given a URL. The default is
function(imageTile, src) { imageTile.getImage().src = src; };urlsArray.<string> | undefined An array of URLs. Requests will be distributed among the URLs in this array.
wrapXboolean
(defaults to false)Whether to wrap the world horizontally.
transitionnumber | undefined Duration of the opacity transition for rendering. To disable the opacity transition, pass
transition: 0.zDirectionnumber | NearestDirectionFunction
(defaults to 0)Choose whether to use tiles with a higher or lower zoom level when between integer zoom levels. See
getZForResolution. -
RequestEncoding{'KVP'} {'REST'}
-
Request encoding. One of 'KVP', 'REST'.