@allmaps/render
v1.0.0-beta.81
Published
Render functions for WebGL and image buffers
Readme
@allmaps/render
Allmaps 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 APIWebGL2Renderer: renders WarpedMaps to a WebGL 2 contextIntArrayRenderer: renders WarpedMaps to an IntArray
This module is mainly used in the Allmaps pipeline by the following packages:
It is also used in the Allmaps Preview worker.
How it works
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
BaseRendererclass, 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, aWebGL2RenderingContextcontains the rendering context for the drawing surface of an HTML element, and aWebGLProgramstores the vertex and fragment shader used for rendering a map, its lines and points.
- For the
- A
WarpedMapis 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
WebGL2Rendereris used, aTriangulatedWarpedMapis created for every WarpedMap, finely triangulating the map, and aWebGL2WarpedMapis created, containing the WebGL2 information of the map (buffers etc.).
- If
- A
WarpedMapListcontains the list of WarpedMaps to draw and uses anRTreefor geospatial map lookup. - A
TileCachefetches and stores the image data of cached IIIF tiles.
From Georeference Annotation to a rendered map
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
scaleFactorto 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.
Installation
This package works in browsers and in Node.js as an ESM module.
Install with pnpm:
pnpm install @allmaps/renderYou can optionally build this package locally by running:
pnpm run buildUsage
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:
CanvasRenderer
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).
WebGL2Renderer
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.
IntArrayRenderer
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).
Creating a Viewport
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:
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:
const viewport = Viewport.fromSizeAndMaps(
viewportSize, // Your viewport size, as [width, height]
warpedMapList, // Your WarpedMapList, e.g. `renderer.warpedMapList`
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 `onlyVisible`
)Or, to derive a Viewport from a scale and maps:
const viewport = Viewport.fromScaleAndMaps(
projectedGeoPerViewportScale, // Your scale
warpedMapList, // Your WarpedMapList, e.g. `renderer.warpedMapList`
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 `onlyVisible`
)
// 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.
Naming conventions
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
License
MIT
API
AnimationOptions
Fields
animate(boolean)
BaseRenderOptions
Type
object & SpecificWarpedMapListOptions & Partial<WebGL2WarpedMapOptions>CanvasRenderOptions
Type
object & SpecificWarpedMapListOptions & Partial<WebGL2WarpedMapOptions>GetWarpedMapOptions
Type
W extends WebGL2WarpedMap
? WebGL2WarpedMapOptions
: W extends TriangulatedWarpedMap
? TriangulatedWarpedMapOptions
: W extends WarpedMap
? WarpedMapOptions
: neverIntArrayRenderOptions
Type
object & SpecificWarpedMapListOptions & Partial<WebGL2WarpedMapOptions>ProjectionOptions
Fields
projection({id?: string; name?: string; definition: ProjectionDefinition})
SelectionOptions
Fields
geoBbox?([number, number, number, number])geoPoint?([number, number])mapIds?(Iterable<string>)onlyVisible?(boolean)
SpecificBaseRenderOptions
Type
objectSpecificTriangulatedWarpedMapOptions
Fields
distortionMeasures(Array<DistortionMeasure>)resourceResolution?(number)
SpecificWarpedMapListOptions
Fields
animatedOptions(Array<string>)createRTree(boolean)rtreeUpdatedOptions(Array<string>)
Sprite
Fields
height(number)imageId(string)scaleFactor(number)spriteTileScale?(number)width(number)x(number)y(number)
SpritesInfo
Fields
imageSize([number, number])imageUrl(string)sprites(Array<Sprite>)
TransformationOptions
Fields
options?(unknown)type(| 'straight' | 'helmert' | 'polynomial' | 'polynomial1' | 'polynomial2' | 'polynomial3' | 'thinPlateSpline' | 'projective' | 'linear')
new TriangulatedWarpedMap(mapId, georeferencedMap, listOptions, mapOptions)
Creates an instance of a TriangulatedWarpedMap.
Parameters
mapId(string)- ID of the map
georeferencedMap({ type: "GeoreferencedMap"; resource: { type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; id: string; height?: number | undefined; width?: number | undefined; partOf?: ({ type: string; id: string; label?: Record<string, (string | number | boolean)[]> | undefined; } & { partOf?: ({ type: string; i...)- Georeferenced map used to construct the WarpedMap
listOptions?(Partial<WarpedMapListOptions> | undefined)mapOptions?(Partial<WarpedMapOptions> | undefined)
Returns
TriangulatedWarpedMap.
Extends
WarpedMap
TriangulatedWarpedMap#clearProjectedTransformerCaches()
Parameters
There are no parameters.
Returns
void.
TriangulatedWarpedMap#clearProjectedTriangulationCaches()
Parameters
There are no parameters.
Returns
void.
TriangulatedWarpedMap#clearResourceTriangulationCaches()
Parameters
There are no parameters.
Returns
void.
TriangulatedWarpedMap#defaultOptions
Type
SpecificTriangulatedWarpedMapOptions & WarpedMapOptionsTriangulatedWarpedMap#georeferencedMapOptions
Type
{ resourceResolution?: number | undefined; distortionMeasures?: Array<DistortionMeasure> | undefined; fetchFn?: FetchFn | undefined; gcps?: Array<Gcp> | undefined; resourceMask?: Ring | undefined; ... 5 more ...; distortionMeasure?: DistortionMeasure | undefined; }TriangulatedWarpedMap#listOptions
Type
{ resourceResolution?: number | undefined; distortionMeasures?: Array<DistortionMeasure> | undefined; fetchFn?: FetchFn | undefined; gcps?: Array<Gcp> | undefined; resourceMask?: Ring | undefined; ... 5 more ...; distortionMeasure?: DistortionMeasure | undefined; }TriangulatedWarpedMap#mapOptions
Type
{ resourceResolution?: number | undefined; distortionMeasures?: Array<DistortionMeasure> | undefined; fetchFn?: FetchFn | undefined; gcps?: Array<Gcp> | undefined; resourceMask?: Ring | undefined; ... 5 more ...; distortionMeasure?: DistortionMeasure | undefined; }TriangulatedWarpedMap#mixPreviousAndNew(t)
Mix previous transform properties with new ones (when changing an ongoing animation).
Parameters
t(number)- animation progress
Returns
void.
TriangulatedWarpedMap#options
Type
SpecificTriangulatedWarpedMapOptions & WarpedMapOptionsTriangulatedWarpedMap#previousResourceResolution
Type
number | undefinedTriangulatedWarpedMap#previousTrianglePointsDistortion
Type
Array<never>TriangulatedWarpedMap#projectedGcpPreviousTriangulation?
Type
{
resourceResolution: number | undefined
gcpUniquePoints: GcpAndDistortions[]
uniquePointIndices: number[]
uniquePointIndexInterpolatedPolygon: TypedPolygon<number>
}TriangulatedWarpedMap#projectedGcpTriangulation?
Type
{
resourceResolution: number | undefined
gcpUniquePoints: GcpAndDistortions[]
uniquePointIndices: number[]
uniquePointIndexInterpolatedPolygon: TypedPolygon<number>
}TriangulatedWarpedMap#projectedGcpTriangulationCache
Type
Map<
number,
Map<string, Map<TransformationType, Map<string, GcpTriangulation>>>
>TriangulatedWarpedMap#projectedGeoPreviousTrianglePoints
Type
Array<never>TriangulatedWarpedMap#projectedGeoPreviousTriangulationAppliableMask
Type
Array<never>TriangulatedWarpedMap#projectedGeoPreviousTriangulationMask
Type
Array<never>TriangulatedWarpedMap#projectedGeoTrianglePoints
Type
Array<never>TriangulatedWarpedMap#projectedGeoTriangulationAppliableMask
Type
Array<never>TriangulatedWarpedMap#projectedGeoTriangulationMask
Type
Array<never>TriangulatedWarpedMap#resetPrevious()
Reset previous transform properties to new ones (when completing an animation).
Parameters
There are no parameters.
Returns
void.
TriangulatedWarpedMap#resourceResolution
Type
number | undefinedTriangulatedWarpedMap#resourceTrianglePoints
Type
Array<never>TriangulatedWarpedMap#resourceTriangulationCache
Type
Map<number, Map<string, TriangulationToUnique>>TriangulatedWarpedMap#setDefaultOptions()
Set default options
Parameters
There are no parameters.
Returns
void.
TriangulatedWarpedMap#setDistortionMeasure(distortionMeasure)
Set the distortionMeasure
Parameters
distortionMeasure?(DistortionMeasure | undefined)- the disortion measure
Returns
void.
TriangulatedWarpedMap#setGcps(gcps)
Update the ground control points loaded from a georeferenced map to new ground control points.
Parameters
gcps(Array<Gcp>)- the new ground control points
Returns
void.
TriangulatedWarpedMap#setInternalProjection(projection)
Set the internal projection
Parameters
projection({id?: string; name?: string; definition: ProjectionDefinition})- the internal projection
Returns
void.
TriangulatedWarpedMap#setProjection(projection)
Set the projection
Parameters
projection({id?: string; name?: string; definition: ProjectionDefinition})- the projection
Returns
void.
TriangulatedWarpedMap#setResourceMask(resourceFullMask, resourceAppliableMask, resourceMask)
Update the resource mask loaded from a georeferenced map to a new mask.
Parameters
resourceFullMask(Array<Point>)resourceAppliableMask(Array<Point>)resourceMask(Array<Point>)- the new mask
Returns
void.
TriangulatedWarpedMap#trianglePointsDistortion
Type
Array<never>TriangulatedWarpedMap#triangulateErrorCount
Type
0TriangulatedWarpedMap#updateProjectedTransformerProperties()
Parameters
There are no parameters.
Returns
void.
TriangulatedWarpedMap#updateTrianglePoints()
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.
TriangulatedWarpedMap#updateTrianglePointsDistortion()
Derive the (previous and new) distortions from their corresponding triangulations.
Parameters
There are no parameters.
Returns
void.
TriangulatedWarpedMap#updateTriangulation()
Update the (previous and new) triangulation of the resourceMask. Use cache if available.
Parameters
There are no parameters.
Returns
void.
TriangulatedWarpedMap.getDefaultOptions()
Get default options
Parameters
There are no parameters.
Returns
SpecificTriangulatedWarpedMapOptions & WarpedMapOptions.
TriangulatedWarpedMapOptions
Type
SpecificTriangulatedWarpedMapOptions & WarpedMapOptionsnew Viewport(viewportSize, projectedGeoCenter, projectedGeoPerViewportScale, partialViewportOptions)
Creates a new Viewport
Parameters
viewportSize([number, number])- Size of the viewport in viewport pixels, as [width, height].
projectedGeoCenter([number, number])- Center point of the viewport, in projected geospatial coordinates.
projectedGeoPerViewportScale(number)- Scale of the viewport, in projection coordinates per viewport pixel.
partialViewportOptions?(Partial<ViewportOptions> | undefined)
Returns
Viewport.
Viewport#canvasBbox
Type
[number, number, number, number]Viewport#canvasCenter
Type
[number, number]Viewport#canvasRectangle
Type
[Point, Point, Point, Point]Viewport#canvasResolution
Type
numberViewport#canvasSize
Type
[number, number]Viewport#composeProjectedGeoToCanvasHomogeneousTransform()
Parameters
There are no parameters.
Returns
[number, number, number, number, number, number].
Viewport#composeProjectedGeoToClipHomogeneousTransform()
Parameters
There are no parameters.
Returns
[number, number, number, number, number, number].
Viewport#composeProjectedGeoToViewportHomogeneousTransform()
Parameters
There are no parameters.
Returns
[number, number, number, number, number, number].
Viewport#composeViewportToClipHomogeneousTransform()
Parameters
There are no parameters.
Returns
[number, number, number, number, number, number].
Viewport#computeProjectedGeoRectangle(viewportSize, projectedGeoPerViewportScale, rotation, projectedGeoCenter)
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].
Viewport#devicePixelRatio
Type
numberViewport#geoCenter
Type
[number, number]Viewport#geoRectangle
Type
[Point, Point, Point, Point]Viewport#geoRectangleBbox
Type
[number, number, number, number]Viewport#geoResolution
Type
numberViewport#geoSize
Type
[number, number]Viewport#getGeoBufferedRectangle(bufferFraction)
Parameters
bufferFraction?(number | undefined)
Returns
[Point, Point, Point, Point].
Viewport#getProjectedGeoBufferedRectangle(bufferFraction)
Parameters
bufferFraction?(number | undefined)
Returns
[Point, Point, Point, Point].
Viewport#projectedGeoCenter
Type
[number, number]Viewport#projectedGeoPerCanvasScale
Type
numberViewport#projectedGeoPerViewportScale
Type
numberViewport#projectedGeoRectangle
Type
[Point, Point, Point, Point]Viewport#projectedGeoRectangleBbox
Type
[number, number, number, number]Viewport#projectedGeoResolution
Type
numberViewport#projectedGeoSize
Type
[number, number]Viewport#projectedGeoToCanvasHomogeneousTransform
Type
[number, number, number, number, number, number]Viewport#projectedGeoToClipHomogeneousTransform
Type
[number, number, number, number, number, number]Viewport#projectedGeoToViewportHomogeneousTransform
Type
[number, number, number, number, number, number]Viewport#projection
Type
{id?: string; name?: string; definition: ProjectionDefinition}Viewport#rotation
Type
numberViewport#viewportBbox
Type
[number, number, number, number]Viewport#viewportCenter
Type
[number, number]Viewport#viewportRectangle
Type
[Point, Point, Point, Point]Viewport#viewportResolution
Type
numberViewport#viewportSize
Type
[number, number]Viewport#viewportToClipHomogeneousTransform
Type
[number, number, number, number, number, number]Viewport.fromScaleAndGeoPolygon(projectedGeoPerViewportScale, geoPolygon, partialExtendedViewportOptions)
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)- Scale of the viewport, in projected geospatial coordinates per viewport pixel.
geoPolygon(Array<Array<Point>>)- A polygon in geospatial coordinates.
partialExtendedViewportOptions?(| Partial< {rotation: number; devicePixelRatio: number} & ProjectionOptions & ZoomOptions > | undefined)
Returns
A new Viewport object (Viewport).
Viewport.fromScaleAndMaps(projectedGeoPerViewportScale, warpedMapList, partialExtendedViewportOptions)
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)- Scale of the viewport, in projected geospatial coordinates per viewport pixel.
warpedMapList(WarpedMapList<W>)- A WarpedMapList.
partialExtendedViewportOptions?(| Partial< {rotation: number; devicePixelRatio: number} & ProjectionOptions & ZoomOptions & SelectionOptions > | undefined)- Optional viewport options.
Returns
A new Viewport object (Viewport).
Viewport.fromScaleAndProjectedGeoPolygon(projectedGeoPerViewportScale, projectedGeoPolygon, partialExtendedViewportOptions)
Static method that creates a Viewport from a scale and a polygon in projected geospatial coordinates.
Parameters
projectedGeoPerViewportScale(number)- Scale of the viewport, in projected geospatial coordinates per viewport pixel.
projectedGeoPolygon(Array<Array<Point>>)- A polygon in projected geospatial coordinates.
partialExtendedViewportOptions?(| Partial< {rotation: number; devicePixelRatio: number} & ProjectionOptions & ZoomOptions > | undefined)
Returns
A new Viewport object (Viewport).
Viewport.fromSizeAndGeoPolygon(viewportSize, geoPolygon, partialExtendedViewportOptions)
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])- Size of the viewport in viewport pixels, as [width, height].
geoPolygon(Array<Array<Point>>)- A polygon in geospatial coordinates.
partialExtendedViewportOptions?(| Partial< {rotation: number; devicePixelRatio: number} & ProjectionOptions & ZoomOptions & FitOptions > | undefined)- Optional viewport options
Returns
A new Viewport object (Viewport).
Viewport.fromSizeAndMaps(viewportSize, warpedMapList, partialExtendedViewportOptions)
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])- Size of the viewport in viewport pixels, as [width, height].
warpedMapList(WarpedMapList<W>)- A WarpedMapList.
partialExtendedViewportOptions?(| Partial< {rotation: number; devicePixelRatio: number} & ProjectionOptions & ZoomOptions & FitOptions & SelectionOptions > | undefined)- Optional viewport options
Returns
A new Viewport object (Viewport).
Viewport.fromSizeAndProjectedGeoPolygon(viewportSize, projectedGeoPolygon, partialExtendedViewportOptions)
Static method that creates a Viewport from a size and a polygon in projected geospatial coordinates.
Parameters
viewportSize([number, number])- Size of the viewport in viewport pixels, as [width, height].
projectedGeoPolygon(Array<Array<Point>>)- A polygon in projected geospatial coordinates.
partialExtendedViewportOptions?(| Partial< {rotation: number; devicePixelRatio: number} & ProjectionOptions & ZoomOptions & FitOptions > | undefined)- Optional viewport options
Returns
A new Viewport object (Viewport).
new WarpedMap(mapId, georeferencedMap, listOptions, mapOptions)
Creates an instance of WarpedMap.
Parameters
mapId(string)- ID of the map
georeferencedMap({ type: "GeoreferencedMap"; resource: { type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; id: string; height?: number | undefined; width?: number | undefined; partOf?: ({ type: string; id: string; label?: Record<string, (string | number | boolean)[]> | undefined; } & { partOf?: ({ type: string; i...)- Georeferenced map used to construct the WarpedMap
listOptions(Partial<WarpedMapListOptions> | undefined)mapOptions(Partial<WarpedMapOptions> | undefined)
Returns
WarpedMap.
Extends
EventTarget
WarpedMap#abortController?
Type
AbortControllerWarpedMap#applyOptions(animationOptions)
Parameters
animationOptions?(Partial<AnimationOptions & AnimationOptionsInternal> | undefined)
Returns
object.
WarpedMap#clearProjectedTransformerCaches()
Parameters
There are no parameters.
Returns
void.
WarpedMap#defaultOptions
Type
{
fetchFn?: FetchFn
gcps: Gcp[]
resourceMask: Ring
transformationType: TransformationType
internalProjection: Projection
projection: Projection
visible: boolean
applyMask: boolean
distortionMeasure: DistortionMeasure | undefined
}WarpedMap#destroy()
Parameters
There are no parameters.
Returns
void.
WarpedMap#distortionMeasure?
Type
'log2sigma' | 'twoOmega' | 'airyKavr' | 'signDetJ' | 'thetaa'WarpedMap#fetchableTilesForViewport
Type
Array<never>WarpedMap#fetchingImageInfo
Type
booleanWarpedMap#gcps
Type
Array<Gcp>WarpedMap#geoAppliableMask
Type
Array<Point>WarpedMap#geoAppliableMaskBbox
Type
[number, number, number, number]WarpedMap#geoAppliableMaskRectangle
Type
[Point, Point, Point, Point]WarpedMap#geoFullMask
Type
Array<Point>WarpedMap#geoFullMaskBbox
Type
[number, number, number, number]WarpedMap#geoFullMaskRectangle
Type
[Point, Point, Point, Point]WarpedMap#geoMask
Type
Array<Point>WarpedMap#geoMaskBbox
Type
[number, number, number, number]WarpedMap#geoMaskRectangle
Type
[Point, Point, Point, Point]WarpedMap#geoPoints
Type
Array<Point>WarpedMap#georeferencedMap
Type
{ type: "GeoreferencedMap"; resource: { type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; id: string; height?: number | undefined; width?: number | undefined; partOf?: ({ type: string; id: string; label?: Record<string, (string | number | boolean)[]> | undefined; } & { partOf?: ({ type: string; i...WarpedMap#georeferencedMapOptions
Type
{ fetchFn?: FetchFn | undefined; gcps?: Array<Gcp> | undefined; resourceMask?: Ring | undefined; transformationType?: TransformationType | undefined; ... 4 more ...; distortionMeasure?: DistortionMeasure | undefined; }WarpedMap#getDefaultAndGeoreferencedMapOptions()
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
}.
WarpedMap#getProjectedTransformer(transformationType, partialProjectedGcpTransformerOptions)
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<ProjectedGcpTransformerOptions> | undefined)
Returns
A projected transformer (ProjectedGcpTransformer).
WarpedMap#getReferenceScale()
Get the reference scaling from the forward transformation of the projected Helmert transformer
Parameters
There are no parameters.
Returns
number.
WarpedMap#getResourceFullMask()
Parameters
There are no parameters.
Returns
[Point, Point, Point, Point].
WarpedMap#getResourceToCanvasScale(viewport)
Get scale of the warped map, in resource pixels per canvas pixels.
Parameters
viewport(Viewport)- the current viewport
Returns
number.
WarpedMap#getResourceToViewportScale(viewport)
Get scale of the warped map, in resource pixels per viewport pixels.
Parameters
viewport(Viewport)- the current viewport
Returns
number.
WarpedMap#hasImage()
Check if this instance has parsed image
Parameters
There are no parameters.
Returns
boolean.
WarpedMap#image?
Type
ImageWarpedMap#internalProjection
Type
{id?: string; name?: string; definition: ProjectionDefinition}WarpedMap#listOptions
Type
{ createRTree?: boolean | undefined; rtreeUpdatedOptions?: Array<string> | undefined; animatedOptions?: Array<string> | undefined; renderMaps?: boolean | undefined; renderLines?: boolean | undefined; renderPoints?: boolean | undefined; ... 58 more ...; distortionMeasure?: DistortionMeasure | undefined; }WarpedMap#loadImage(imagesById)
Load the parsed image from cache, or fetch and parse the image info to create it
Parameters
imagesById?(Map<string, Image> | undefined)
Returns
Promise<void>.
WarpedMap#mapId
Type
stringWarpedMap#mapOptions
Type
{ fetchFn?: FetchFn | undefined; gcps?: Array<Gcp> | undefined; resourceMask?: Ring | undefined; transformationType?: TransformationType | undefined; ... 4 more ...; distortionMeasure?: DistortionMeasure | undefined; }WarpedMap#mixPreviousAndNew(t)
Mix previous transform properties with new ones (when changing an ongoing animation).
Parameters
t(number)- animation progress
Returns
void.
WarpedMap#mixed
Type
falseWarpedMap#options
Type
{
fetchFn?: FetchFn
gcps: Gcp[]
resourceMask: Ring
transformationType: TransformationType
internalProjection: Projection
projection: Projection
visible: boolean
applyMask: boolean
distortionMeasure: DistortionMeasure | undefined
}WarpedMap#overviewFetchableTilesForViewport
Type
Array<never>WarpedMap#overviewTileZoomLevelForViewport?
Type
{
scaleFactor: number
width: number
height: number
originalWidth: number
originalHeight: number
columns: number
rows: number
}WarpedMap#previousDistortionMeasure?
Type
'log2sigma' | 'twoOmega' | 'airyKavr' | 'signDetJ' | 'thetaa'WarpedMap#previousInternalProjection
Type
{id?: string; name?: string; definition: ProjectionDefinition}WarpedMap#previousTransformationType
Type
| 'straight'
| 'helmert'
| 'polynomial'
| 'polynomial1'
| 'polynomial2'
| 'polynomial3'
| 'thinPlateSpline'
| 'projective'
| 'linear'WarpedMap#projectedGcps
Type
Array<Gcp>WarpedMap#projectedGeoAppliableMask
Type
Array<Point>WarpedMap#projectedGeoAppliableMaskBbox
Type
[number, number, number, number]WarpedMap#projectedGeoAppliableMaskRectangle
Type
[Point, Point, Point, Point]WarpedMap#projectedGeoBufferedViewportRectangleBboxForViewport?
Type
[number, number, number, number]WarpedMap#projectedGeoBufferedViewportRectangleForViewport?
Type
[Point, Point, Point, Point]WarpedMap#projectedGeoFullMask
Type
Array<Point>WarpedMap#projectedGeoFullMaskBbox
Type
[number, number, number, number]WarpedMap#projectedGeoFullMaskRectangle
Type
[Point, Point, Point, Point]WarpedMap#projectedGeoMask
Type
Array<Point>WarpedMap#projectedGeoMaskBbox
Type
[number, number, number, number]WarpedMap#projectedGeoMaskRectangle
Type
[Point, Point, Point, Point]WarpedMap#projectedGeoPoints
Type
Array<Point>WarpedMap#projectedGeoPreviousTransformedResourcePoints
Type
Array<Point>WarpedMap#projectedGeoTransformedResourcePoints
Type
Array<Point>WarpedMap#projectedPreviousTransformer
Type
ProjectedGcpTransformerWarpedMap#projectedTransformer
Type
ProjectedGcpTransformerWarpedMap#projectedTransformerCache
Type
Map<TransformationType, ProjectedGcpTransformer>WarpedMap#projectedTransformerDoubleCache
Type
Map<TransformationType, Map<string, ProjectedGcpTransformer>>WarpedMap#projection
Type
{id?: string; name?: string; definition: ProjectionDefinition}WarpedMap#resetForViewport()
Reset the properties for the current values
Parameters
There are no parameters.
Returns
void.
WarpedMap#resetPrevious()
Reset previous transform properties to new ones (when completing an animation).
Parameters
There are no parameters.
Returns
void.
WarpedMap#resourceAppliableMask
Type
Array<Point>WarpedMap#resourceAppliableMaskBbox
Type
[number, number, number, number]WarpedMap#resourceAppliableMaskRectangle
Type
[Point, Point, Point, Point]WarpedMap#resourceBufferedViewportRingBboxAndResourceMaskBboxIntersectionForViewport?
Type
[number, number, number, number]WarpedMap#resourceBufferedViewportRingBboxForViewport?
Type
[number, number, number, number]WarpedMap#resourceBufferedViewportRingForViewport?
Type
Array<Point>WarpedMap#resourceFullMask
Type
Array<Point>WarpedMap#resourceFullMaskBbox
Type
[number, number, number, number]WarpedMap#resourceFullMaskRectangle
Type
[Point, Point, Point, Point]WarpedMap#resourceMask
Type
Array<Point>WarpedMap#resourceMaskBbox
Type
[number, number, number, number]WarpedMap#resourceMaskRectangle
Type
[Point, Point, Point, Point]WarpedMap#resourcePoints
Type
Array<Point>WarpedMap#resourceToProjectedGeoScale
Type
numberWarpedMap#setDefaultOptions()
Parameters
There are no parameters.
Returns
void.
WarpedMap#setDistortionMeasure(distortionMeasure)
Set the distortionMeasure
Parameters
distortionMeasure?(DistortionMeasure | undefined)- the disortion measure
Returns
void.
WarpedMap#setFetchableTilesForViewport(fetchableTiles)
Set tiles for the current viewport
Parameters
fetchableTiles(Array<FetchableTile>)
Returns
void.
WarpedMap#setGcps(gcps)
Update the ground control points loaded from a georeferenced map to new ground control points.
Parameters
gcps(Array<Gcp>)
Returns
void.
WarpedMap#setInternalProjection(projection)
Set the internal projection
Parameters
projection?(Projection | undefined)- the internal projection
Returns
void.
WarpedMap#setListOptions(listOptions, animationOptions)
Parameters
listOptions?(Partial<WarpedMapOptions> | undefined)animationOptions?(Partial<AnimationOptions> | undefined)
Returns
object.
WarpedMap#setMapOptions(mapOptions, listOptions, animationOptions)
Parameters
mapOptions?(Partial<WarpedMapOptions> | undefined)listOptions?(Partial<WarpedMapOptions> | undefined)animationOptions?(Partial<AnimationOptions & AnimationOptionsInternal> | undefined)
Returns
object.
WarpedMap#setOverviewFetchableTilesForViewport(overviewFetchableTiles)
Set overview tiles for the current viewport
Parameters
overviewFetchableTiles(Array<FetchableTile>)
Returns
void.
WarpedMap#setOverviewTileZoomLevelForViewport(tileZoomLevel)
Set the overview tile zoom level for the current viewport
Parameters
tileZoomLevel?(TileZoomLevel | undefined)- tile zoom level for the current viewport
Returns
void.
WarpedMap#setProjectedGeoBufferedViewportRectangleForViewport(projectedGeoBufferedViewportRectangle)
Set projectedGeoBufferedViewportRectangle for the current viewport
Parameters
projectedGeoBufferedViewportRectangle?(Rectangle | undefined)
Returns
void.
WarpedMap#setProjection(projection)
Set the projection
Parameters
projection?(Projection | undefined)- the projection
Returns
void.
WarpedMap#setResourceBufferedViewportRingBboxAndResourceMaskBboxIntersectionForViewport(resourceBufferedViewportRingBboxAndResourceMaskBboxIntersection)
Set resourceBufferedViewportRingBboxAndResourceMaskBboxIntersection for the current viewport
Parameters
resourceBufferedViewportRingBboxAndResourceMaskBboxIntersection?(Bbox | undefined)
Returns
void.
WarpedMap#setResourceBufferedViewportRingForViewport(resourceBufferedViewportRing)
Set resourceBufferedViewportRing for the current viewport
Parameters
resourceBufferedViewportRing?(Ring | undefined)
Returns
void.
WarpedMap#setResourceMask(resourceFullMask, resourceAppliableMask, resourceMask)
Update the resource mask loaded from a georeferenced map to a new mask.
Parameters
resourceFullMask(Array<Point>)resourceAppliableMask(Array<Point>)resourceMask(Array<Point>)
Returns
void.
WarpedMap#setTileZoomLevelForViewport(tileZoomLevel)
Set the tile zoom level for the current viewport
Parameters
tileZoomLevel?(TileZoomLevel | undefined)- tile zoom level for the current viewport
Returns
void.
WarpedMap#setTransformationType(transformationType)
Set the transformationType
Parameters
transformationType(| 'straight' | 'helmert' | 'polynomial' | 'polynomial1' | 'polynomial2' | 'polynomial3' | 'thinPlateSpline' | 'projective' | 'linear')
Returns
void.
WarpedMap#shouldRenderLines()
Parameters
There are no parameters.
Returns
boolean.
WarpedMap#shouldRenderMap()
Parameters
There are no parameters.
Returns
boolean.
WarpedMap#shouldRenderPoints()
Parameters
There are no parameters.
Returns
boolean.
WarpedMap#tileSize?
Type
[number, number]WarpedMap#tileZoomLevelForViewport?
Type
{
scaleFactor: number
width: number
height: number
originalWidth: number
originalHeight: number
columns: number
rows: number
}WarpedMap#transformationType
Type
| 'straight'
| 'helmert'
| 'polynomial'
| 'polynomial1'
| 'polynomial2'
| 'polynomial3'
| 'thinPlateSpline'
| 'projective'
| 'linear'WarpedMap#updateAppliableGeoMask()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateFullGeoMask()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateGcpsProperties()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateGeoMask()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateGeoMaskProperties()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateProjectedAppliableGeoMask()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateProjectedFullGeoMask()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateProjectedGeoMask()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateProjectedGeoMaskProperties()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateProjectedTransformer()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateProjectedTransformerProperties()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateResourceMaskProperties()
Parameters
There are no parameters.
Returns
void.
WarpedMap#updateResourceToProjectedGeoScale()
Parameters
There are no parameters.
Returns
void.
WarpedMap.getDefaultOptions()
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
}.
new WarpedMapEvent(type, data)
Parameters
type(WarpedMapEventType)data?(Partial<WarpedMapEventData> | undefined)
Returns
WarpedMapEvent.
Extends
Event
WarpedMapEvent#data?
Type
{
mapIds?: Array<string> | undefined
tileUrl?: string | undefined
optionKeys?: Array<string> | undefined
spritesInfo?: SpritesInfo | undefined
}new WarpedMapList(warpedMapFactory, options)
Creates an instance of a WarpedMapList
Parameters
warpedMapFactory(( mapId: string, georeferencedMap: GeoreferencedMap, listOptions?: Partial<WarpedMapListOptions>, mapOptions?: Partial<WarpedMapOptions> ) => W)- Factory function for creating WarpedMap objects
options?(Partial<WarpedMapListOptions> | undefined)- Options of this list, which will be set on newly added maps as their list options
Returns
WarpedMapList<W>.
Extends
EventTarget
WarpedMapList#addEventListenersToWarpedMap(warpedMap)
Parameters
warpedMap(W)
Returns
void.
WarpedMapList#addGeoreferenceAnnotation(annotation, mapOptions)
Parses an annotation and adds its georeferenced map to this list
Parameters
annotation(unknown)- Annotation
mapOptions?(Partial<GetWarpedMapOptions<W>> | undefined)- Map options
Returns
Map IDs of the maps that were added, or an error per map (Promise<Array<string | Error>>).
WarpedMapList#addGeoreferencedMap(georeferencedMap, mapOptions)
Adds a georeferenced map to this list
Parameters
georeferencedMap(unknown)- Georeferenced Map
mapOptions?(Partial<GetWarpedMapOptions<W>> | undefined)- Map options
Returns
Map ID of the map that was added (Promise<string>).
WarpedMapList#addGeoreferencedMapInternal(georeferencedMap, mapOptions)
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<string, (string | number | boolean)[]> | undefined; } & { partOf?: ({ type: string; i...)mapOptions?(Partial<GetWarpedMapOptions<W>> | undefined)
Returns
Promise<string>.
WarpedMapList#addImageInfos(imageInfos)
Adds image informations, parses them to images and adds them to the image cache
Parameters
imageInfos(Array<unknown>)- Image informations
Returns
Image IDs of the image informations that were added (Array<string>).
WarpedMapList#addToOrUpdateRtree(warpedMap)
Parameters
warpedMap(W)
Returns
void.
WarpedMapList#bringMapsForward(mapIds)
Changes the z-index of the specified maps to bring them forward
Parameters
mapIds(Iterable<string>)- Map IDs
Returns
void.
WarpedMapList#bringMapsToFront(mapIds)
Changes the z-index of the specified maps to bring them to front
Parameters
mapIds(Iterable<string>)- Map IDs
Returns
void.
WarpedMapList#clear()
Parameters
There are no parameters.
Returns
void.
WarpedMapList#destroy()
Parameters
There are no parameters.
Returns
void.
WarpedMapList#getDefaultOptions()
Get the default options of the list
Parameters
There are no parameters.
Returns
SpecificWarpedMapListOptions &
Partial<WebGL2WarpedMapOptions> &
GetWarpedMapOptions<W>.
WarpedMapList#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
GetWarpedMapOptions<W> | undefined.
WarpedMapList#getMapIds(partialSelectionOptions)
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<SelectionOptions> | undefined)- Selection options (e.g. mapIds), defaults to all visible maps
Returns
mapIds (Array<string>).
WarpedMapList#getMapMapOptions(mapId)
Get the map-specific options of a map
Parameters
mapId(string)- Map ID for which the options apply
Returns
Partial<GetWarpedMapOptions<W>> | undefined.
WarpedMapList#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
GetWarpedMapOptions<W> | undefined.
WarpedMapList#getMapZIndex(mapId)
Get the z-index of a map
Parameters
mapId(string)- Map ID for which to get the z-index
Returns
number | undefined.
WarpedMapList#getMapsBbox(partialSelectionAndProjectionOptions)
Get the bounding box of the maps in this list
The result is returned in the list's projection, EPSG:3857 by default
Use {projection: {definition: 'EPSG:4326'}} to request the result in lon-lat EPSG:4326
Parameters
partialSelectionAndProjectionOptions?(Partial<SelectionOptions & ProjectionOptions> | undefined)- 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).
WarpedMapList#getMapsCenter(partialSelectionAndProjectionOptions)
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 default
Use {projection: {definition: 'EPSG:4326'}} to request the result in lon-lat EPSG:4326
Parameters
partialSelectionAndProjectionOptions?(Partial<SelectionOptions & ProjectionOptions> | undefined)- 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).
WarpedMapList#getMapsConvexHull(partialSelectionAndProjectionOptions)
Get the convex hull of the maps in this list
The result is returned in the list's projection, EPSG:3857 by default
Use {projection: {definition: 'EPSG:4326'}} to request the result in lon-lat EPSG:4326
Parameters
partialSelectionAndProjectionOptions?(Partial<SelectionOptions & ProjectionOptions> | undefined)- 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).
WarpedMapList#getOptions()
Get the options of this list
Parameters
There are no parameters.
Returns
{ createRTree?: boolean | undefined; rtreeUpdatedOptions?: Array<string> | undefined; animatedOptions?: Array<string> | undefined; renderMaps?: boolean | undefined; renderLines?: boolean | undefined; renderPoints?: boolean | undefined; ... 58 more ...; distortionMeasure?: DistortionMeasure | undefined; }.
WarpedMapList#getOrComputeMapId(georeferencedMap)
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<string, (string | number | boolean)[]> | undefined; } & { partOf?: ({ type: string; i...)
Returns
Promise<string>.
WarpedMapList#getProjectedGeoMaskPoints(partialSelectionAndProjectionOptions)
Parameters
partialSelectionAndProjectionOptions?(Partial<SelectionOptions & ProjectionOptions> | undefined)
Returns
Array<Point>.
WarpedMapList#getWarpedMap(mapId)
Get the WarpedMap instance for a map
Parameters
mapId(string)- Map ID of the requested WarpedMap instance
Returns
WarpedMap instance, or undefined (W | undefined).
WarpedMapList#getWarpedMaps(partialSelectionOptions)
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<SelectionOptions> | undefined)- Selection options (e.g. mapIds), defaults to all visible maps
Returns
WarpedMap instances (Iterable<W>).
WarpedMapList#imageLoaded(mapId)
Parameters
mapId(string)
Returns
void.
WarpedMapList#imagesById
Type
Map<string, Image>WarpedMapList#internalSetMapsOptionsByMapId(mapOptionsByMapId, listOptions, animationOptions)
Internal set map options
Parameters
mapOptionsByMapId?(Map<string, Partial<WarpedMapListOptions> | undefined> | undefined)listOptions?(Partial<WarpedMapListOptions> | undefined)animationOptions?(Partial<AnimationOptions> | undefined)
Returns
void.
WarpedMapList#options
Type
SpecificWarpedMapListOptions & Partial<WebGL2WarpedMapOptions>WarpedMapList#orderMapIdsByZIndex(mapId0, mapId1)
Order mapIds
Use this as anonymous sort function in Array.prototype.sort()
Parameters
mapId0(string)mapId1(string)
Returns
number.
WarpedMapList#removeEventListenersFromWarpedMap(warpedMap)
Parameters
warpedMap(W)
Returns
void.
WarpedMapList#removeFromRtree(warpedMap)
Parameters
warpedMap(W)
Returns
void.
WarpedMapList#removeGeoreferenceAnnotation(annotation)
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<Array<string | Error>>).
WarpedMapList#removeGeoreferencedMap(georeferencedMap)
Removes a georeferenced map from this list
Parameters
georeferencedMap(unknown)
Returns
Map ID of the removed map, or an error (Promise<string | Error>).
WarpedMapList#removeGeoreferencedMapById(mapId)
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<string | Error | undefined>).
WarpedMapList#removeGeoreferencedMapByIdInternal(mapId)
Parameters
mapId(string)
Returns
Promise<string>.
WarpedMapList#removeGeoreferencedMapInternal(georeferencedMap)
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<string, (string | number | boolean)[]> | undefined; } & { partOf?: ({ type: string; i...)
Returns
Promise<string>.
WarpedMapList#removeZIndexHoles()
Parameters
There are no parameters.
Returns
void.
WarpedMapList#resetMapsOptions(mapIds, mapOptionKeys, listOptionKeys, animationOptions)
Resets the map-specific options of maps (and the list options)
An empty array resets all options, undefined resets no options.
Parameters
mapIds(Array<string>)- Map IDs for which to reset the options
mapOptionKeys?(Array<string> | undefined)- Keys of the map-specific options to reset
listOptionKeys?(Array<string> | undefined)- Keys of the list options to reset
animationOptions?(Partial<AnimationOptions> | undefined)- Animation options
Returns
void.
WarpedMapList#resetMapsOptionsByMapId(mapOptionkeysByMapId, listOptionKeys, animationOptions)
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<string, Array<string>> | undefined)- Keys of map-specific options to reset by map ID
listOptionKeys?(Array<string> | undefined)- Keys of the list options to reset
animationOptions?(Partial<AnimationOptions> | undefined)- Animation options
Returns
void.
WarpedMapList#resetOptions(listOptionKeys, animationOptions)
Resets the list options
An empty array resets all options, undefined resets no options.
Parameters
listOptionKeys?(Array<string> | undefined)- Keys of the list options to reset
animationOptions?(Partial<AnimationOptions> | undefined)- Animation options
Returns
void.
WarpedMapList#rtree?
Type
RTreeWarpedMapList#sendMapsBackward(mapIds)
Changes the zIndex of the specified maps to send them backward
Parameters
mapIds(Iterable<string>)- Map IDs
Returns
void.
WarpedMapList#sendMapsToBack(mapIds)
Changes the z-index of the specified maps to send them to back
Parameters
mapIds(Iterable<string>)- Map IDs
Returns
void.
WarpedMapList#setMapsOptions(mapIds, mapOptions, listOptions, animationOptions)
Set the map-specific options of maps (and the list options)
Parameters
mapIds(Array<string>)- Map IDs for which the options apply
mapOptions?(Partial<WarpedMapListOptions> | undefined)- Map-specific options
listOptions?(Partial<WarpedMapListOptions> | undefined)- list options
animationOptions?(Partial<AnimationOptions> | undefined)- Animation options
Returns
void.
WarpedMapList#setMapsOptionsByMapId(mapOptionsByMapId, listOptions, animationOptions)
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<string, Partial<WarpedMapListOptions>> | undefined)- Map-specific options by map ID
listOptions?(Partial<WarpedMapListOptions> | undefined)- List options
animationOptions?(Partial<AnimationOptions> | undefined)- Animation options
Returns
void.
WarpedMapList#setOptions(options, animationOptions)
Set the options of this list
Note: Map-specific options set here will be passed to newly added maps.
Parameters
options?(Partial<WarpedMapListOptions> | undefined)- List Options
animationOptions?(Partial<AnimationOptions> | undefined)- Animation options
Returns
void.
WarpedMapList#warpedMapFactory
Type
(
mapId: string,
georeferencedMap: GeoreferencedMap,
listOptions?: Partial<WarpedMapListOptions>,
mapOptions?: Partial<WarpedMapOptions>
) => WWarpedMapList#warpedMapsById
Maps in this list, indexed by their ID (Map<string, W>).
WarpedMapList#zIndices
Type
Map<string, number>WarpedMapListOptions
Type
SpecificWarpedMapListOptions & Partial<WebGL2WarpedMapOptions>WarpedMapOptions
Fields
applyMask(boolean)distortionMeasure(DistortionMeasure | undefined)fetchFn?(( input: Request | string | URL, init?: RequestInit ) => Promise<Response>)gcps(Array<Gcp>)internalProjection({id?: string; name?: string; definition: ProjectionDefinition})projection({id?: string; name?: string; definition: ProjectionDefinition})resourceMask(Array<Point>)transformationType(| 'straight' | 'helmert' | 'polynomial' | 'polynomial1' | 'polynomial2' | 'polynomial3' | 'thinPlateSpline' | 'projective' | 'linear')visible(boolean)
createWarpedMapFactory()
Parameters
There are no parameters.
Returns
(
mapId: string,
georeferencedMap: GeoreferencedMap,
listOptions?: Partial<WarpedMapListOptions>,
mapOptions?: Partial<WarpedMapOptions>
) => WarpedMap.
new IntArrayRenderer(getImageData, getImageDataValue, getImageDataSize, options)
Parameters
getImageData((data: Uint8ClampedArray) => D)- `getImag
