XYZ Maps Documentation
    Preparing search index...

    Class CustomLayer

    The CustomLayer can be used to integrate custom renderers to the map display.

    Hierarchy (View Summary)

    Index
    id: string

    The identifier of the Layer.

    max: number

    maximum zoom level at which data from the Layer will be displayed.

    min: number

    minimum zoom level at which data from the Layer is displayed.

    name: string = ''

    The name of the Layer

    renderOptions: { mode?: string; zIndex?: number; zLayer?: number }

    Options to configure the renderer.

    Type Declaration

    • Optionalmode?: string

      The used rendering mode. Use '2d' for traditional flat map layers that are located on the ground-plane, otherwise '3d'.

      @DefaultValue: '2d'

    • OptionalzIndex?: number

      Indicates the drawing order within the layer. Styles with larger zIndex value are rendered above those with smaller values. The zIndex is defined relative to the "zLayer" property. If "zLayer" is defined all zIndex values are relative to the "zLayer" value.

    • OptionalzLayer?: number

      Indicates drawing order across multiple layers. Styles using zLayer with a high value are rendered on top of zLayers with a low value. If no zLayer is defined the zLayer depends on the display layer order. The first (lowest) layer has a zLayer value of 1.

      {...zLayer: 2, zIndex: 5} will be rendered on top of {...zLayer: 1, zIndex: 10}
      
    • Checks whether the xyz-maps tile layer is currently visible.

      Returns boolean

      • Returns true if the layer is visible, otherwise false.
      if (layer.isVisible()) {
      console.log("Layer is visible");
      } else {
      console.log("Layer is not visible");
      }
    • Checks whether the xyz-maps tile layer is currently visible.

      Parameters

      • OptionalzoomLevel: number

      Returns boolean

      • Returns true if the layer is visible, otherwise false.
      if (layer.isVisible()) {
      console.log("Layer is visible");
      } else {
      console.log("Layer is not visible");
      }
    • Event Listener that will be called when the layer is added to the display.

      Parameters

      • ev: CustomEvent

        Event of type "layerAdd"

      Returns void

    • Event Listener that will be called when the layer is removed from the display.

      Parameters

      • ev: CustomEvent

        Event of type "layerRemove"

      Returns void

    • The render function will be called each frame. It enables seamless drawing into the rendering context of the map. The context states are correctly set already to allow "simple" drawing at the respective zIndex/zLayer. The camera matrix projects from the world coordinate system (WebMercator projected, topLeft [0,0] -> bottomRight [1,1]) to the clipspace.

      Parameters

      • context: WebGLRenderingContext | CanvasRenderingContext2D

        the rendering context of the map.

      • matrix: Float64Array

        the camera matrix of the map.

      Returns void

    • Sets the visibility of the Layer.

      This function controls whether the tile layer is currently displayed or hidden.

      Parameters

      • OptionalisVisible: boolean

        A boolean value indicating whether the tile layer should be visible (true) or hidden (false).

      Returns void

      • The current visibility state of the tile layer.
      // Create a new tile layer
      let tileLayer = new XYZMapsTileLayer();

      // Hide the tile layer
      tileLayer.visible(false);

      // Show the tile layer
      tileLayer.visible(true);