npm.io
1.0.0-beta.83 • Published 3 months ago

@allmaps/render

Licence
MIT
Version
1.0.0-beta.83
Deps
0
Vulns
0
Weekly
0
Stars
140

@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 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:

It is also used in the Allmaps Preview worker and Allmaps Tile Server proxy server, both of which use the WasmRenderer, a WASM implementation of the CanvasRenderer.

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 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.

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 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.

Installation

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

Install with pnpm:

pnpm install @allmaps/render

You can optionally build this package locally by running:

pnpm run build

The easiest way to test this package during local development is via @allmaps/test-plugins, since all of the plugins use the WebGL2Renderer to render a Georeference Annotation on screen.

Usage

Here's how each of the renderers can be used 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 (always 'WGS84' projection { description: 'EPSG:4326' } 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)
  • animatedOptions? (Array< | keyof SpecificWebGL2WarpedMapOptions | keyof SpecificTriangulatedWarpedMapOptions | keyof WarpedMapOptions >)
  • duration (number)
BaseRenderOptions
Type
SpecificBaseRenderOptions<W> & Partial<WarpedMapListOptions<W>>
CanvasRenderOptions
Type
SpecificBaseRenderOptions<WarpedMap> &
  Partial<WarpedMapListOptions<WarpedMap>>
GetWarpedMapOptions
Type
W extends WebGL2WarpedMap
  ? WebGL2WarpedMapOptions
  : W extends TriangulatedWarpedMap
    ? TriangulatedWarpedMapOptions
    : W extends WarpedMap
      ? WarpedMapOptions
      : never
IntArrayRenderOptions
Type
SpecificBaseRenderOptions<WarpedMap> &
  Partial<WarpedMapListOptions<WarpedMap>>
MaskOptions
Fields
  • applyMask (boolean)
ProjectionOptions
Fields
  • projection ({id?: string; name?: string; definition: ProjectionDefinition})
SelectionOptions
Type
MaskOptions & {
  onlyVisible?: boolean
  mapIds?: Iterable<string>
  geoPoint?: Point
  geoBbox?: Bbox
  projectedGeoPoint?: Point
  projectedGeoBbox?: Bbox
}
SpecificBaseRenderOptions
Fields
  • anticipateInteraction (boolean)
  • log2ScaleFactorCorrection (number)
  • maxGcpsExactTpsToResource (number)
  • maxTotalOverviewResolutionRatio (number)
  • overviewPruneViewportBufferRatio (number)
  • overviewRequestViewportBufferRatio (number)
  • pruneViewportBufferRatio (number)
  • requestViewportBufferRatio (number)
  • scaleFactorCorrection (number)
  • spritesMaxHigherLog2ScaleFactorDiff (number)
  • spritesMaxLowerLog2ScaleFactorDiff (number)
  • warpedMapList? (WarpedMapList<W>)
SpecificTriangulatedWarpedMapOptions
Fields
  • distortionMeasures (Array<DistortionMeasure>)
  • resourceResolution? (number)
SpecificWarpedMapListOptions
Fields
  • animatedOptions (Array< | keyof SpecificWebGL2WarpedMapOptions | keyof SpecificTriangulatedWarpedMapOptions | keyof WarpedMapOptions >)
  • createRTree (boolean)
  • projection ({id?: string; name?: string; definition: ProjectionDefinition})
  • rtreeUpdatedOptions (Array< | keyof SpecificWebGL2WarpedMapOptions | keyof SpecificTriangulatedWarpedMapOptions | keyof WarpedMapOptions >)
  • warpedMapFactory (( mapId: string, georeferencedMap: GeoreferencedMap, listOptions?: Partial<WarpedMapListOptions<W>> | undefined, mapOptions?: Partial<GetWarpedMapOptions<W>> | undefined ) => W)
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: { id: string; type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; height?: number | undefined; width?: number | undefined; partOf?: Array<PartOfItemType> | undefined; provider?: Array<{ ...; }> | undefined; }; ... 8 more ...; _allmaps?: unknown; })
    • Georeferenced map used to construct the WarpedMap
  • listOptions? (Partial<WarpedMapListOptions<TriangulatedWarpedMap>> | 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 & WarpedMapOptions
TriangulatedWarpedMap#georeferencedMapOptions
Type
{ resourceResolution?: number | undefined; distortionMeasures?: Array<DistortionMeasure> | undefined; fetchFn?: FetchFn | undefined; gcps?: Array<Gcp> | undefined; resourceMask?: Ring | undefined; ... 8 more ...; distortionMeasure?: DistortionMeasure | undefined; }
TriangulatedWarpedMap#listOptions
Type
{ resourceResolution?: number | undefined; distortionMeasures?: Array<DistortionMeasure> | undefined; fetchFn?: FetchFn | undefined; gcps?: Array<Gcp> | undefined; resourceMask?: Ring | undefined; ... 8 more ...; distortionMeasure?: DistortionMeasure | undefined; }
TriangulatedWarpedMap#mapOptions
Type
{ resourceResolution?: number | undefined; distortionMeasures?: Array<DistortionMeasure> | undefined; fetchFn?: FetchFn | undefined; gcps?: Array<Gcp> | undefined; resourceMask?: Ring | undefined; ... 8 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 & WarpedMapOptions
TriangulatedWarpedMap#previousResourceResolution
Type
number | undefined
TriangulatedWarpedMap#previousTrianglePointsDistortion
Type
Array<never>
TriangulatedWarpedMap#previousTrianglePointsInside
Type
Array<never>
TriangulatedWarpedMap#projectedGcpPreviousTriangulation?
Type
{
  resourceResolution: number | undefined
  gcpUniquePoints: GcpAndDistortions[]
  uniquePointIndices: number[]
  uniquePointIndexInterpolatedPolygon: TypedPolygon<number>
  uniquePointIndexInterpolatedSteinerPolygons: TypedPolygon<number>[]
  insideSteinerPolygonsTriangles: boolean[]
}
TriangulatedWarpedMap#projectedGcpTriangulation?
Type
{
  resourceResolution: number | undefined
  gcpUniquePoints: GcpAndDistortions[]
  uniquePointIndices: number[]
  uniquePointIndexInterpolatedPolygon: TypedPolygon<number>
  uniquePointIndexInterpolatedSteinerPolygons: TypedPolygon<number>[]
  insideSteinerPolygonsTriangles: boolean[]
}
TriangulatedWarpedMap#projectedGcpTriangulationCache
Type
Map<
  number,
  Map<
    string,
    Map<TransformationType, Map<string, Map<string, GcpTriangulation>>>
  >
>
TriangulatedWarpedMap#projectedGeoPreviousTrianglePoints
Type
Array<never>
TriangulatedWarpedMap#projectedGeoPreviousTriangulationAppliedMask
Type
Array<never>
TriangulatedWarpedMap#projectedGeoPreviousTriangulationFullMask
Type
Array<never>
TriangulatedWarpedMap#projectedGeoPreviousTriangulationMask
Type
Array<never>
TriangulatedWarpedMap#projectedGeoTrianglePoints
Type
Array<never>
TriangulatedWarpedMap#projectedGeoTriangulationAppliedMask
Type
Array<never>
TriangulatedWarpedMap#projectedGeoTriangulationFullMask
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 | undefined
TriangulatedWarpedMap#resourceTrianglePoints
Type
Array<never>
TriangulatedWarpedMap#resourceTriangulationCache
Type
Map<number, Map<string, TriangulationToUnique>>
TriangulatedWarpedMap#setDefaultOptions()

Set the defaultOptions

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#setListOptions(listOptions, animationOptions)

Set the list options

Parameters
  • listOptions? (Partial<TriangulatedWarpedMapOptions> | undefined)
    • list options
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

object.

TriangulatedWarpedMap#setMapAndListOptions(mapOptions, listOptions, animationOptions)

Set the map-specific options, and the list options

Parameters
  • mapOptions? (Partial<TriangulatedWarpedMapOptions> | undefined)
    • Map-specific options
  • listOptions? (Partial<TriangulatedWarpedMapOptions> | undefined)
    • list options
  • animationOptions? (Partial<AnimationOptions & AnimationInternalOptions> | undefined)
    • Animation options
Returns

object.

TriangulatedWarpedMap#setMapOptions(mapOptions, animationOptions)

Set the map-specific options

Parameters
  • mapOptions? (Partial<TriangulatedWarpedMapOptions> | undefined)
    • Map-specific options
  • animationOptions? (Partial<AnimationOptions & AnimationInternalOptions> | undefined)
    • Animation options
Returns

object.

TriangulatedWarpedMap#setProjection(projection)

Set the projection

Parameters
  • projection ({id?: string; name?: string; definition: ProjectionDefinition})
    • the projection
Returns

void.

TriangulatedWarpedMap#setResourceMask()

Update the resource mask loaded from a georeferenced map to a new mask.

Parameters

There are no parameters.

Returns

void.

TriangulatedWarpedMap#trianglePointsDistortion
Type
Array<never>
TriangulatedWarpedMap#trianglePointsInside
Type
Array<never>
TriangulatedWarpedMap#triangulateErrorCount
Type
0
TriangulatedWarpedMap#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.

TriangulatedWarpedMap.getDefaultWithoutGeoreferencedMapOptions()

Get default options without the options overwritten by the georeferenced map

Parameters

There are no parameters.

Returns

{ projection: Projection; applyMask: boolean; resourceResolution?: number | undefined; distortionMeasures: DistortionMeasure[]; fetchFn?: FetchFn | undefined; visible: boolean; anticipateVisibility: boolean; overviewTilesSelection: "highest" | "lowest"; overviewTilesMaxResolution: number | undefined; distortionMeasu....

TriangulatedWarpedMapOptions
Type
SpecificTriangulatedWarpedMapOptions & WarpedMapOptions
TriangulatedWarpedMapWithoutGeoreferencedMapOptions
Type
{ projection: Projection; applyMask: boolean; resourceResolution?: number | undefined; distortionMeasures: DistortionMeasure[]; fetchFn?: FetchFn | undefined; visible: boolean; anticipateVisibility: boolean; overviewTilesSelection: "highest" | "lowest"; overviewTilesMaxResolution: number | undefined; distortionMeasu...
new 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
number
Viewport#canvasSize
Type
[number, number]
Viewport#devicePixelRatio
Type
number
Viewport#geoCenter
Type
[number, number]
Viewport#geoRectangle
Type
[Point, Point, Point, Point]
Viewport#geoRectangleBbox
Type
[number, number, number, number]
Viewport#geoResolution
Type
number
Viewport#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
number
Viewport#projectedGeoPerViewportScale
Type
number
Viewport#projectedGeoRectangle
Type
[Point, Point, Point, Point]
Viewport#projectedGeoRectangleBbox
Type
[number, number, number, number]
Viewport#projectedGeoResolution
Type
number
Viewport#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
number
Viewport#viewportBbox
Type
[number, number, number, number]
Viewport#viewportCenter
Type
[number, number]
Viewport#viewportRectangle
Type
[Point, Point, Point, Point]
Viewport#viewportResolution
Type
number
Viewport#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 & MaskOptions & { onlyVisible?: boolean mapIds?: Iterable<string> geoPoint?: Point geoBbox?: Bbox projectedGeoPoint?: Point projectedGeoBbox?: Bbox } > | 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 & MaskOptions & { ...; }> | 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: { id: string; type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; height?: number | undefined; width?: number | undefined; partOf?: Array<PartOfItemType> | undefined; provider?: Array<{ ...; }> | undefined; }; ... 8 more ...; _allmaps?: unknown; })
    • Georeferenced map used to construct the WarpedMap
  • listOptions (Partial<WarpedMapListOptions<WarpedMap>> | undefined)
  • mapOptions (Partial<WarpedMapOptions> | undefined)
Returns

WarpedMap.

Extends
  • EventTarget
WarpedMap#abortController?
Type
AbortController
WarpedMap#applyMask
Type
boolean
WarpedMap#applyMaskOpacity
Type
number
WarpedMap#applyOptions(animationOptions)
Parameters
  • animationOptions? (Partial<AnimationOptions & AnimationInternalOptions> | 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; ... 4 more ...; 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
boolean
WarpedMap#gcps
Type
Array<Gcp>
WarpedMap#geoAppliedMask
Type
Array<Point>
WarpedMap#geoAppliedMaskBbox
Type
[number, number, number, number]
WarpedMap#geoAppliedMaskRectangle
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: { id: string; type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; height?: number | undefined; width?: number | undefined; partOf?: Array<PartOfItemType> | undefined; provider?: Array<{ ...; }> | undefined; }; ... 8 more ...; _allmaps?: unknown; }
WarpedMap#georeferencedMapOptions
Type
{ fetchFn?: FetchFn | undefined; gcps?: Array<Gcp> | undefined; resourceMask?: Ring | undefined; transformationType?: TransformationType | undefined; ... 7 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; ... 4 more ...; distortionMeasure: DistortionMeasure | undefined; }.

WarpedMap#getGeoAppliedMask(applyMask)

Get the geo applied mask, mask or full mask, based on an input option.

Parameters
  • applyMask? (boolean | undefined)
Returns

Array<Point>.

WarpedMap#getProjectedGeoAppliedMask(applyMask)

Get the projected geo applied mask, mask or full mask, based on an input option.

Parameters
  • applyMask? (boolean | undefined)
Returns

Array<Point>.

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? (TransformationType | undefined)
  • 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#getResourceAppliedMask(applyMask)

Get the resource applied mask, mask or full mask, based on an input option.

Parameters
  • applyMask? (boolean | undefined)
Returns

Array<Point>.

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
Image
WarpedMap#internalProjection
Type
{id?: string; name?: string; definition: ProjectionDefinition}
WarpedMap#listOptions
Type
{ createRTree?: boolean | undefined; rtreeUpdatedOptions?: Array<keyof SpecificWebGL2WarpedMapOptions | keyof SpecificTriangulatedWarpedMapOptions | keyof WarpedMapOptions> | undefined; ... 65 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
string
WarpedMap#mapOptions
Type
{ fetchFn?: FetchFn | undefined; gcps?: Array<Gcp> | undefined; resourceMask?: Ring | undefined; transformationType?: TransformationType | undefined; ... 7 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
false
WarpedMap#options
Type
{ fetchFn?: FetchFn; gcps: Gcp[]; resourceMask: Ring; transformationType: TransformationType; internalProjection: Projection; projection: Projection; visible: boolean; ... 4 more ...; 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#previousApplyMask
Type
boolean
WarpedMap#previousApplyMaskOpacity
Type
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#previousVisibilityOpacity
Type
number
WarpedMap#previousVisible
Type
boolean
WarpedMap#projectedGcps
Type
Array<Gcp>
WarpedMap#projectedGeoAppliedMask
Type
Array<Point>
WarpedMap#projectedGeoAppliedMaskBbox
Type
[number, number, number, number]
WarpedMap#projectedGeoAppliedMaskRectangle
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
ProjectedGcpTransformer
WarpedMap#projectedTransformer
Type
ProjectedGcpTransformer
WarpedMap#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#resourceAppliedMask
Type
Array<Point>
WarpedMap#resourceAppliedMaskBbox
Type
[number, number, number, number]
WarpedMap#resourceAppliedMaskRectangle
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
number
WarpedMap#setDefaultOptions()

Set the defaultOptions

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)

Set the list options

Parameters
  • listOptions? (Partial<WarpedMapOptions> | undefined)
    • list options
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

object.

WarpedMap#setMapAndListOptions(mapOptions, listOptions, animationOptions)

Set the map-specific options, and the list options

Parameters
  • mapOptions? (Partial<WarpedMapOptions> | undefined)
    • Map-specific options
  • listOptions? (Partial<WarpedMapOptions> | undefined)
    • list options
  • animationOptions? (Partial<AnimationOptions & AnimationInternalOptions> | undefined)
    • Animation options
Returns

object.

WarpedMap#setMapOptions(mapOptions, animationOptions)

Set the map-specific options

Parameters
  • mapOptions? (Partial<WarpedMapOptions> | undefined)
    • Map-specific options
  • animationOptions? (Partial<AnimationOptions & AnimationInternalOptions> | undefined)
    • Animation options
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#setResourceBufferedViewportRingBboxAndResourceAppliedMaskBboxIntersectionForViewport(resourceBufferedViewportRingBboxAndResourceAppliedMaskBboxIntersection)

Set resourceBufferedViewportRingBboxAndResourceAppliedMaskBboxIntersection for the current viewport

Parameters
  • resourceBufferedViewportRingBboxAndResourceAppliedMaskBboxIntersection? (Bbox | undefined)
Returns

void.

WarpedMap#setResourceBufferedViewportRingForViewport(resourceBufferedViewportRing)

Set resourceBufferedViewportRing for the current viewport

Parameters
  • resourceBufferedViewportRing? (Ring | undefined)
Returns

void.

WarpedMap#setResourceMask()

Update the resource mask loaded from a georeferenced map to a new mask.

Parameters

There are no parameters.

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(_partialOptions)
Parameters
  • _partialOptions? (Partial<ShouldRenderOptions> | undefined)
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#updateAppliedGeoMask()
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#updateProjectedAppliedGeoMask()
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#visibilityOpacity
Type
number
WarpedMap#visible
Type
boolean
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; ... 4 more ...; distortionMeasure: DistortionMeasure | undefined; }.

WarpedMap.getDefaultWithoutGeoreferencedMapOptions()

Get default options without the options overwritten by the georeferenced map

Parameters

There are no parameters.

Returns

{ projection: Projection applyMask: boolean fetchFn?: FetchFn | undefined visible: boolean anticipateVisibility: boolean overviewTilesSelection: 'highest' | 'lowest' overviewTilesMaxResolution: number | undefined distortionMeasure: DistortionMeasure | undefined }.

new WarpedMapEvent(type, data)
Parameters
  • type ("imageinfosadded" | "warpedmapadded" | "warpedmapremoved" | "warpedmapentered" | "warpedmapleft" | "imageloaded" | "tilefetched" | "tilefetcherror" | "tilesfromspritetile" | ... 11 more ... | "error")
  • data? (Partial<WarpedMapEventData> | undefined)
Returns

WarpedMapEvent.

Extends
  • Event
WarpedMapEvent#data?
Type
{
  mapIds?: Array<string> | undefined
  tileUrl?: string | undefined
  optionKeys?: Array<string> | undefined
  animationOptions?: Partial<AnimationOptions> | undefined
  spritesInfo?: SpritesInfo | undefined
}
WarpedMapEvent#error?
Type
Error
new WarpedMapList(options)

Creates an instance of a WarpedMapList

Parameters
  • options? (Partial<WarpedMapListOptions<W>> | undefined)
    • Options of this list, which will be set on newly added maps as their list options
Returns

WarpedMapList<W>.

Extends
  • EventTarget
WarpedMapList#DEFAULT_WARPED_MAP_LIST_OPTIONS

Maps in this list, indexed by their ID

Type
SpecificWarpedMapListOptions<W> & Partial<WebGL2WarpedMapOptions>
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 (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 (string).

WarpedMapList#addGeoreferencedMaps(georeferencedMaps, mapOptions)
Parameters
  • georeferencedMaps (unknown)
  • mapOptions? (Partial<GetWarpedMapOptions<W>> | undefined)
Returns

Array<string | Error>.

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#bringMapsForward(mapIds)

Change the z-index of the specified maps to bring them forward

Parameters
  • mapIds (Iterable<string>)
    • Map IDs
Returns

void.

WarpedMapList#bringMapsToFront(mapIds)

Change 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#geoFullMaskRTree?
Type
RTree
WarpedMapList#geoMaskRTree?
Type
RTree
WarpedMapList#getDefaultOptions()

Get the default options of the list

Parameters

There are no parameters.

Returns

SpecificWarpedMapListOptions<W> & Partial<WebGL2WarpedMapOptions> & GetWarpedMapOptions<W>.

WarpedMapList#getListOptions()

Get the options of this list

Parameters

There are no parameters.

Returns

{ createRTree?: boolean | undefined; rtreeUpdatedOptions?: Array<keyof SpecificWebGL2WarpedMapOptions | keyof SpecificTriangulatedWarpedMapOptions | keyof WarpedMapOptions> | undefined; ... 65 more ...; distortionMeasure?: DistortionMeasure | undefined; }.

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(partialOptions)

Get mapIds for selected maps

The options allow a.o. to:

  • filter for visible maps
  • filter for specific mapIds
  • filter for maps that overlap with a given point. Use geoPoint or projectedGeoPoint. Optionally specify projection for projectedGeoPoint. Optionally specify whether mask should be applied when computing overlap using applyMask.
  • filter for maps whose bbox overlap with the specified bbox. Use geoBbox or projectedGeoBbox. Optionally specify projection for projectedGeoBbox. Optionally specify whether mask should be applied when computing overlap using applyMask.
Parameters
  • partialOptions? (Partial<SelectionOptions> | undefined)
    • Selection, mask and projection options, defaults to all visible maps, applied mask and current projection
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(options)

Get the bounding box of the maps in this list

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

Parameters
  • options? ( | Partial< MaskOptions & { onlyVisible?: boolean mapIds?: Iterable<string> geoPoint?: Point geoBbox?: Bbox projectedGeoPoint?: Point projectedGeoBbox?: Bbox } & ProjectionOptions > | undefined)
    • Selection, mask and projection options, defaults to all visible maps, applied mask and current projection
Returns

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

WarpedMapList#getMapsCenter(options)

Get the center of the bounding box of the maps in this list

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

Parameters
  • options? ( | Partial< MaskOptions & { onlyVisible?: boolean mapIds?: Iterable<string> geoPoint?: Point geoBbox?: Bbox projectedGeoPoint?: Point projectedGeoBbox?: Bbox } & ProjectionOptions > | undefined)
    • Selection, mask and projection options, defaults to all visible maps, applied mask and current projection
Returns

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

WarpedMapList#getMapsConvexHull(options)

Get the convex hull of the maps in this list

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

Parameters
  • options? ( | Partial< MaskOptions & { onlyVisible?: boolean mapIds?: Iterable<string> geoPoint?: Point geoBbox?: Bbox projectedGeoPoint?: Point projectedGeoBbox?: Bbox } & ProjectionOptions > | undefined)
    • Selection, mask and projection options, defaults to all visible maps, applied mask and current projection
Returns

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

WarpedMapList#getOptions()

Get the options of this list

Parameters

There are no parameters.

Returns

{ createRTree?: boolean | undefined; rtreeUpdatedOptions?: Array<keyof SpecificWebGL2WarpedMapOptions | keyof SpecificTriangulatedWarpedMapOptions | keyof WarpedMapOptions> | undefined; ... 65 more ...; distortionMeasure?: DistortionMeasure | undefined; }.

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(partialOptions)

Get the WarpedMap instances for selected maps

The options allow a.o. to:

  • filter for visible maps
  • filter for specific mapIds
  • filter for maps that overlap with a given point. Use geoPoint or projectedGeoPoint. Optionally specify projection for projectedGeoPoint. Optionally specify whether mask should be applied when computing overlap using applyMask.
  • filter for maps whose bbox overlap with the specified bbox. Use geoBbox or projectedGeoBbox. Optionally specify projection for projectedGeoBbox. Optionally specify whether mask should be applied when computing overlap using applyMask.
Parameters
  • partialOptions? ( | Partial< MaskOptions & { onlyVisible?: boolean mapIds?: Iterable<string> geoPoint?: Point geoBbox?: Bbox projectedGeoPoint?: Point projectedGeoBbox?: Bbox } & ProjectionOptions > | undefined)
    • Selection, mask and projection options, defaults to all visible maps, applied mask and current projection
Returns

WarpedMap instances (Array<W>).

WarpedMapList#imagesById
Type
Map<string, Image>
WarpedMapList#options
Type
SpecificWarpedMapListOptions<W> & 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#projectedGeoFullMaskRTree?
Type
RTree
WarpedMapList#projectedGeoMaskRTree?
Type
RTree
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 (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 (string).

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 (string).

WarpedMapList#removeGeoreferencedMaps(georeferencedMaps)
Parameters
  • georeferencedMaps (unknown)
Returns

Array<string | Error>.

WarpedMapList#resetListOptions(listOptionKeys, animationOptions)

Reset the list options

Undefined option keys reset all options

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

void.

WarpedMapList#resetMapsAndListOptions(mapIds, mapsOptionKeys, listOptionKeys, animationOptions)

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

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

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

void.

WarpedMapList#resetMapsOptions(mapIds, mapsOptionKeys, animationOptions)

Reset the map-specific options of the specified maps

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

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

void.

WarpedMapList#sendMapsBackward(mapIds)

Change the zIndex of the specified maps to send them backward

Parameters
  • mapIds (Iterable<string>)
    • Map IDs
Returns

void.

WarpedMapList#sendMapsToBack(mapIds)

Change the z-index of the specified maps to send them to back

Parameters
  • mapIds (Iterable<string>)
    • Map IDs
Returns

void.

WarpedMapList#setListOptions(listOptions, animationOptions)

Set the options of this list

Note: Map-specific options set here will be passed to newly added maps.

Parameters
  • listOptions? (Partial<WarpedMapListOptions<W>> | undefined)
    • List Options
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

void.

WarpedMapList#setMapsAndListOptions(mapIds, mapsOptions, listOptions, animationOptions)

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

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

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

void.

WarpedMapList#setMapsOptions(mapIds, mapsOptions, animationOptions)

Set the map-specific options of the specified maps

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

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

void.

WarpedMapList#setOptions(listOptions)

Set the options

Note: Map-specific options set here will be passed to newly added maps.

Parameters
  • listOptions? (Partial<WarpedMapListOptions<W>> | undefined)
    • List Options
Returns

void.

WarpedMapList#updateWarpedMapsUsingFactory()

Update the maps in the list using the warpedMapFactory

This function is used when creating a WarpedMapList from scratch and later including it in a specific renderer (e.g. a WebGL2Renderer) which has a specific warpedMapFactory (e.g. including the WebGL context) which could not be applied in the initial WarpedMapList. This function recreates the WarpedMaps using the factory.

It is import to do this after the event listeners on the warpedmaplist are added to the renderer, so the WARPEDMAPADDED event is passed.

Parameters

There are no parameters.

Returns

this.

WarpedMapList#warpedMapsById
Type
Map<string, W>
WarpedMapList#zIndices
Type
Map<string, number>
WarpedMapList.projectBboxIfNeeded(projectionFrom, projectionTo, bbox)
Parameters
  • projectionFrom ({id?: string; name?: string; definition: ProjectionDefinition})
  • projectionTo ({id?: string; name?: string; definition: ProjectionDefinition})
  • bbox ([number, number, number, number])
Returns

[number, number, number, number].

WarpedMapList.projectPointIfNeeded(projectionFrom, projectionTo, point)
Parameters
  • projectionFrom ({id?: string; name?: string; definition: ProjectionDefinition})
  • projectionTo ({id?: string; name?: string; definition: ProjectionDefinition})
  • point ([number, number])
Returns

[number, number].

WarpedMapList.projectPointsIfNeeded(projectionFrom, projectionTo, points)
Parameters
  • projectionFrom ({id?: string; name?: string; definition: ProjectionDefinition})
  • projectionTo ({id?: string; name?: string; definition: ProjectionDefinition})
  • points (Array<Point>)
Returns

Array<Point>.

WarpedMapListOptions
Type
SpecificWarpedMapListOptions<W> & Partial<WebGL2WarpedMapOptions>
WarpedMapOptions
Fields
  • anticipateVisibility (boolean)
  • applyMask (boolean)
  • distortionMeasure (DistortionMeasure | undefined)
  • fetchFn? (( input: Request | string | URL, init?: RequestInit ) => Promise<Response>)
  • gcps (Array<Gcp>)
  • internalProjection ({id?: string; name?: string; definition: ProjectionDefinition})
  • overviewTilesMaxResolution (number | undefined)
  • overviewTilesSelection ('highest' | 'lowest')
  • projection ({id?: string; name?: string; definition: ProjectionDefinition})
  • resourceMask (Array<Point>)
  • transformationType ( | 'straight' | 'helmert' | 'polynomial' | 'polynomial1' | 'polynomial2' | 'polynomial3' | 'thinPlateSpline' | 'projective' | 'linear')
  • visible (boolean)
WarpedMapWithoutGeoreferencedMapOptions
Type
{
  projection: Projection
  applyMask: boolean
  fetchFn?: FetchFn | undefined
  visible: boolean
  anticipateVisibility: boolean
  overviewTilesSelection: 'highest' | 'lowest'
  overviewTilesMaxResolution: number | undefined
  distortionMeasure: DistortionMeasure | undefined
}
new IntArrayRenderer(getImageData, getImageDataValue, getImageDataSize, options)
Parameters
  • getImageData ((data: Uint8ClampedArray) => D)
  • getImageDataValue ((data: D, index: number) => number)
  • getImageDataSize ((data: D) => Size)
  • options? (Partial<IntArrayRenderOptions> | undefined)
Returns

IntArrayRenderer<D>.

Extends
  • BaseRenderer
  • Renderer
IntArrayRenderer#getImageDataSize
Type
(data: D) => Size
IntArrayRenderer#getImageDataValue
Type
(data: D, index: number) => number
IntArrayRenderer#render(viewport)

Render the map for a given viewport.

Parameters
  • viewport (Viewport)
    • the viewport to render
Returns

Promise<Uint8ClampedArray<ArrayBufferLike>>.

new CanvasRenderer(canvas, options)
Parameters
  • canvas (HTMLCanvasElement | OffscreenCanvas)
  • options? (Partial<CanvasRenderOptions> | undefined)
Returns

CanvasRenderer.

Extends
  • BaseRenderer
  • Renderer
CanvasRenderer#canvas
Type
HTMLCanvasElement | OffscreenCanvas
CanvasRenderer#context
Type
CanvasRenderingContext2D
CanvasRenderer#render(viewport)

Render the map for a given viewport.

If no viewport is specified, a viewport is deduced based on the WarpedMapList and canvas width and hight.

Parameters
  • viewport? (Viewport | undefined)
    • the viewport to render
Returns

Promise<void>.

SpecificWebGL2RenderOptions
Fields
  • warpedMapFactory ((mapId: string, georeferencedMap: GeoreferencedMap, listOptions?: Partial<WarpedMapListOptions<WebGL2WarpedMap>> | undefined, mapOptions?: Partial<...> | undefined) => WebGL2WarpedMap)
SpecificWebGL2WarpedMapOptions
Fields
  • colorize (boolean)
  • colorizeColor (string)
  • debugTiles (boolean)
  • debugTriangles (boolean)
  • distortionColor00 (string)
  • distortionColor01 (string)
  • distortionColor1 (string)
  • distortionColor2 (string)
  • distortionColor3 (string)
  • opacity (number)
  • removeColor (boolean)
  • removeColorColor (string)
  • removeColorHardness (number)
  • removeColorThreshold (number)
  • renderAppliedMask (boolean)
  • renderAppliedMaskBorderColor? (string)
  • renderAppliedMaskBorderSize? (number)
  • renderAppliedMaskColor? (string)
  • renderAppliedMaskSize? (number)
  • renderFullMask (boolean)
  • renderFullMaskBorderColor? (string)
  • renderFullMaskBorderSize? (number)
  • renderFullMaskColor? (string)
  • renderFullMaskSize? (number)
  • renderGcps (boolean)
  • renderGcpsBorderColor? (string)
  • renderGcpsBorderSize? (number)
  • renderGcpsColor? (string)
  • renderGcpsSize? (number)
  • renderGrid (boolean)
  • renderGridColor (string)
  • renderLines? (boolean)
  • renderMaps? (boolean)
  • renderMask (boolean)
  • renderMaskBorderColor? (string)
  • renderMaskBorderSize? (number)
  • renderMaskColor? (string)
  • renderMaskSize? (number)
  • renderPoints? (boolean)
  • renderTransformedGcps (boolean)
  • renderTransformedGcpsBorderColor? (string)
  • renderTransformedGcpsBorderSize? (number)
  • renderTransformedGcpsColor? (string)
  • renderTransformedGcpsSize? (number)
  • renderVectors (boolean)
  • renderVectorsBorderColor? (string)
  • renderVectorsBorderSize? (number)
  • renderVectorsColor? (string)
  • renderVectorsSize? (number)
  • saturation (number)
WebGL2RenderOptions
Type
SpecificWebGL2RenderOptions &
  SpecificBaseRenderOptions<WebGL2WarpedMap> &
  Partial<WarpedMapListOptions<WebGL2WarpedMap>>
new WebGL2Renderer(gl, options)

Creates an instance of WebGL2Renderer.

Parameters
  • gl (WebGL2RenderingContext)
    • WebGL 2 rendering context
  • options? (Partial<WebGL2RenderOptions> | undefined)
    • options
Returns

WebGL2Renderer.

Extends
  • BaseRenderer
  • Renderer
WebGL2Renderer#DEFAULT_SPECIFIC_WEBGL2_RENDER_OPTIONS
Type
{warpedMapFactory: WarpedMapFactory<WebGL2WarpedMap>}
WebGL2Renderer#animatedChange(event)
Parameters
  • event (Event)
Returns

void.

WebGL2Renderer#animating
Type
false
WebGL2Renderer#animationProgress
Type
0
WebGL2Renderer#animationStart
Type
number | undefined
WebGL2Renderer#cancelThrottledFunctions()
Parameters

There are no parameters.

Returns

void.

WebGL2Renderer#clear()
Parameters

There are no parameters.

Returns

void.

WebGL2Renderer#clearMap(mapId)
Parameters
  • mapId (string)
Returns

void.

WebGL2Renderer#contextLost()
Parameters

There are no parameters.

Returns

void.

WebGL2Renderer#contextRestored()
Parameters

There are no parameters.

Returns

void.

WebGL2Renderer#destroy()
Parameters

There are no parameters.

Returns

void.

WebGL2Renderer#disableRender
Type
false
WebGL2Renderer#getDefaultOptions()

Get the default options of the renderer and list

Parameters

There are no parameters.

Returns

SpecificWebGL2RenderOptions & SpecificBaseRenderOptions<WebGL2WarpedMap> & Partial<WarpedMapListOptions<WebGL2WarpedMap>> & SpecificWebGL2WarpedMapOptions & SpecificTriangulatedWarpedMapOptions & WarpedMapOptions.

WebGL2Renderer#gl
Type
WebGL2RenderingContext
WebGL2Renderer#imageLoaded(event)
Parameters
  • event (Event)
Returns

void.

WebGL2Renderer#immediateChange(event)
Parameters
  • event (Event)
Returns

void.

WebGL2Renderer#initializeWebGL(gl)
Parameters
  • gl (WebGL2RenderingContext)
Returns

void.

WebGL2Renderer#lastAnimationFrameRequestId
Type
number | undefined
WebGL2Renderer#linesProgram
Type
WebGLProgram
WebGL2Renderer#mapProgram
Type
WebGLProgram
WebGL2Renderer#mapTileDeleted(event)
Parameters
  • event (Event)
Returns

void.

WebGL2Renderer#mapTileLoaded(event)
Parameters
  • event (Event)
Returns

void.

WebGL2Renderer#options
Type
SpecificWebGL2RenderOptions &
  SpecificBaseRenderOptions<WebGL2WarpedMap> &
  Partial<WarpedMapListOptions<WebGL2WarpedMap>>
WebGL2Renderer#pointsProgram
Type
WebGLProgram
WebGL2Renderer#prepareChange(event)
Parameters
  • event (Event)
Returns

void.

WebGL2Renderer#previousSignificantViewport
Type
Viewport | undefined
WebGL2Renderer#render(viewport)

Render the map for a given viewport.

If no viewport is specified the current viewport is rerendered. If no current viewport is known, a viewport is deduced based on the WarpedMapList and canvas width and hight.

Parameters
  • viewport? (Viewport | undefined)
    • the current viewport
Returns

void.

WebGL2Renderer#resetPrevious()
Parameters

There are no parameters.

Returns

void.

WebGL2Renderer#shouldRequestFetchableTiles()
Parameters

There are no parameters.

Returns

boolean.

WebGL2Renderer#updateMapsForViewport(allFechableTilesForViewport)
Parameters
  • allFechableTilesForViewport (Array<FetchableTile>)
Returns

{ mapsInViewportEntering: string[] mapsInViewportLeaving: string[] mapsWithFetchableTilesForViewportEntering: string[] mapsWithFetchableTilesForViewportLeaving: string[] }.

WebGL2Renderer#updateVertexBuffers(mapIds)
Parameters
  • mapIds? (Array<string> | undefined)
Returns

void.

WebGL2Renderer#warpedMapAdded(event)
Parameters
  • event (Event)
Returns

void.

new WebGL2WarpedMap(mapId, georeferencedMap, gl, mapProgram, linesProgram, pointsProgram, listOptions, mapOptions)

Creates an instance of WebGL2WarpedMap.

Parameters
  • mapId (string)
    • ID of the map
  • georeferencedMap ({ type: "GeoreferencedMap"; resource: { id: string; type: "ImageService1" | "ImageService2" | "ImageService3" | "Canvas"; height?: number | undefined; width?: number | undefined; partOf?: Array<PartOfItemType> | undefined; provider?: Array<{ ...; }> | undefined; }; ... 8 more ...; _allmaps?: unknown; })
    • Georeferenced map used to construct the WarpedMap
  • gl (WebGL2RenderingContext)
    • WebGL rendering context
  • mapProgram (WebGLProgram)
    • WebGL program for map
  • linesProgram (WebGLProgram)
  • pointsProgram (WebGLProgram)
  • listOptions? (Partial<WarpedMapListOptions<WebGL2WarpedMap>> | undefined)
  • mapOptions? (Partial<WebGL2WarpedMapOptions> | undefined)
Returns

WebGL2WarpedMap.

Extends
  • TriangulatedWarpedMap
WebGL2WarpedMap#addCachedTileAndUpdateTextures(cachedTile)

Add cached tile to the textures of this map and update textures

Parameters
  • cachedTile (CachedTile<ImageData>)
Returns

void.

WebGL2WarpedMap#applyOptions(animationOptions)
Parameters
  • animationOptions? (Partial<AnimationOptions> | undefined)
Returns

object.

WebGL2WarpedMap#cachedTilesByTileKey
Type
Map<string, CachedTile<ImageData>>
WebGL2WarpedMap#cachedTilesByTileUrl
Type
Map<string, CachedTile<ImageData>>
WebGL2WarpedMap#cachedTilesForTexture
Type
Array<never>
WebGL2WarpedMap#cachedTilesResourceOriginPointsAndSizesTexture
Type
null
WebGL2WarpedMap#cachedTilesScaleFactorsTexture
Type
null
WebGL2WarpedMap#cachedTilesTextureArray
Type
null
WebGL2WarpedMap#cancelThrottledFunctions()
Parameters

There are no parameters.

Returns

void.

WebGL2WarpedMap#clearTextures()

Clear textures for this map

Parameters

There are no parameters.

Returns

void.

WebGL2WarpedMap#defaultOptions
Type
SpecificWebGL2WarpedMapOptions &
  SpecificTriangulatedWarpedMapOptions &
  WarpedMapOptions
WebGL2WarpedMap#destroy()
Parameters

There are no parameters.

Returns

void.

WebGL2WarpedMap#georeferencedMapOptions
Type
{ renderMaps?: boolean | undefined; renderLines?: boolean | undefined; renderPoints?: boolean | undefined; renderGcps?: boolean | undefined; renderGcpsColor?: string | undefined; renderGcpsSize?: number | undefined; renderGcpsBorderColor?: string | undefined; ... 56 more ...; distortionMeasure?: DistortionMeasure | ...
WebGL2WarpedMap#getCachedTilesAtOtherScaleFactors(tile)
Parameters
  • tile ({ column: number row: number tileZoomLevel: TileZoomLevel imageSize: Size })
Returns

Array<CachedTile<ImageData>>.

WebGL2WarpedMap#gl
Type
WebGL2RenderingContext
WebGL2WarpedMap#image
Type
Image
WebGL2WarpedMap#imageId
Type
string
WebGL2WarpedMap#initializeWebGL(mapProgram, linesProgram, pointsProgram)
Parameters
  • mapProgram (WebGLProgram)
  • linesProgram (WebGLProgram)
  • pointsProgram (WebGLProgram)
Returns

void.

WebGL2WarpedMap#invertedRenderHomogeneousTransform
Type
[number, number, number, number, number, number]
WebGL2WarpedMap#lineGroups
Type
Array<never>
WebGL2WarpedMap#linesProgram
Type
WebGLProgram
WebGL2WarpedMap#linesVao
Type
null
WebGL2WarpedMap#listOptions
Type
{ renderMaps?: boolean | undefined; renderLines?: boolean | undefined; renderPoints?: boolean | undefined; renderGcps?: boolean | undefined; renderGcpsColor?: string | undefined; renderGcpsSize?: number | undefined; renderGcpsBorderColor?: string | undefined; ... 56 more ...; distortionMeasure?: DistortionMeasure | ...
WebGL2WarpedMap#mapOptions
Type
{ renderMaps?: boolean | undefined; renderLines?: boolean | undefined; renderPoints?: boolean | undefined; renderGcps?: boolean | undefined; renderGcpsColor?: string | undefined; renderGcpsSize?: number | undefined; renderGcpsBorderColor?: string | undefined; ... 56 more ...; distortionMeasure?: DistortionMeasure | ...
WebGL2WarpedMap#mapProgram
Type
WebGLProgram
WebGL2WarpedMap#mapVao
Type
null
WebGL2WarpedMap#options
Type
SpecificWebGL2WarpedMapOptions &
  SpecificTriangulatedWarpedMapOptions &
  WarpedMapOptions
WebGL2WarpedMap#pointGroups
Type
Array<never>
WebGL2WarpedMap#pointsProgram
Type
WebGLProgram
WebGL2WarpedMap#pointsVao
Type
null
WebGL2WarpedMap#previousCachedTilesForTexture
Type
Array<never>
WebGL2WarpedMap#removeCachedTileAndUpdateTextures(tileUrl)

Remove cached tile from the textures of this map and update textures

Parameters
  • tileUrl (string)
Returns

void.

WebGL2WarpedMap#setDefaultOptions()

Set the defaultOptions

Parameters

There are no parameters.

Returns

void.

WebGL2WarpedMap#setLineGroups()
Parameters

There are no parameters.

Returns

void.

WebGL2WarpedMap#setListOptions(listOptions, animationOptions)

Set the list options

Parameters
  • listOptions? (Partial<WebGL2WarpedMapOptions> | undefined)
    • list options
  • animationOptions? (Partial<AnimationOptions> | undefined)
    • Animation options
Returns

object.

WebGL2WarpedMap#setMapAndListOptions(mapOptions, listOptions, animationOptions)

Set the map-specific options, and the list options

Parameters
  • mapOptions? (Partial<WebGL2WarpedMapOptions> | undefined)
    • Map-specific options
  • listOptions? (Partial<WebGL2WarpedMapOptions> | undefined)
    • list options
  • animationOptions? (Partial<AnimationOptions & AnimationInternalOptions> | undefined)
    • Animation options
Returns

object.

WebGL2WarpedMap#setMapOptions(mapOptions, animationOptions)

Set the map-specific options

Parameters
  • mapOptions? (Partial<WebGL2WarpedMapOptions> | undefined)
    • Map-specific options
  • animationOptions? (Partial<AnimationOptions & AnimationInternalOptions> | undefined)
    • Animation options
Returns

object.

WebGL2WarpedMap#setPointGroups()
Parameters

There are no parameters.

Returns

void.

WebGL2WarpedMap#shouldRenderLines()
Parameters

There are no parameters.

Returns

boolean.

WebGL2WarpedMap#shouldRenderMap(partialOptions)
Parameters
  • partialOptions? (Partial<ShouldRenderOptions> | undefined)
Returns

boolean.

WebGL2WarpedMap#shouldRenderPoints()
Parameters

There are no parameters.

Returns

boolean.

WebGL2WarpedMap#throttledUpdateTextures
Type
DebouncedFunc<() => Promise<void>>
WebGL2WarpedMap#tileInCachedTiles(tile)
Parameters
  • tile ({ column: number row: number tileZoomLevel: TileZoomLevel imageSize: Size })
Returns

boolean.

WebGL2WarpedMap#tileSize
Type
[number, number]
WebGL2WarpedMap#tileToCachedTile(tile)
Parameters
  • tile ({ column: number row: number tileZoomLevel: TileZoomLevel imageSize: Size })
Returns

CachedTile<ImageData> | undefined.

WebGL2WarpedMap#updateCachedTilesForTextures()
Parameters

There are no parameters.

Returns

void.

WebGL2WarpedMap#updateTextures()
Parameters

There are no parameters.

Returns

Promise<void>.

WebGL2WarpedMap#updateVertexBuffers(projectedGeoToClipHomogeneousTransform)

Update the vertex buffers of this warped map

Parameters
  • projectedGeoToClipHomogeneousTransform ([number, number, number, number, number, number])
    • Transform from projected geo coordinates to webgl2 coordinates in the [-1, 1] range. Equivalent to OpenLayers' projectionTransform.
Returns

void.

WebGL2WarpedMap#updateVertexBuffersLines(projectedGeoToClipHomogeneousTransform)
Parameters
  • projectedGeoToClipHomogeneousTransform ([number, number, number, number, number, number])
Returns

void.

WebGL2WarpedMap#updateVertexBuffersMap(projectedGeoToClipHomogeneousTransform)
Parameters
  • projectedGeoToClipHomogeneousTransform ([number, number, number, number, number, number])
Returns

void.

WebGL2WarpedMap#updateVertexBuffersPoints(projectedGeoToClipHomogeneousTransform)
Parameters
  • projectedGeoToClipHomogeneousTransform ([number, number, number, number, number, number])
Returns

void.

WebGL2WarpedMap.getDefaultOptions()

Get default options

Parameters

There are no parameters.

Returns

SpecificWebGL2WarpedMapOptions & SpecificTriangulatedWarpedMapOptions & WarpedMapOptions.

WebGL2WarpedMap.getDefaultWithoutGeoreferencedMapOptions()

Get default options without the options overwritten by the georeferenced map

Parameters

There are no parameters.

Returns

{ projection: Projection; applyMask: boolean; renderMaps?: boolean | undefined; renderLines?: boolean | undefined; renderPoints?: boolean | undefined; renderGcps: boolean; renderGcpsColor?: string | undefined; ... 52 more ...; distortionMeasure: DistortionMeasure | undefined; }.

WebGL2WarpedMapOptions
Type
SpecificWebGL2WarpedMapOptions &
  SpecificTriangulatedWarpedMapOptions &
  WarpedMapOptions
WebGL2WarpedMapWithoutGeoreferencedMapOptions
Type
{ projection: Projection; applyMask: boolean; renderMaps?: boolean | undefined; renderLines?: boolean | undefined; renderPoints?: boolean | undefined; renderGcps: boolean; renderGcpsColor?: string | undefined; renderGcpsSize?: number | undefined; ... 51 more ...; distortionMeasure: DistortionMeasure | undefined; }
OutputFormat
Type
'png' | 'webp' | 'jpeg'
new WasmRenderer(wasmModule, options)
Parameters
  • wasmModule ({ decode_jpeg_test(jpegBytes: Uint8Array): { width: number; height: number; }; encode_rgba_to_png(pixels: Uint8Array, width: number, height: number): Uint8Array; ... 6 more ...; render_warped_tile_jpeg(jpeg_tiles: Uint8Array, tile_offsets: Uint32Array, tile_widths: Uint32Array, tile_heights: Uint32Array, tile_column...)
  • options? ( | (Partial<IntArrayRenderOptions> & { outputFormat?: OutputFormat backgroundColor?: [number, number, number] }) | undefined)
Returns

WasmRenderer.

Extends
  • BaseRenderer
  • Renderer
WasmRenderer#backgroundColor?
Type
[number, number, number]
WasmRenderer#outputFormat
Type
'png' | 'webp' | 'jpeg'
WasmRenderer#render(viewport)

Render the map for a given viewport using WASM.

Parameters
  • viewport (Viewport)
    • the viewport to render
Returns

Promise<Uint8Array<ArrayBufferLike>>.

WasmRenderer#wasmModule
Type
{ decode_jpeg_test(jpegBytes: Uint8Array): { width: number; height: number; }; encode_rgba_to_png(pixels: Uint8Array, width: number, height: number): Uint8Array; ... 6 more ...; render_warped_tile_jpeg(jpeg_tiles: Uint8Array, tile_offsets: Uint32Array, tile_widths: Uint32Array, tile_heights: Uint32Array, tile_column...

Keywords