XYZ Maps Documentation
    Preparing search index...

    Interface MapOptions

    Options to configure the map display.

    interface MapOptions {
        backgroundColor?: Color;
        behavior?: {
            drag?: boolean;
            pitch?: boolean;
            pitchAndRotateModifiers?: ModifierKey | ModifierKey[];
            rotate?: boolean;
            zoom?: boolean | "fixed" | "float";
        };
        cameraTerrainOffset?: number;
        center?: GeoPoint;
        debug?: boolean;
        layers?: TileLayer[];
        maxLevel?: number;
        maxPitch?: number;
        minLevel?: number;
        minPanMapThreshold?: number;
        minPitchMapThreshold?: number;
        minRotateMapThreshold?: number;
        pitch?: number;
        rotate?: number;
        singleWorldView?: boolean
        | "both"
        | "latitude";
        ui?: {};
        zoomAnimationMs?: number;
        zoomlevel?: number;
    }
    Index
    backgroundColor?: Color

    The default background color of the map is white. To achieve a transparent map background, you can set it to "rgba(0, 0, 0, 0)" or simply use the keyword "transparent".

    The background color of the layer at index 0 takes precedence over this color. If that layer has no background color, or the map has no layers, the map background color is used. The map background color can be updated after initialization using Map.setBackgroundColor.

    "white"
    
    behavior?: {
        drag?: boolean;
        pitch?: boolean;
        pitchAndRotateModifiers?: ModifierKey | ModifierKey[];
        rotate?: boolean;
        zoom?: boolean | "fixed" | "float";
    }

    Behavior options of the map. Allow user to "drag" / "rotate" / "pitch" or "zoom" the map by mouse/touch interaction.

    "drag" / "rotate" and "pitch" are booleans indicating if user interaction is possible or not. Possible values for "zoom" property are

    Type Declaration

    • Optionaldrag?: boolean

      enable or disable dragging the map

      true
      
    • Optionalpitch?: boolean

      enable or disable pitching the map

      false
      
    • OptionalpitchAndRotateModifiers?: ModifierKey | ModifierKey[]

      Modifier key or keys that activate pitch and rotation with a primary-button drag.

      Supported values are 'ctrl', 'meta', 'shift', and 'alt'. If an array is provided, any one of the keys activates the gesture. Use an empty array to disable the gesture.

      ['ctrl', 'meta']
      
      const options = {
      behavior: {
      pitch: true,
      rotate: true,
      pitchAndRotateModifiers: ['ctrl', 'meta']
      }
      };
    • Optionalrotate?: boolean

      enable or disable rotating the map

      falses
      
    • Optionalzoom?: boolean | "fixed" | "float"

      configure map zoom behavior:

      • false: disable zoom
      • true: enable zoom ("float")
      • "fixed": fixed zoom animation to next integer zoomlevel. floating zoomlevels are not allowed (eg 14.4)
      • "float": allow floating zoomlevels [default]
      'float'
      
    cameraTerrainOffset?: number

    Specifies the vertical offset (in meters) applied to the camera above the terrain surface. This can be used to prevent the camera from intersecting with the terrain or to achieve a specific visual effect. Only relevant when a TerrainTileLayer is added to the map.

    200
    
    center?: GeoPoint

    Center coordinate of the map.

    {longitude: 8.534, latitude: 50.162}
    
    debug?: boolean

    Enables or disables the display of the debug tile grid overlay on the map.

    When set to true, a grid will be rendered to visualize the boundaries of map tiles, which is useful for debugging tile loading and rendering issues.

    false
    
    layers?: TileLayer[]

    add layers to display.

    maxLevel?: number

    the maximum zoom level the map can be zoomed in

    20
    
    maxPitch?: number

    The maximum angle in degrees the map can be pitched

    50
    
    minLevel?: number

    the minimum zoom level the map can be zoomed out

    2
    
    minPanMapThreshold?: number

    The minimum threshold in pixels to enable the pan map gesture.

    4
    
    minPitchMapThreshold?: number

    The minimum threshold in pixels to enable the pitch map gesture.

    4
    
    minRotateMapThreshold?: number

    The minimum threshold in pixels to enable the rotate map gesture.

    4
    
    pitch?: number

    initial pitch (tilt) of the map in degree.

    0
    
    rotate?: number

    initial rotation of the map in degree.

    0
    
    singleWorldView?: boolean | "both" | "latitude"

    Specifies whether the map should display the world only once at the maximum zoom-out level, and along which axes.

    • true: Restricts repetition on both the latitude (Y-axis) and longitude (X-axis).
    • false: Allows infinite repetition on both axes.
    • 'latitude': Restricts repetition only on the latitude (Y-axis), allowing infinite panning on the X-axis.
    • 'both': Restricts repetition on both latitude and longitude axes.

    When set to true or 'latitude', zooming out is limited to prevent the map from repeating, allowing it to cover the entire visible area without repetition.

    false
    
    ui?: {}

    Configure visibility and position of ui components

    zoomAnimationMs?: number

    duration of a zoom level change animation in milliseconds.

    100
    
    zoomlevel?: number

    zoomlevel of the map.

    18