npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

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

About

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

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

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

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

Open Software & Tools

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

© 2026 – Pkg Stats / Ryan Hefner

@allmaps/render

v1.0.0-beta.83

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 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
  • `listOption