interface Options {
    accessToken?: string;
    accessTokenParam?: string;
    getImage?: (
        arg0: VectorLayer<any> | VectorTileLayer<any>,
        arg1: string,
    ) => string | HTMLCanvasElement | HTMLImageElement;
    projection?: string;
    resolutions?: number[];
    styleUrl?: string;
    transformRequest?: (
        arg0: string,
        arg1: ResourceType,
    ) => string | void | Request | Promise<string | Request>;
    webfonts?: string;
}

Properties

accessToken?: string

Access token for 'mapbox://' urls.

accessTokenParam?: string

Access token param. For internal use.

getImage?: (
    arg0: VectorLayer<any> | VectorTileLayer<any>,
    arg1: string,
) => string | HTMLCanvasElement | HTMLImageElement

Function that returns an image for an icon name. If the result is an HTMLImageElement, it must already be loaded. The layer can be used to call layer.changed() when the loading and processing of the image has finished. This function be used for icons not in the sprite or to override sprite icons.

projection?: string

Only useful when working with non-standard projections. Code of a projection registered with OpenLayers. All sources of the style must be provided in this projection. The projection must also have a valid extent defined, which will be used to determine the origin and resolutions of the tile grid for all tiled sources of the style. When provided, the bbox placeholder in tile and geojson urls changes: the default is {bbox-epsg-3857}, when projection is e.g. set to EPSG:4326, the bbox placeholder will be {bbox-epsg-4326}.

resolutions?: number[]

Only useful when working with non-standard projections. Resolutions for mapping resolution to the zoom used in the Mapbox/MapLibre style.

styleUrl?: string

URL of the Mapbox GL style. Required for styles that were provided as object, when they contain a relative sprite url, or sources referencing data by relative url.

transformRequest?: (
    arg0: string,
    arg1: ResourceType,
) => string | void | Request | Promise<string | Request>

Function for controlling how ol-mapbox-style fetches resources. Can be used for modifying the url, adding headers or setting credentials options. Called with the url and the resource type as arguments, this function is supposed to return a Request or a url string, or a promise tehereof. Without a return value the original request will not be modified.

webfonts?: string

Template for resolving webfonts. Can be used to specify where to fetch web fonts when no ol:webfonts metadata is set in the style object. See getFonts() and the "Font handling" section in README.md for details.