Options
All
  • Public
  • Public/Protected
  • All
Menu

Contains some recipes for creating complex OpenLayers objects. Currently only WMTS layers created from a Capabilities URL.

Index

Functions

createWmtsLayer

  • createWmtsLayer(url: string, config: Partial<Options>, urlMapper?: (urls: string[]) => string[]): Promise<TileLayer>
  • Trivial wrapper around createWmtsSource, creating a TileLayer based on the WMTS Source. See that function for a description of the parameters.

    Parameters

    • url: string
    • config: Partial<Options>
    • Optional urlMapper: (urls: string[]) => string[]
        • (urls: string[]): string[]
        • Parameters

          • urls: string[]

          Returns string[]

    Returns Promise<TileLayer>

createWmtsSource

  • createWmtsSource(capabilitiesUrl: string, config: Partial<Options>, urlMapper?: (urls: string[]) => string[]): Promise<WMTS>
  • Creates an OpenLayers WMTS source based on a capabilities URL. This is mostly boilerplate around a fetch and OpenLayers' own optionsFromCapabilities.

    Parameters

    • capabilitiesUrl: string

      The URL to the capabilities file

    • config: Partial<Options>

      Any additional configuration we want when creating the source. Typically, this will be things like Matrix Set or format. See https://openlayers.org/en/latest/apidoc/module-ol_source_WMTS.html#.optionsFromCapabilities

    • Optional urlMapper: (urls: string[]) => string[]

      A function converting the URL(s) reported by the capabilities to an array of other URLs. Typically, this can be used if the server uses a scheme of multiple subdomain aliases to work around the browser limitation on concurrent requests to the same domain, though this is less relevant in modern browsers.

        • (urls: string[]): string[]
        • Parameters

          • urls: string[]

          Returns string[]

    Returns Promise<WMTS>