Render functions for WebGL and image buffers
npm install @allmaps/renderAllmaps render module. Renders georeferenced IIIF maps specified by a Georeference Annotation.
The following renderers are implemented:
* CanvasRenderer: renders WarpedMaps to a HTML Canvas element with the Canvas 2D API
* WebGL2Renderer: renders WarpedMaps to a WebGL 2 context
* IntArrayRenderer: renders WarpedMaps to an IntArray
This module is mainly used in the Allmaps pipeline by the following packages:
* Allmaps plugin for Leaflet
* Allmaps plugin for MapLibre
* Allmaps plugin for OpenLayers
It is also used in the Allmaps Preview worker.
The render module accomplishes this task with the following classes:
* All renderers use the concept of a Viewport, describing coordinate reach that should be rendered. Create a viewport using it's constructor or the static methods in the Viewport class. The CanvasRenderer and WebGL2Renderer can deduce a viewport from the current WarpedMapList and the size of their (WebGL2-enabled) canvas.
* All renderers extend the BaseRenderer class, which implements the general actions of the (automatically throttled) render() calls: checking which maps are inside the current viewport, initially loading their image informations, checking which zoomlevel corresponds to the viewport, getting the IIIF tiles of that zoomlevel that are within the viewport.
* For the WebGL2Renderer, a WebGL2RenderingContext contains the rendering context for the drawing surface of an HTML element, and a WebGLProgram stores the vertex and fragment shader used for rendering a map, its lines and points.
* A WarpedMap is made from every Georeferenced Map (which in term are parsed Georeference Annotations) and is added to the renderer and hence to its warpedMapList. It contains useful properties like mask, center, size ... in resource, geospatial and projected geospatial coordinates. It contains a copy of the ground control points (GCPs) and resource masks, a projected version of the GCPs, a transformation built using the latter and usable to transform points from IIIF resource coordinates to projected geospatial coordinates.
* If WebGL2Renderer is used, a TriangulatedWarpedMap is created for every WarpedMap, finely triangulating the map, and a WebGL2WarpedMap is created, containing the WebGL2 information of the map (buffers etc.).
* A WarpedMapList contains the list of WarpedMaps to draw and uses an RTree for geospatial map lookup.
* A TileCache fetches and stores the image data of cached IIIF tiles.
During a CanvasRenderer or IntArrayRenderer render call, a map undergoes the following steps from Georeference Annotation to the canvas:
* For each viewport pixel, from its viewport coordinates its projected geospatial coordinates are obtained and transformed to its corresponding resource coordinates, i.e. it's location in the IIIF image.
* We find the tile on which this point is located, and express the resource coordinates in local tile coordinates.
* We set the color of this pixel from the colors of the four tile pixels surrounding the tile point, through a bilinear interpolation.
During a WebGL2Renderer render call, a map undergoes the following steps from Georeference Annotation to the canvas:
* The resource mask is triangulated: the area within is divided into small triangles.
* The optimal tile zoom level for the current viewport is searched, telling us which IIIF tile scaleFactor to use.
* The Viewport is transformed backwards from projected geospatial coordinates to resource coordinates of the IIIF image. The IIIF tiles covering this viewport on the resource image are fetched and cached in the TileCache.
* The area inside the resource mask is rendered in the viewport, triangle by triangle, using the cached tiles. The location of where to render each triangle is computed using the forward transformation built from the GPCs.
This package works in browsers and in Node.js as an ESM module.
Install with pnpm:
``sh`
pnpm install @allmaps/render
You can optionally build this package locally by running:
`sh`
pnpm run build
The most straightforward way to use the render logic in this package is by rendering a Georeference Annotation on a webmaps using one of the Allmaps plugins (which use the WebGL2Renderer) or setting up the Allmaps TileServer (which uses the CanvasRenderer).
It's also possible to call a renderer directly:
`js
import { CanvasRenderer } from '@allmaps/render/canvas'
// Create a canvas and set your desired width and height
const canvas = document.getElementById('canvas')
canvas.width = width // Your width
canvas.height = height // Your height
// Create a renderer from your canvas
const renderer = new CanvasRenderer(canvas)
// Fetch and parse an annotation
const annotationUrl = 'https://annotations.allmaps.org/images/4af0fa9c8207b36c'
const annotation = await fetch(annotationUrl).then((response) =>
response.json()
)
// Add the annotation to the renderer
await renderer.addGeoreferenceAnnotation(annotation)
// Render
// Note: no viewport specified, so one will be deduced. See below.
await renderer.render()
`
Notes:
* Maps with strong warping may appear to not exactly follow the specified viewport. This is due the backwards transform being explicitly used in the CanvasRenderer and IntArrayRenderer (and not in the WebGL2Renderer). For maps with strong warping, the backwards transform is currently not exact (even for polynomial transformations).
`js
import { WebGL2Renderer } from '@allmaps/render/webgl2'
// Create a canvas and set your desired width and height
const canvas = document.getElementById('canvas')
canvas.width = width // Your width
canvas.height = height // Your height
// Get the webgl context of your canvas
const gl = canvas.getContext('webgl2', { premultipliedAlpha: true })
// Create a renderer from your canvas
const renderer = new WebGL2Renderer(gl)
// Fetch and parse an annotation
const annotationUrl = 'https://annotations.allmaps.org/images/4af0fa9c8207b36c'
const annotation = await fetch(annotationUrl).then((response) =>
response.json()
)
// Add the annotation to the renderer
await renderer.addGeoreferenceAnnotation(annotation)
// Render
// Note: no viewport specified, so one will be deduced. See below.
renderer.render()
`
Notes: the WebGL2Renderer is not fully functional yet.
The WebGL2Renderer works with events which are meant to trigger re-renders. This logic can currently be implemented outside of this library (see the plugins), and will be implemented within* this library soon. As this will affect the API, please refrain from using this renderer as described above for now.
* The WebGL2Renderer loads images via web-workers. The bundling needs to be optimised to support using this renderer in all possible environments.
`js
import { IntArrayRenderer } from '@allmaps/render/intarray'
// Create a renderer
// See the IntArrayRenderer constructor for more info
// And the Allmaps Preview application for a concrete example
const renderer =
new IntArrayRenderer() <
D > // A data type
(getImageData, // A function to get the image date from an image
getImageDataValue, // A function to get the image data value from an image
getImageDataSize, // A function to get the image data size from an image
options) // IntArrayRenderer options
const annotationUrl = 'https://annotations.allmaps.org/images/4af0fa9c8207b36c'
const annotation = await fetch(annotationUrl).then((response) =>
response.json()
)
await renderer.addGeoreferenceAnnotation(annotation)
// Create your viewport (mandatory for this renderer)
const viewport = viewport // Your viewport, see below
const image = await renderer.render(viewport)
`
Notes:
* Maps with strong warping may appear to not exactly follow the specified viewport. This is due the backwards transform being explicitly used in the CanvasRenderer and IntArrayRenderer (and not in the WebGL2Renderer). For maps with strong warping, the backwards transform is currently not exact (even for polynomial transformations).
The render() call of all renderers take a Viewport as input. For the IntArrayRenderer, this argument is required. For the others, it is optional: if unspecified a viewport will be deduced from the canvas size and the warpedMapList formed by the annotations.
A viewport can be created through one of the following options:
Directly using the Viewport constructor:
`js
import { Viewport } from '@allmaps/render'
new Viewport(
viewportSize, // Your viewport size, as [width, height]
projectedGeoCenter, // Your center, in geo coordinates
projectedGeoPerViewportScale, // Your geo-per-viewport scale
{
rotation, // Your rotation
devicePixelRatio, // Your device pixel ratio, e.g. window.devicePixelRatio or just 1
projection // Your projection (of the above projected geospatial coordinates), as compatible with Proj4js
}
)
`
Using one of the following static methods:
* Viewport.fromSizeAndMaps()Viewport.fromSizeAndGeoPolygon()
* Viewport.fromSizeAndProjectedGeoPolygon()
* Viewport.fromScaleAndMaps()
* Viewport.fromScaleAndGeoPolygon()
* Viewport.fromScaleAndProjectedGeoPolygon()
*
For example, to derive a Viewport from a size and maps:
`jsrenderer.warpedMapList
const viewport = Viewport.fromSizeAndMaps(
viewportSize, // Your viewport size, as [width, height]
warpedMapList, // Your WarpedMapList, e.g. onlyVisible
partialExtendedViewportOptions // Your extended viewport options, including viewport options (rotation, devicePixelRatio and projection (used both to retrieve the extent of the maps and for the viewport itself)), a zoom; a fit; and WarpedMapList selection options like mapIds or `
)
Or, to derive a Viewport from a scale and maps:
`jsrenderer.warpedMapList
const viewport = Viewport.fromScaleAndMaps(
projectedGeoPerViewportScale, // Your scale
warpedMapList, // Your WarpedMapList, e.g. onlyVisible
partialExtendedViewportOptions // Your extended viewport options, including viewport options (rotation, devicePixelRatio and projection (used both to retrieve the extent of the maps and for the viewport itself)), a zoom; and WarpedMapList selection options like mapIds or
)
// In this case, resize your canvas to the computed viewport
// before rendering, to encompass the entire image.
canvas.width = viewport.canvasSize[0]
canvas.height = viewport.canvasSize[1]
canvas.style.width = viewport.viewportSize[0] + 'px'
canvas.style.height = viewport.viewportSize[1] + 'px'
context.scale(viewport.devicePixelRatio, viewport.devicePixelRatio)
`
For usage examples in webmapping libraries, see the source code of the Allmaps plugins for Leaflet,
MapLibre and OpenLayers.
In this package the following naming conventions are used:
* viewport... indicates properties described in viewport coordinates (i.e. with pixel size as perceived by the user)canvas...
* indicates properties described in canvas coordinates, so viewport device pixel ratio (i.e. with effective pixel size in memory)resource...
* indicates properties described in resource coordinates (i.e. IIIF tile coordinates of zoomlevel 1)geo...
* indicates properties described in geospatial coordinates ('WGS84', i.e. [lon, lat])projectedGeo...
* indicates properties described in projected geospatial coordinates (following a CRS, by default 'EPSG:3857' WebMercator)tile...
* indicates properties described IIIF tile coordinates
MIT
###### Fields
* animate (boolean)
###### Type
`ts`
object & SpecificWarpedMapListOptions & Partial
###### Type
`ts`
object & SpecificWarpedMapListOptions & Partial
###### Type
`ts`
W extends WebGL2WarpedMap
? WebGL2WarpedMapOptions
: W extends TriangulatedWarpedMap
? TriangulatedWarpedMapOptions
: W extends WarpedMap
? WarpedMapOptions
: never
###### Type
`ts`
object & SpecificWarpedMapListOptions & Partial
###### Fields
* projection ({id?: string; name?: string; definition: ProjectionDefinition})
###### Fields
* geoBbox? ([number, number, number, number])geoPoint?
* ([number, number])mapIds?
* (Iterable)onlyVisible?
* (boolean)
###### Type
`ts`
object
###### Fields
* distortionMeasures (Array)resourceResolution?
* (number)
###### Fields
* animatedOptions (Array)createRTree
* (boolean)rtreeUpdatedOptions
* (Array)
###### Fields
* height (number)imageId
* (string)scaleFactor
* (number)spriteTileScale?
* (number)width
* (number)x
* (number)y
* (number)
###### Fields
* imageSize ([number, number])imageUrl
* (string)sprites
* (Array)
###### Fields
* options? (unknown)type
* ( | 'straight'
| 'helmert'
| 'polynomial'
| 'polynomial1'
| 'polynomial2'
| 'polynomial3'
| 'thinPlateSpline'
| 'projective'
| 'linear')
Creates an instance of a TriangulatedWarpedMap.
###### Parameters
* mapId (string)georeferencedMap
* ID of the map
* ({ type: "GeoreferencedMap"; resource: { type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; id: string; height?: number | undefined; width?: number | undefined; partOf?: ({ type: string; id: string; label?: Record)listOptions?
* Georeferenced map used to construct the WarpedMap
* (Partial)mapOptions?
* (Partial)
###### Returns
TriangulatedWarpedMap.
###### Extends
* WarpedMap
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Type
`ts`
SpecificTriangulatedWarpedMapOptions & WarpedMapOptions
###### Type
`ts`
{ resourceResolution?: number | undefined; distortionMeasures?: Array
###### Type
`ts`
{ resourceResolution?: number | undefined; distortionMeasures?: Array
###### Type
`ts`
{ resourceResolution?: number | undefined; distortionMeasures?: Array
Mix previous transform properties with new ones (when changing an ongoing animation).
###### Parameters
* t (number)
* animation progress
###### Returns
void.
###### Type
`ts`
SpecificTriangulatedWarpedMapOptions & WarpedMapOptions
###### Type
`ts`
number | undefined
###### Type
`ts`
Array
###### Type
`ts`
{
resourceResolution: number | undefined
gcpUniquePoints: GcpAndDistortions[]
uniquePointIndices: number[]
uniquePointIndexInterpolatedPolygon: TypedPolygon
}
###### Type
`ts`
{
resourceResolution: number | undefined
gcpUniquePoints: GcpAndDistortions[]
uniquePointIndices: number[]
uniquePointIndexInterpolatedPolygon: TypedPolygon
}
###### Type
`ts`
Map<
number,
Map
>
###### Type
`ts`
Array
###### Type
`ts`
Array
###### Type
`ts`
Array
###### Type
`ts`
Array
###### Type
`ts`
Array
###### Type
`ts`
Array
Reset previous transform properties to new ones (when completing an animation).
###### Parameters
There are no parameters.
###### Returns
void.
###### Type
`ts`
number | undefined
###### Type
`ts`
Array
###### Type
`ts`
Map
Set default options
###### Parameters
There are no parameters.
###### Returns
void.
Set the distortionMeasure
###### Parameters
* distortionMeasure? (DistortionMeasure | undefined)
* the disortion measure
###### Returns
void.
Update the ground control points loaded from a georeferenced map to new ground control points.
###### Parameters
* gcps (Array)
* the new ground control points
###### Returns
void.
Set the internal projection
###### Parameters
* projection ({id?: string; name?: string; definition: ProjectionDefinition})
* the internal projection
###### Returns
void.
Set the projection
###### Parameters
* projection ({id?: string; name?: string; definition: ProjectionDefinition})
* the projection
###### Returns
void.
Update the resource mask loaded from a georeferenced map to a new mask.
###### Parameters
* resourceFullMask (Array)resourceAppliableMask
* (Array)resourceMask
* (Array)
* the new mask
###### Returns
void.
###### Type
`ts`
Array
###### Type
`ts`
0
###### Parameters
There are no parameters.
###### Returns
void.
Derive the (previous and new) resource and projectedGeo points from their corresponding triangulations.
Also derive the (previous and new) triangulation-refined resource and projectedGeo mask
###### Parameters
There are no parameters.
###### Returns
void.
Derive the (previous and new) distortions from their corresponding triangulations.
###### Parameters
There are no parameters.
###### Returns
void.
Update the (previous and new) triangulation of the resourceMask. Use cache if available.
###### Parameters
There are no parameters.
###### Returns
void.
Get default options
###### Parameters
There are no parameters.
###### Returns
SpecificTriangulatedWarpedMapOptions & WarpedMapOptions.
###### Type
`ts`
SpecificTriangulatedWarpedMapOptions & WarpedMapOptions
Creates a new Viewport
###### Parameters
* viewportSize ([number, number])projectedGeoCenter
* Size of the viewport in viewport pixels, as \[width, height].
* ([number, number])projectedGeoPerViewportScale
* Center point of the viewport, in projected geospatial coordinates.
* (number)partialViewportOptions?
* Scale of the viewport, in projection coordinates per viewport pixel.
* (Partial)
###### Returns
Viewport.
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
number
###### Type
`ts`
[number, number]
###### Parameters
There are no parameters.
###### Returns
[number, number, number, number, number, number].
###### Parameters
There are no parameters.
###### Returns
[number, number, number, number, number, number].
###### Parameters
There are no parameters.
###### Returns
[number, number, number, number, number, number].
###### Parameters
There are no parameters.
###### Returns
[number, number, number, number, number, number].
Returns a rectangle in projected geospatial coordinates
The rectangle is the result of a horizontal rectangle in Viewport space of size 'viewportSize',
scaled using projectedGeoPerViewportScale, centered,
rotated using 'rotation' and translated to 'projectedGeoCenter'.
###### Parameters
* viewportSize ([number, number])projectedGeoPerViewportScale
* (number)rotation
* (number)projectedGeoCenter
* ([number, number])
###### Returns
[Point, Point, Point, Point].
###### Type
`ts`
number
###### Type
`ts`
[number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
number
###### Type
`ts`
[number, number]
###### Parameters
* bufferFraction? (number | undefined)
###### Returns
[Point, Point, Point, Point].
###### Parameters
* bufferFraction? (number | undefined)
###### Returns
[Point, Point, Point, Point].
###### Type
`ts`
[number, number]
###### Type
`ts`
number
###### Type
`ts`
number
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
number
###### Type
`ts`
[number, number]
###### Type
`ts`
[number, number, number, number, number, number]
###### Type
`ts`
[number, number, number, number, number, number]
###### Type
`ts`
[number, number, number, number, number, number]
###### Type
`ts`
{id?: string; name?: string; definition: ProjectionDefinition}
###### Type
`ts`
number
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
number
###### Type
`ts`
[number, number]
###### Type
`ts`
[number, number, number, number, number, number]
Static method that creates a Viewport from a scale and a polygon in geospatial coordinates, i.e. lon-lat EPSG:4326.
Note: the scale is still in projected geospatial per viewport pixel!
###### Parameters
* projectedGeoPerViewportScale (number)geoPolygon
* Scale of the viewport, in projected geospatial coordinates per viewport pixel.
* (Array)partialExtendedViewportOptions?
* A polygon in geospatial coordinates.
* ( | Partial<
{rotation: number; devicePixelRatio: number} & ProjectionOptions &
ZoomOptions >
| undefined)
###### Returns
A new Viewport object (Viewport).
Static method that creates a Viewport from a scale and maps.
Optionally specify a projection, to be used both when obtaining the extent of selected warped maps in projected geospatial coordinates, as well as when create a viewport
###### Parameters
* projectedGeoPerViewportScale (number)warpedMapList
* Scale of the viewport, in projected geospatial coordinates per viewport pixel.
* (WarpedMapList)partialExtendedViewportOptions?
* A WarpedMapList.
* ( | Partial<
{rotation: number; devicePixelRatio: number} & ProjectionOptions &
ZoomOptions &
SelectionOptions >
| undefined)
* Optional viewport options.
###### Returns
A new Viewport object (Viewport).
Static method that creates a Viewport from a scale and a polygon in projected geospatial coordinates.
###### Parameters
* projectedGeoPerViewportScale (number)projectedGeoPolygon
* Scale of the viewport, in projected geospatial coordinates per viewport pixel.
* (Array)partialExtendedViewportOptions?
* A polygon in projected geospatial coordinates.
* ( | Partial<
{rotation: number; devicePixelRatio: number} & ProjectionOptions &
ZoomOptions >
| undefined)
###### Returns
A new Viewport object (Viewport).
Static method that creates a Viewport from a size and a polygon in geospatial coordinates, i.e. lon-lat EPSG:4326.
###### Parameters
* viewportSize ([number, number])geoPolygon
* Size of the viewport in viewport pixels, as \[width, height].
* (Array)partialExtendedViewportOptions?
* A polygon in geospatial coordinates.
* ( | Partial<
{rotation: number; devicePixelRatio: number} & ProjectionOptions &
ZoomOptions &
FitOptions >
| undefined)
* Optional viewport options
###### Returns
A new Viewport object (Viewport).
Static method that creates a Viewport from a size and maps.
Optionally specify a projection, to be used both when obtaining the extent of selected warped maps in projected geospatial coordinates, as well as when create a viewport
###### Parameters
* viewportSize ([number, number])warpedMapList
* Size of the viewport in viewport pixels, as \[width, height].
* (WarpedMapList)partialExtendedViewportOptions?
* A WarpedMapList.
* ( | Partial<
{rotation: number; devicePixelRatio: number} & ProjectionOptions &
ZoomOptions &
FitOptions &
SelectionOptions >
| undefined)
* Optional viewport options
###### Returns
A new Viewport object (Viewport).
Static method that creates a Viewport from a size and a polygon in projected geospatial coordinates.
###### Parameters
* viewportSize ([number, number])projectedGeoPolygon
* Size of the viewport in viewport pixels, as \[width, height].
* (Array)partialExtendedViewportOptions?
* A polygon in projected geospatial coordinates.
* ( | Partial<
{rotation: number; devicePixelRatio: number} & ProjectionOptions &
ZoomOptions &
FitOptions >
| undefined)
* Optional viewport options
###### Returns
A new Viewport object (Viewport).
Creates an instance of WarpedMap.
###### Parameters
* mapId (string)georeferencedMap
* ID of the map
* ({ type: "GeoreferencedMap"; resource: { type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; id: string; height?: number | undefined; width?: number | undefined; partOf?: ({ type: string; id: string; label?: Record)listOptions
* Georeferenced map used to construct the WarpedMap
* (Partial)mapOptions
* (Partial)
###### Returns
WarpedMap.
###### Extends
* EventTarget
###### Type
`ts`
AbortController
###### Parameters
* animationOptions? (Partial)
###### Returns
object.
###### Parameters
There are no parameters.
###### Returns
void.
###### Type
`ts`
{
fetchFn?: FetchFn
gcps: Gcp[]
resourceMask: Ring
transformationType: TransformationType
internalProjection: Projection
projection: Projection
visible: boolean
applyMask: boolean
distortionMeasure: DistortionMeasure | undefined
}
###### Parameters
There are no parameters.
###### Returns
void.
###### Type
`ts`
'log2sigma' | 'twoOmega' | 'airyKavr' | 'signDetJ' | 'thetaa'
###### Type
`ts`
Array
###### Type
`ts`
boolean
###### Type
`ts`
Array
###### Type
`ts`
Array
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
Array
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
Array
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
Array
###### Type
`ts`
{ type: "GeoreferencedMap"; resource: { type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; id: string; height?: number | undefined; width?: number | undefined; partOf?: ({ type: string; id: string; label?: Record
###### Type
`ts`
{ fetchFn?: FetchFn | undefined; gcps?: Array
Get default and georeferenced map options
###### Parameters
There are no parameters.
###### Returns
{
fetchFn?: FetchFn
gcps: Gcp[]
resourceMask: Ring
transformationType: TransformationType
internalProjection: Projection
projection: Projection
visible: boolean
applyMask: boolean
distortionMeasure: DistortionMeasure | undefined
}.
Get a projected transformer of the given transformation type.
Uses cashed projected transformers by transformation type,
and only computes a new projected transformer if none found.
Returns a projected transformer in the current projection,
even if the cached transformer was computed in a different projection.
Default settings apply for the options.
###### Parameters
* transformationType ( | 'straight'
| 'helmert'
| 'polynomial'
| 'polynomial1'
| 'polynomial2'
| 'polynomial3'
| 'thinPlateSpline'
| 'projective'
| 'linear')partialProjectedGcpTransformerOptions?
* (Partial)
###### Returns
A projected transformer (ProjectedGcpTransformer).
Get the reference scaling from the forward transformation of the projected Helmert transformer
###### Parameters
There are no parameters.
###### Returns
number.
###### Parameters
There are no parameters.
###### Returns
[Point, Point, Point, Point].
Get scale of the warped map, in resource pixels per canvas pixels.
###### Parameters
* viewport (Viewport)
* the current viewport
###### Returns
number.
Get scale of the warped map, in resource pixels per viewport pixels.
###### Parameters
* viewport (Viewport)
* the current viewport
###### Returns
number.
Check if this instance has parsed image
###### Parameters
There are no parameters.
###### Returns
boolean.
###### Type
`ts`
Image
###### Type
`ts`
{id?: string; name?: string; definition: ProjectionDefinition}
###### Type
`ts`
{ createRTree?: boolean | undefined; rtreeUpdatedOptions?: Array
Load the parsed image from cache, or fetch and parse the image info to create it
###### Parameters
* imagesById? (Map)
###### Returns
Promise.
###### Type
`ts`
string
###### Type
`ts`
{ fetchFn?: FetchFn | undefined; gcps?: Array
Mix previous transform properties with new ones (when changing an ongoing animation).
###### Parameters
* t (number)
* animation progress
###### Returns
void.
###### Type
`ts`
false
###### Type
`ts`
{
fetchFn?: FetchFn
gcps: Gcp[]
resourceMask: Ring
transformationType: TransformationType
internalProjection: Projection
projection: Projection
visible: boolean
applyMask: boolean
distortionMeasure: DistortionMeasure | undefined
}
###### Type
`ts`
Array
###### Type
`ts`
{
scaleFactor: number
width: number
height: number
originalWidth: number
originalHeight: number
columns: number
rows: number
}
###### Type
`ts`
'log2sigma' | 'twoOmega' | 'airyKavr' | 'signDetJ' | 'thetaa'
###### Type
`ts`
{id?: string; name?: string; definition: ProjectionDefinition}
###### Type
`ts`
| 'straight'
| 'helmert'
| 'polynomial'
| 'polynomial1'
| 'polynomial2'
| 'polynomial3'
| 'thinPlateSpline'
| 'projective'
| 'linear'
###### Type
`ts`
Array
###### Type
`ts`
Array
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
Array
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
Array
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
Array
###### Type
`ts`
Array
###### Type
`ts`
Array
###### Type
`ts`
ProjectedGcpTransformer
###### Type
`ts`
ProjectedGcpTransformer
###### Type
`ts`
Map
###### Type
`ts`
Map
###### Type
`ts`
{id?: string; name?: string; definition: ProjectionDefinition}
Reset the properties for the current values
###### Parameters
There are no parameters.
###### Returns
void.
Reset previous transform properties to new ones (when completing an animation).
###### Parameters
There are no parameters.
###### Returns
void.
###### Type
`ts`
Array
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
Array
###### Type
`ts`
Array
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
Array
###### Type
`ts`
[number, number, number, number]
###### Type
`ts`
[Point, Point, Point, Point]
###### Type
`ts`
Array
###### Type
`ts`
number
###### Parameters
There are no parameters.
###### Returns
void.
Set the distortionMeasure
###### Parameters
* distortionMeasure? (DistortionMeasure | undefined)
* the disortion measure
###### Returns
void.
Set tiles for the current viewport
###### Parameters
* fetchableTiles (Array)
###### Returns
void.
Update the ground control points loaded from a georeferenced map to new ground control points.
###### Parameters
* gcps (Array)
###### Returns
void.
Set the internal projection
###### Parameters
* projection? (Projection | undefined)
* the internal projection
###### Returns
void.
###### Parameters
* listOptions? (Partial)animationOptions?
* (Partial)
###### Returns
object.
###### Parameters
* mapOptions? (Partial)listOptions?
* (Partial)animationOptions?
* (Partial)
###### Returns
object.
Set overview tiles for the current viewport
###### Parameters
* overviewFetchableTiles (Array)
###### Returns
void.
Set the overview tile zoom level for the current viewport
###### Parameters
* tileZoomLevel? (TileZoomLevel | undefined)
* tile zoom level for the current viewport
###### Returns
void.
Set projectedGeoBufferedViewportRectangle for the current viewport
###### Parameters
* projectedGeoBufferedViewportRectangle? (Rectangle | undefined)
###### Returns
void.
Set the projection
###### Parameters
* projection? (Projection | undefined)
* the projection
###### Returns
void.
Set resourceBufferedViewportRingBboxAndResourceMaskBboxIntersection for the current viewport
###### Parameters
* resourceBufferedViewportRingBboxAndResourceMaskBboxIntersection? (Bbox | undefined)
###### Returns
void.
Set resourceBufferedViewportRing for the current viewport
###### Parameters
* resourceBufferedViewportRing? (Ring | undefined)
###### Returns
void.
Update the resource mask loaded from a georeferenced map to a new mask.
###### Parameters
* resourceFullMask (Array)resourceAppliableMask
* (Array)resourceMask
* (Array)
###### Returns
void.
Set the tile zoom level for the current viewport
###### Parameters
* tileZoomLevel? (TileZoomLevel | undefined)
* tile zoom level for the current viewport
###### Returns
void.
Set the transformationType
###### Parameters
* transformationType ( | 'straight'
| 'helmert'
| 'polynomial'
| 'polynomial1'
| 'polynomial2'
| 'polynomial3'
| 'thinPlateSpline'
| 'projective'
| 'linear')
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
boolean.
###### Parameters
There are no parameters.
###### Returns
boolean.
###### Parameters
There are no parameters.
###### Returns
boolean.
###### Type
`ts`
[number, number]
###### Type
`ts`
{
scaleFactor: number
width: number
height: number
originalWidth: number
originalHeight: number
columns: number
rows: number
}
###### Type
`ts`
| 'straight'
| 'helmert'
| 'polynomial'
| 'polynomial1'
| 'polynomial2'
| 'polynomial3'
| 'thinPlateSpline'
| 'projective'
| 'linear'
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
Get default options
###### Parameters
There are no parameters.
###### Returns
{
fetchFn?: FetchFn
gcps: Gcp[]
resourceMask: Ring
transformationType: TransformationType
internalProjection: Projection
projection: Projection
visible: boolean
applyMask: boolean
distortionMeasure: DistortionMeasure | undefined
}.
###### Parameters
* type (WarpedMapEventType)data?
* (Partial)
###### Returns
WarpedMapEvent.
###### Extends
* Event
###### Type
`ts`
{
mapIds?: Array
tileUrl?: string | undefined
optionKeys?: Array
spritesInfo?: SpritesInfo | undefined
}
Creates an instance of a WarpedMapList
###### Parameters
* warpedMapFactory ((
mapId: string,
georeferencedMap: GeoreferencedMap,
listOptions?: Partial
mapOptions?: Partial
) => W)options?
* Factory function for creating WarpedMap objects
* (Partial)
* Options of this list, which will be set on newly added maps as their list options
###### Returns
WarpedMapList.
###### Extends
* EventTarget
###### Parameters
* warpedMap (W)
###### Returns
void.
Parses an annotation and adds its georeferenced map to this list
###### Parameters
* annotation (unknown)mapOptions?
* Annotation
* (Partial)
* Map options
###### Returns
Map IDs of the maps that were added, or an error per map (Promise).
Adds a georeferenced map to this list
###### Parameters
* georeferencedMap (unknown)mapOptions?
* Georeferenced Map
* (Partial)
* Map options
###### Returns
Map ID of the map that was added (Promise).
###### Parameters
* georeferencedMap ({ type: "GeoreferencedMap"; resource: { type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; id: string; height?: number | undefined; width?: number | undefined; partOf?: ({ type: string; id: string; label?: Record)mapOptions?
* (Partial)
###### Returns
Promise.
Adds image informations, parses them to images and adds them to the image cache
###### Parameters
* imageInfos (Array)
* Image informations
###### Returns
Image IDs of the image informations that were added (Array).
###### Parameters
* warpedMap (W)
###### Returns
void.
Changes the z-index of the specified maps to bring them forward
###### Parameters
* mapIds (Iterable)
* Map IDs
###### Returns
void.
Changes the z-index of the specified maps to bring them to front
###### Parameters
* mapIds (Iterable)
* Map IDs
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
###### Parameters
There are no parameters.
###### Returns
void.
Get the default options of the list
###### Parameters
There are no parameters.
###### Returns
SpecificWarpedMapListOptions &
Partial
GetWarpedMapOptions.
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
GetWarpedMapOptions.
Get mapIds for selected maps
The selectionOptions allow a.o. to:
* filter for visible maps
* filter for specific mapIds
* filter for maps whose geoBbox overlap with the specified geoBbox
* filter for maps that overlap with a given geoPoint
###### Parameters
* partialSelectionOptions? (Partial)
* Selection options (e.g. mapIds), defaults to all visible maps
###### Returns
mapIds (Array).
Get the map-specific options of a map
###### Parameters
* mapId (string)
* Map ID for which the options apply
###### Returns
Partial.
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
GetWarpedMapOptions.
Get the z-index of a map
###### Parameters
* mapId (string)
* Map ID for which to get the z-index
###### Returns
number | undefined.
Get the bounding box of the maps in this list
The result is returned in the list's projection, EPSG:3857 by defaultEPSG:4326
Use {projection: {definition: 'EPSG:4326'}} to request the result in lon-lat
###### Parameters
* partialSelectionAndProjectionOptions? (Partial)
* Selection (e.g. mapIds) and projection options, defaults to all visible maps 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).
Get the center of the bounding box of the maps in this list
The result is returned in the list's projection, EPSG:3857 by defaultEPSG:4326
Use {projection: {definition: 'EPSG:4326'}} to request the result in lon-lat
###### Parameters
* partialSelectionAndProjectionOptions? (Partial)
* Selection (e.g. mapIds) and projection options, defaults to all visible maps 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).
Get the convex hull of the maps in this list
The result is returned in the list's projection, EPSG:3857 by defaultEPSG:4326
Use {projection: {definition: 'EPSG:4326'}} to request the result in lon-lat
###### Parameters
* partialSelectionAndProjectionOptions? (Partial)
* Selection (e.g. mapIds) and projection options, defaults to all visible maps 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).
Get the options of this list
###### Parameters
There are no parameters.
###### Returns
{ createRTree?: boolean | undefined; rtreeUpdatedOptions?: Array.
###### Parameters
* georeferencedMap ({ type: "GeoreferencedMap"; resource: { type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; id: string; height?: number | undefined; width?: number | undefined; partOf?: ({ type: string; id: string; label?: Record)
###### Returns
Promise.
###### Parameters
* partialSelectionAndProjectionOptions? (Partial)
###### Returns
Array.
Get the WarpedMap instance for a map
###### Parameters
* mapId (string)
* Map ID of the requested WarpedMap instance
###### Returns
WarpedMap instance, or undefined (W | undefined).
Get the WarpedMap instances for selected maps
The selectionOptions allow a.o. to:
* filter for visible maps
* filter for specific mapIds
* filter for maps whose geoBbox overlap with the specified geoBbox
* filter for maps that overlap with a given geoPoint
###### Parameters
* partialSelectionOptions? (Partial)
* Selection options (e.g. mapIds), defaults to all visible maps
###### Returns
WarpedMap instances (Iterable).
###### Parameters
* mapId (string)
###### Returns
void.
###### Type
`ts`
Map
Internal set map options
###### Parameters
* mapOptionsByMapId? (Map)listOptions?
* (Partial)animationOptions?
* (Partial)
###### Returns
void.
###### Type
`ts`
SpecificWarpedMapListOptions & Partial
Order mapIds
Use this as anonymous sort function in Array.prototype.sort()
###### Parameters
* mapId0 (string)mapId1
* (string)
###### Returns
number.
###### Parameters
* warpedMap (W)
###### Returns
void.
###### Parameters
* warpedMap (W)
###### Returns
void.
Parses an annotation and removes its georeferenced map from this list
###### Parameters
* annotation (unknown)
###### Returns
Map IDs of the maps that were removed, or an error per map (Promise).
Removes a georeferenced map from this list
###### Parameters
* georeferencedMap (unknown)
###### Returns
Map ID of the removed map, or an error (Promise).
Removes a georeferenced map from the list by its ID
###### Parameters
* mapId (string)
* Map ID
###### Returns
Map ID of the removed map, or an error (Promise).
###### Parameters
* mapId (string)
###### Returns
Promise.
###### Parameters
* georeferencedMap ({ type: "GeoreferencedMap"; resource: { type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; id: string; height?: number | undefined; width?: number | undefined; partOf?: ({ type: string; id: string; label?: Record)
###### Returns
Promise.
###### Parameters
There are no parameters.
###### Returns
void.
Resets the map-specific options of maps (and the list options)
An empty array resets all options, undefined resets no options.
###### Parameters
* mapIds (Array)mapOptionKeys?
* Map IDs for which to reset the options
* (Array)listOptionKeys?
* Keys of the map-specific options to reset
* (Array)animationOptions?
* Keys of the list options to reset
* (Partial)
* Animation options
###### Returns
void.
Resets the map-specific options of maps by map ID (and the list options)
An empty array or map resets all options (for all maps), undefined resets no options.
###### Parameters
* mapOptionkeysByMapId? (Map)listOptionKeys?
* Keys of map-specific options to reset by map ID
* (Array)animationOptions?
* Keys of the list options to reset
* (Partial)
* Animation options
###### Returns
void.
Resets the list options
An empty array resets all options, undefined resets no options.
###### Parameters
* listOptionKeys? (Array)animationOptions?
* Keys of the list options to reset
* (Partial)
* Animation options
###### Returns
void.
###### Type
`ts`
RTree
Changes the zIndex of the specified maps to send them backward
###### Parameters
* mapIds (Iterable)
* Map IDs
###### Returns
void.
Changes the z-index of the specified maps to send them to back
###### Parameters
* mapIds (Iterable)
* Map IDs
###### Returns
void.
Set the map-specific options of maps (and the list options)
###### Parameters
* mapIds (Array)mapOptions?
* Map IDs for which the options apply
* (Partial)listOptions?
* Map-specific options
* (Partial)animationOptions?
* list options
* (Partial)
* Animation options
###### Returns
void.
Set the map-specific options of maps by map ID (and the list options)
This is useful when when multiple (and possibly different)
map-specific options are changed at once,
but only one animation should be fired
###### Parameters
* mapOptionsByMapId? (Map)listOptions?
* Map-specific options by map ID
* (Partial)animationOptions?
* List options
* (Partial)
* Animation options
###### Returns
void.
Set the options of this list
Note: Map-specific options set here will be passed to newly added maps.
###### Parameters
* options? (Partial)animationOptions?
* List Options
* (Partial)
* Animation options
###### Returns
void.
###### Type
`ts`
(
mapId: string,
georeferencedMap: GeoreferencedMap,
listOptions?: Partial
mapOptions?: Partial
) => W
Maps in this list, indexed by their ID (Map).
###### Type
`ts`
Map
###### Type
`ts`
SpecificWarpedMapListOptions & Partial
###### Fields
* applyMask (boolean)distortionMeasure
* (DistortionMeasure | undefined)fetchFn?
* ((
input: Request | string | URL,
init?: RequestInit
) => Promise)gcps
* (Array)internalProjection
* ({id?: string; name?: string; definition: ProjectionDefinition})projection
* ({id?: string; name?: string; definition: ProjectionDefinition})resourceMask
* (Array)transformationType
* ( | 'straight'
| 'helmert'
| 'polynomial'
| 'polynomial1'
| 'polynomial2'
| 'polynomial3'
| 'thinPlateSpline'
| 'projective'
| 'linear')visible
* (boolean)
###### Parameters
There are no parameters.
###### Returns
(
mapId: string,
georeferencedMap: GeoreferencedMap,
listOptions?: Partial
mapOptions?: Partial
) => WarpedMap.
###### Parameters
* getImageData ((data: Uint8ClampedArray) => D)getImag
*