Types

CameraUpdateTransformFunction

A callback hook that allows manipulating the camera and being notified about camera updates before they happen.

Parameters

next { bearing: number; center: LngLat; elevation: number; pitch: number; roll: number; zoom: number; }
next.bearing number
next.center LngLat
next.elevation number
next.pitch number
next.roll number
next.zoom number

RequestTransformFunction

This function is used to tranform a request. It is used just before executing the relevant request.

Parameters

url string
resourceType ? ResourceType

ResourceType

A type of MapLibre resource.

Enumeration members

Glyphs
Image
Source
SpriteImage
SpriteJSON
Style
Tile
Unknown

Subscription

Allows to unsubscribe from events without the need to store the method reference.

Methods

unsubscribe()

Unsubscribes from the event.

Returns

void

StyleSetterOptions

Supporting type to add validation to another style related type.

Type declaration

validate? boolean Whether to check if the filter conforms to the MapLibre Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.

CubemapLayerConstructorOptions

Constructor options for the CubemapLayer.

Usage

Simple space

You can enable a simple space background with a solid color:

Predefined Presets

Alternatively, you can provide a cubemap for a space backround using one of the following methods:
  • space : Dark blue hsl(210, 100%, 4%) background and white stars (transparent background image). Space color changes the background color, stars always stay white.
  • stars (default): Black background (image mask), space color changes the stars color, background always stays black.
  • milkyway : Black half-transparent background with standard milkyway and stars. Space color changes the stars and milkyway color, background always stays black.
  • milkyway-subtle : Black half-transparent background with subtle milkyway and less stars. Space color changes the stars and milkyway color, background always stays black. Black half-transparent background with standard milkyway and stars. Space color changes the stars and milkyway color, background always stays black.
  • milkyway-bright : Black half-transparent background with bright milkyway and more stars. Space color changes the stars and milkyway color, background always stays black.

Cubemap Images (Custom Skybox)

Load your custom cubemap images:

Cubemap Path with image format

This fetches all images from a path, this assumes all files are named px, nx, py, ny, pz, nz and suffixed with the appropriate extension specified in format.

Set the space background dynamically

You can also set the space dynamically after the map loads:
  • Cubemap face images must be square and have a height / width of a power of 2 512px, 1024px
  • if space.color or are not explicitly set in the call to setSpace, then the previous value will remain for this field. To override the default, set the required field to null.

RadialGradientLayerConstructorOptions

Options for constructing a RadialGradientLaye.

Usage

Simple halo

You can enable a simple halo by setting it to true:

Radial gradient

For more customization, you can define a radial gradient with scale and stops:

Set the halo dynamically

You can also set the halo dynamically after the map loads:
Reference documentation of MapTiler SDK JS, an extension of MapLibre GL JS