npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@allmaps/leaflet

v1.0.0-beta.54

Published

Allmaps Leaflet plugin

Readme

@allmaps/leaflet

Allmaps plugin for Leaflet. This plugin allows displaying georeferenced IIIF images on a Leaflet map. The plugin works by loading Georeference Annotations and uses WebGL to transform images from a IIIF image server to overlay them on their correct geographical position.

See allmaps.org for more information.

The development of the Allmaps plugin for Leaflet was funded by CLARIAH-VL. The development of the Allmaps plugin for Leaflet was funded by CLARIAH-VL.

Example of the Allmaps plugin for Leaflet

Examples:

How it works

This plugin exports the class WarpedMapLayer that extends L.Layer. You can add one or multiple Georeference Annotations (or AnnotationPages that contain multiple Georeference Annotations) to a WarpedMapLayer, and add the WarpedMapLayer to your Leaflet map. This will render all georeferenced maps defined by the Georeference Annotations.

To understand what happens under the hood for each georeferenced map, see the @allmaps/render package.

This plugin implements a lot of methods from @allmaps/warpedmaplayer, the core package gathering the functionality connecting the Allmaps plugins to the @allmaps/render package.

Installation

This package works in browsers and in Node.js as an ESM or an UMD module.

Install with pnpm:

npm install @allmaps/leaflet

You can optionally build this package locally by running:

pnpm run build

The easiest way to test this package during local development is via @allmaps/test-plugins. A minimal example is also included in ./index.html and can be served via pnpm run dev.

Usage

Built for Leaflet 1.9, but should work with earlier versions as well.

Adding a WarpedMapLayer to a MapLibre Map

Creating a WarpedMapLayer and adding it to a map looks like this:

import L from 'leaflet'

import { WarpedMapLayer } from '@allmaps/leaflet'

const map = L.map('map', {
  center: [51.0518, 3.7278],
  zoom: 14,
  // Zoom animations for more than one zoom level are
  // currently not supported by the Allmaps plugin for Leaflet
  zoomAnimationThreshold: 1
})
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
  attribution:
    '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map)

const annotationUrl =
  'https://annotations.allmaps.org/maps/2d49b3ecd1ba6346'
const warpedMapLayer = new WarpedMapLayer(annotationUrl).addTo(map)

When adding this WarpedMapLayer to the Leaflet map, the georeferenced map specified in the Georeference Annotation will be rendered on the Leaflet map.

Ways to load Georeference Annotations

Once the layer has been added to the map, a Georeference Annotation can be added to a WarpedMapLayer using the addGeoreferenceAnnotation and addGeoreferenceAnnotationByUrl functions:

fetch(annotationUrl)
  .then((response) => response.json())
  .then((annotation) => warpedMapLayer.addGeoreferenceAnnotation(annotation))

Or:

await warpedMapLayer.addGeoreferenceAnnotationByUrl(annotationUrl)

It's also possible to create a WarpedMapList first and pass it to the layer on creation. This has the advantage of being able to compute properties of a WarpedMapList first, e.g. getting the bounds and passing it to the Leaflet Map.

import L from 'leaflet'

import { WarpedMapLayer } from '@allmaps/leaflet'
import { WarpedMapList } from '@allmaps/render'
import { WebGL2WarpedMap } from '@allmaps/render/webgl2'

const annotationUrl =
  'https://annotations.allmaps.org/manifests/8f9faeba73d67031'
const annotation = await fetch(annotationUrl).then((response) =>
    response.json()
  )
const warpedMapList = new WarpedMapList<WebGL2WarpedMap>()
await warpedMapList.addGeoreferenceAnnotation(annotation)
const bbox = warpedMapList.getMapsBbox()

const map = L.map('map', {
  // Zoom animations for more than one zoom level are
  // currently not supported by the Allmaps plugin for Leaflet
  zoomAnimationThreshold: 1
})
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
  attribution:
    '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map)
const warpedMapLayer = new WarpedMapLayer(undefined, { warpedMapList }).addTo(map)
if (bbox) {
  map.fitBounds([ [ bbox[0], bbox[1] ], [ bbox[2], bbox[3] ] ])
}

Note that the ...ByUrl() functions are not available on a WarpedMapList.

WarpedMapLayer API, Options and Events

See the @allmaps/warpedmaplayer package for the API documentation of the methods coming from the WarpedMapLayer class (shared by all Allmaps plugins). It describes the methods like addGeoreferenceAnnotation() and includes a list of all options that can be set on instances of the class and all events which are passed to the native map instance hosting the layer instance.

You can set options on the entire layer, or on a specific map on the layer (overwriting layer options):

warpedMapLayer.setLayerOptions({ visible: true })
warpedMapLayer.setMapOptions(mapId, { visible: true })

You can listen to events in the typical way:

map.on('warpedmapadded', (event) => {
  console.log(event.mapIds)
})

License

MIT

API

LeafletWarpedMapLayerOptions

Type
SpecificLeafletWarpedMapLayerOptions & Partial<WebGL2RenderOptions>

new WarpedMapLayer(annotationOrAnnotationUrl, options)

Creates a WarpedMapLayer

Parameters
  • annotationOrAnnotationUrl (unknown)
    • Georeference Annotation or URL of a Georeference Annotation
  • options? (Partial<LeafletWarpedMapLayerOptions> | undefined)
    • Options for the layer
Returns

WarpedMapLayer.

Extends
  • BaseWarpedMapLayer

WarpedMapLayer#_animateZoom(event)

Parameters
  • event (L.ZoomAnimEvent)
Returns

void.

WarpedMapLayer#_annotationOrAnnotationUrl

Type
unknown

WarpedMapLayer#_initGl()

Parameters

There are no parameters.

Returns

void.

WarpedMapLayer#_resized(entries)

Parameters
  • entries (Array<ResizeObserverEntry>)
Returns

void.

WarpedMapLayer#_unload()

Parameters

There are no parameters.

Returns

void.

WarpedMapLayer#_update()

Parameters

There are no parameters.

Returns

HTMLDivElement | undefined.

WarpedMapLayer#_updateZIndex()

Parameters

There are no parameters.

Returns

void.

WarpedMapLayer#addEventListeners()

Parameters

There are no parameters.

Returns

void.

WarpedMapLayer#addGeoreferenceAnnotation(annotation, mapOptions)

Adds a Georeference Annotation

Parameters
  • annotation (unknown)
    • Georeference Annotation
  • mapOptions? (Partial<WebGL2WarpedMapOptions> | undefined)
    • Map options
Returns

Map IDs of the maps that were added, or an error per map (Array<string | Error>).

WarpedMapLayer#addGeoreferenceAnnotationByUrl(annotationUrl, mapOptions)

Adds a Georeference Annotation by URL

Parameters
  • annotationUrl (string)
    • URL of a Georeference Annotation
  • mapOptions? (Partial<WebGL2WarpedMapOptions> | undefined)
    • Map options
Returns

Map IDs of the maps that were added, or an error per map (Promise<Array<string | Error>>).

WarpedMapLayer#addGeoreferencedMap(georeferencedMap, mapOptions)

Adds a Georeferenced Map

Parameters
  • georeferencedMap (unknown)
    • Georeferenced Map
  • mapOptions? (Partial<WebGL2WarpedMapOptions> | undefined)
    • Map options
Returns

Map ID of the map that was added (string).

WarpedMapLayer#addImageInfos(imageInfos)

Adds image information to the WarpedMapList's image information cache

Parameters
  • imageInfos (Array<unknown>)
    • Image informations
Returns

Image IDs of the image informations that were added (Array<string>).

WarpedMapLayer#addSprites(sprites, imageUrl, imageSize)

Adds sprites to the Renderer's sprite tile cache

This adds tiles from sprites to warped maps in WarpedMapList. Load maps before running this function. This uses the image info of related maps. When using addImageInfos(), call it before calling this function.

Parameters
  • sprites (Array<Sprite>)
    • Sprites
  • imageUrl (string)
    • Image url
  • imageSize ([number, number])
    • Image size
Returns

Promise<void>.

WarpedMapLayer#bringMapsForward(mapIds)

Bring maps forward

Parameters
  • mapIds (Iterable<string>)
    • IDs of the maps
Returns

void.

WarpedMapLayer#bringMapsToFront(mapIds)

Bring maps to front

Parameters
  • mapIds (Iterable<string>)
    • IDs of the maps
Returns

void.

WarpedMapLayer#bringToBack()

Brings the layer to the back of other overlays (in the same map pane).

Parameters

There are no parameters.

Returns

this.

WarpedMapLayer#bringToFront()

Brings the layer in front of other overlays (in the same map pane).

Parameters

There are no parameters.

Returns

this.

WarpedMapLayer#canvas?

Type
HTMLCanvasElement

WarpedMapLayer#clear()

Removes all warped maps from the layer

Parameters

There are no parameters.

Returns

void.

WarpedMapLayer#container?

Type
HTMLDivElement

WarpedMapLayer#contextLost(event)

Parameters
  • event (Event)
Returns

void.

WarpedMapLayer#contextRestored(event)

Parameters
  • event (Event)
Returns

void.

WarpedMapLayer#defaultSpecificWarpedMapLayerOptions

Type
{
  interactive: boolean
  className: string
  pane: string
  zIndex?: number
}

WarpedMapLayer#getBbox(options)

Get the bounding box of all maps in the layer

The result is returned in lon-lat EPSG:4326 by default.

Note: more selection options are available on this function of WarpedMapList

Parameters
  • options? (Partial<ProjectionOptions & MaskOptions> | undefined)
    • Mask and projection options, defaults to applied mask and current projection
Returns

The bbox of all maps, in the chosen projection, or undefined if there were no maps (Bbox | undefined).

WarpedMapLayer#getBounds()

Returns the bounds of all visible maps (inside or outside of the Viewport), in latitude/longitude coordinates.

Parameters

There are no parameters.

Returns

[Point, Point] | undefined.

  • L.LatLngBounds in array form of all visible maps

WarpedMapLayer#getCenter(options)

Get the center of the bounding box of all maps in the layer

The result is returned in lon-lat EPSG:4326 by default.

Note: more selection options are available on this function of WarpedMapList

Parameters
  • options? (Partial<ProjectionOptions & MaskOptions> | undefined)
    • Mask and projection options, defaults to applied mask and current projection
Returns

The center of the bbox of all maps, in the chosen projection, or undefined if there were no maps (Point | undefined).

WarpedMapLayer#getConvexHull(options)

Get the convex hull of all maps in the layer

The result is returned in lon-lat EPSG:4326 by default.

Note: more selection options are available on this function of WarpedMapList

Parameters
  • options? (Partial<ProjectionOptions & MaskOptions> | undefined)
    • Mask and projection options, defaults to applied mask and current projection
Returns

The convex hull of all maps, in the chosen projection, or undefined if there were no maps (Ring | undefined).

WarpedMapLayer#getDefaultOptions()

Get the default options the layer

Parameters

There are no parameters.

Returns

SpecificLeafletWarpedMapLayerOptions & Partial<WebGL2RenderOptions> & SpecificBaseRenderOptions<WebGL2WarpedMap> & Partial<...> & SpecificWebGL2WarpedMapOptions & SpecificTriangulatedWarpedMapOptions & WarpedMapOptions.

WarpedMapLayer#getLayerOptions()

Get the layer options

Parameters

There are no parameters.

Returns

{ interactive?: boolean | undefined; className?: string | undefined; pane?: string | undefined; zIndex?: number | undefined; warpedMapFactory?: WarpedMapFactory<WebGL2WarpedMap> | undefined; ... 78 more ...; distortionMeasure?: DistortionMeasure | undefined; }.

WarpedMapLayer#getMapDefaultOptions(mapId)

Get the default options of a map

These come from the default option settings for WebGL2WarpedMaps and the map's georeferenced map proporties

Parameters
  • mapId (string)
    • Map ID for which the options apply
Returns

WebGL2WarpedMapOptions | undefined.

WarpedMapLayer#getMapIds()

Get mapIds for all maps in the layer

Note: more selection options are available on this function of WarpedMapList

Parameters

There are no parameters.

Returns

The mapIds of all maps (Array<string>).

WarpedMapLayer#getMapMapOptions(mapId)

Get the map-specific options of a map

Parameters
  • mapId (string)
    • Map ID for which the options apply
Returns

Partial<WebGL2WarpedMapOptions> | undefined.

WarpedMapLayer#getMapOptions(mapId)

Get the options of a map

These options are the result of merging the default, georeferenced map, layer and map-specific options of that map.

Parameters
  • mapId (string)
    • Map ID for which the options apply
Returns

WebGL2WarpedMapOptions | undefined.

WarpedMapLayer#getMapZIndex(mapId)

Get the z-index of a map

Parameters
  • mapId (string)
    • Map ID for which to get the z-index
Returns

The z-index of a map (number | undefined).

WarpedMapLayer#getMapsBbox(mapIds, options)

Get the bounding box of all selected maps

The result is returned in lon-lat EPSG:4326 by default.

Note: more selection options are available on this function of WarpedMapList

Parameters
  • mapIds (Array<string>)
    • Map IDs
  • options? (Partial<ProjectionOptions & MaskOptions> | undefined)
    • Mask and projection options, defaults to applied mask and current projection
Returns

The bbox of all selected maps, in the chosen projection, or undefined if there were no maps matching the selection (Bbox | undefined).

WarpedMapLayer#getMapsCenter(mapIds, options)

Get the center of the bounding box of all selected maps

The result is returned in lon-lat EPSG:4326 by default.

Note: more selection options are available on this function of WarpedMapList

Parameters
  • mapIds (Array<string>)
    • Map IDs
  • options? (Partial<ProjectionOptions & MaskOptions> | undefined)
    • Mask and projection options, defaults to applied mask and current projection
Returns

The center of the bbox of all selected maps, in the chosen projection, or undefined if there were no maps matching the selection (Point | undefined).

WarpedMapLayer#getMapsConvexHull(mapIds, options)

Get the convex hull of all selected maps maps

The result is returned in lon-lat EPSG:4326 by default.

Note: more selection options are available on this function of WarpedMapList

Parameters
  • mapIds (Array<string>)
    • Map IDs
  • options? (Partial<ProjectionOptions & MaskOptions> | undefined)
    • Mask and projection options, defaults to applied mask and current projection
Returns

The convex hull of all selected maps, in the chosen projection, or undefined if there were no maps matching the selection (Ring | undefined).

WarpedMapLayer#getOpacity()

Get the layer opacity

Returns a number between 0 and 1 (the default)

Parameters

There are no parameters.

Returns

number.

WarpedMapLayer#getWarpedMap(mapId)

Get the WarpedMap instance for a map

Parameters
  • mapId (string)
    • Map ID of the requested WarpedMap instance
Returns

WebGL2WarpedMap | undefined.

WarpedMapLayer#getWarpedMapList()

Get the WarpedMapList object that contains a list of the warped maps of all loaded maps

Parameters

There are no parameters.

Returns

WarpedMapList<WebGL2WarpedMap>.

WarpedMapLayer#getWarpedMaps(mapIds)

Get the WarpedMap instances for all maps, or all selected maps

If no argument is passed, the WarpedMap instance of all maps in the layer is passed

Note: more selection options are available on this function of WarpedMapList

Parameters
  • mapIds? (Array<string> | undefined)
    • Map IDs
Returns

The WarpedMap instance of all (selected) map (Array<WebGL2WarpedMap>).

WarpedMapLayer#getZIndex()

Gets the z-index of the layer.

Parameters

There are no parameters.

Returns

number | undefined.

WarpedMapLayer#gl?

Type
WebGL2RenderingContext

WarpedMapLayer#initialize(annotationOrAnnotationUrl, options)

Parameters
  • annotationOrAnnotationUrl (unknown)
  • options? (Partial<LeafletWarpedMapLayerOptions> | undefined)
Returns

void.

WarpedMapLayer#nativePassWarpedMapEvent(event)

Parameters
  • event (Event)
Returns

void.

WarpedMapLayer#nativeUpdate()

Parameters

There are no parameters.

Returns

void.

WarpedMapLayer#onAdd(map)

Contains all code code that creates DOM elements for the layer and adds them to map panes where they belong.

Parameters
  • map (L.Map)
Returns

this.

WarpedMapLayer#onRemove(map)

Contains all cleanup code that removes the layer's elements from the DOM.

Parameters
  • map (L.Map)
Returns

this.

WarpedMapLayer#options

Type
SpecificLeafletWarpedMapLayerOptions & Partial<WebGL2RenderOptions>

WarpedMapLayer#removeEventListeners()

Parameters

There are no parameters.

Returns

void.

WarpedMapLayer#removeGeoreferenceAnnotation(annotation)

Removes a Georeference Annotation

Parameters
  • annotation (unknown)
    • Georeference Annotation
Returns

Map IDs of the maps that were removed, or an error per map (Array<string | Error>).

WarpedMapLayer#removeGeoreferenceAnnotationByUrl(annotationUrl)

Removes a Georeference Annotation by URL

Parameters
  • annotationUrl (string)
    • URL of a Georeference Annotation
Returns

Map IDs of the maps that were removed, or an error per map (Promise<Array<string | Error>>).

WarpedMapLayer#removeGeoreferencedMap(georeferencedMap)

Removes a Georeferenced Map

Parameters
  • georeferencedMap (unknown)
    • Georeferenced Map
Returns

Map ID of the map that was removed (string).

WarpedMapLayer#removeGeoreferencedMapById(mapId)

Removes a Georeferenced Map by its ID

Parameters
  • mapId (string)
    • Map ID of the georeferenced map to remove
Returns

Map ID of the map that was removed (string).

WarpedMapLayer#renderer?

Type
WebGL2Renderer

WarpedMapLayer#resetLayerOptions(layerOptionKeys, animationOptions)

Reset the layer options

Undefined option keys reset all options

Doesn't reset render options or specific warped map layer options. Use setOptions() instead.

Parameters
  • layerOptionKeys? (Array<string> | undefined)
    • Keys of the layer options to reset
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

WarpedMapLayer#resetMapsAndListOptions(mapIds, mapsOptionKeys, layerOptionKeys, animationOptions)

Reset the map-specific options of the specified maps, and the layer options

Omitting mapsOptionKeys or layerOptionKeys resets all options for that scope; passing an empty array resets none.

Parameters
  • mapIds (Array<string>)
    • IDs of the maps whose options to reset
  • mapsOptionKeys? ( | Array< | keyof SpecificWebGL2WarpedMapOptions | keyof SpecificTriangulatedWarpedMapOptions | keyof WarpedMapOptions > | undefined)
    • Keys of the map-specific options to reset
  • layerOptionKeys? ( | Array< | keyof SpecificWebGL2WarpedMapOptions | keyof SpecificTriangulatedWarpedMapOptions | keyof WarpedMapOptions > | undefined)
    • Keys of the layer options to reset
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

WarpedMapLayer#resetMapsOptions(mapIds, mapsOptionKeys, animationOptions)

Reset the map-specific options of the specified maps

Omitting mapsOptionKeys resets all options; passing an empty array resets none.

Parameters
  • mapIds (Array<string>)
    • IDs of the maps whose options to reset
  • mapsOptionKeys? ( | Array< | keyof SpecificWebGL2WarpedMapOptions | keyof SpecificTriangulatedWarpedMapOptions | keyof WarpedMapOptions > | undefined)
    • Keys of the options to reset
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

WarpedMapLayer#resizeObserver

Type
ResizeObserver | undefined

WarpedMapLayer#sendMapsBackward(mapIds)

Send maps backward

Parameters
  • mapIds (Iterable<string>)
    • IDs of the maps
Returns

void.

WarpedMapLayer#sendMapsToBack(mapIds)

Send maps to back

Parameters
  • mapIds (Array<string>)
    • IDs of the maps
Returns

void.

WarpedMapLayer#setLayerOptions(layerOptions, animationOptions)

Set the layer options

Doesn't set render options or specific warped map layer options. Use setOptions() instead.

Parameters
  • layerOptions? (Partial<WarpedMapListOptions<WebGL2WarpedMap>> | undefined)
    • Layer options to set
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
    warpedMapLayer.setLayerOptions({ transformationType: 'thinPlateSpline' })
Returns

void.

WarpedMapLayer#setLayerTransformationType(transformationType, animationOptions)

Set the transformation type of the layer

Parameters
  • transformationType? (TransformationType | undefined)
    • Transformation type to set
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

WarpedMapLayer#setMapGcps(mapId, gcps, animationOptions)

Set the GCPs of a map

This only sets the map-specific gcps option of the map (or more specifically of the warped map used for rendering), overwriting the original GCPs inferred from the Georeference Annotation.

The original GCPs can be reset by resetting the map-specific GCPs option, and stay accessible in the warped map's map property.

Parameters
  • mapId (string)
    • Map ID for which to set the options
  • gcps (Array<Gcp>)
    • GCPs to set
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

WarpedMapLayer#setMapOptions(mapId, mapOptions, animationOptions)

Set the map-specific options of a map

In general setting a map-specific option also sets the corresponding option of the map, since these are the result of merging the default, georeferenced map, layer and map-specific options of that map.

A special case is setting a map-specific option to undefined: then the corresponding option is derived from the default, georeferenced map or layer option. This is equivalent to using the reset function for map-specific option.

Parameters
  • mapId (string)
    • Map ID for which to set the options
  • mapOptions ({ renderMaps?: boolean | undefined; renderLines?: boolean | undefined; renderPoints?: boolean | undefined; renderGcps?: boolean | undefined; renderGcpsColor?: string | undefined; renderGcpsSize?: number | undefined; renderGcpsBorderColor?: string | undefined; ... 56 more ...; distortionMeasure?: DistortionMeasure | ...)
    • Map-specific options to set
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

Examples
warpedMapLayer.setMapOptions(myMapId, { transformationType: 'thinPlateSpline' })

WarpedMapLayer#setMapResourceMask(mapId, resourceMask, animationOptions)

Set the resource mask of a map

This only sets the map-specific resourceMask option of the map (or more specifically of the warped map used for rendering), overwriting the original resource mask inferred from the Georeference Annotation.

The original resource mask can be reset by resetting the map-specific resource mask option, and stays accessible in the warped map's map property.

Parameters
  • mapId (string)
    • Map ID for which to set the options
  • resourceMask (Array<Point>)
    • Resource mask to set
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

WarpedMapLayer#setMapTransformationType(mapId, transformationType, animationOptions)

Set the transformation type of a map

This only sets the map-specific transformationType option of the map (or more specifically of the warped map used for rendering), overwriting the original transformation type inferred from the Georeference Annotation.

The original transformation type can be reset by resetting the map-specific transformation type option, and stays accessible in the warped map's map property.

Parameters
  • mapId (string)
    • Map ID for which to set the options
  • transformationType? (TransformationType | undefined)
    • Transformation type to set
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

WarpedMapLayer#setMapsAndLayerOptions(mapIds, mapsOptions, layerOptions, animationOptions)

Set the map-specific options of the specified maps, and the layer options

Useful when map-specific options are changed for multiple maps at once, together with the layer options, but only one animation should be fired.

Doesn't set render options or specific warped map layer options. Use setOptions() instead.

Parameters
  • mapIds (Array<string>)
    • IDs of the maps whose options to set
  • mapsOptions? (Partial<WebGL2WarpedMapOptions> | undefined)
    • Map-specific options to apply to each of those maps
  • layerOptions? (Partial<WarpedMapListOptions<WebGL2WarpedMap>> | undefined)
    • Layer options to apply
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

Examples
warpedMapLayer.setMapsAndLayerOptions([myMapId], { transformationType: 'thinPlateSpline' }, { visible: true })

WarpedMapLayer#setMapsOptions(mapIds, mapsOptions, animationOptions)

Set the map-specific options of the specified maps

In general setting a map-specific option also sets the corresponding option of the map, since these are the result of merging the default, georeferenced map, layer and map-specific options of that map.

A special case is setting a map-specific option to undefined: then the corresponding option is derived from the default, georeferenced map or layer option. This is equivalent to using the reset function for map-specific option.

Useful when map-specific options are changed for multiple maps at once, but only one animation should be fired.

Parameters
  • mapIds (Array<string>)
    • Map IDs of the maps whose options to set
  • mapsOptions? (Partial<WebGL2WarpedMapOptions> | undefined)
    • Map-specific options to apply to each of those maps
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

Examples
warpedMapLayer.setMapsOptions([myMapId], { transformationType: 'thinPlateSpline' })

WarpedMapLayer#setMapsTransformationType(mapIds, transformationType, animationOptions)

Set the transformation type of maps

This only sets the map-specific transformationType option of the map (or more specifically of the warped map used for rendering), overwriting the original transformation type inferred from the Georeference Annotation.

The original transformation type can be reset by resetting the map-specific transformation type option, and stays accessible in the warped map's map property.

Parameters
  • mapIds (Array<string>)
    • Map IDs for which to set the options
  • transformationType? (TransformationType | undefined)
    • Transformation type to set
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

WarpedMapLayer#setOpacity(opacity)

Set the layer opacity

Parameters
  • opacity (number)
    • Layer opacity to set
Returns

void.

WarpedMapLayer#setOptions(options)

Set the options

Parameters
  • options? ( | Partial<WebGL2RenderOptions> | Partial<LeafletWarpedMapLayerOptions> | undefined)
    • Options to set
Returns

void.

WarpedMapLayer#setZIndex(value)

Changes the z-index of the layer.

Parameters
  • value (number)
    • z-index
Returns

this.