Open Pioneer Trails Packages
    Preparing search index...

    Interface LayerCollection

    Contains the layers known to a MapModel.

    interface LayerCollection {
        activateBaseLayer(id: undefined | string): boolean;
        addLayer(layer: Layer, options?: AddLayerOptions): void;
        getActiveBaseLayer(): undefined | Layer;
        getAllLayers(options?: LayerRetrievalOptions): Layer[];
        getBaseLayers(): Layer[];
        getItems(options?: LayerRetrievalOptions): Layer[];
        getLayerById(id: string): undefined | AnyLayer;
        getLayerByRawInstance(olLayer: BaseLayer): undefined | Layer;
        getLayers(options?: LayerRetrievalOptions): Layer[];
        getOperationalLayers(options?: LayerRetrievalOptions): Layer[];
        getRecursiveLayers(
            options?: Omit<RecursiveRetrievalOptions, "filter"> & {
                filter?: "base" | "operational" | ((layer: AnyLayer) => boolean);
            },
        ): AnyLayer[];
        removeLayerById(id: string): void;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Activates the base layer with the given id. undefined can be used to hide all base layers.

      The associated layer is made visible and all other base layers are hidden.

      Returns true if the given layer has been successfully activated.

      Parameters

      • id: undefined | string

      Returns boolean

    • Adds a new layer to the map.

      The new layer is automatically registered with this collection.

      NOTE: by default, the new layer will be shown on top of all existing layers. Use the options parameter to control the insertion point.

      Parameters

      Returns void

    • Returns a list of layers known to this collection. This includes base layers and operational layers. The returned list includes top level layers only. Use () to retrieve (nested) child layers.

      Parameters

      Returns Layer[]

      Use (), () or () instead. This method name is misleading since it does not recurse into child layers.

    • Returns the layer identified by the id or undefined, if no such layer exists.

      Parameters

      • id: string

      Returns undefined | AnyLayer

    • Given a raw OpenLayers layer instance, returns the associated Layer - or undefined if the layer is unknown to this collection.

      Parameters

      • olLayer: BaseLayer

      Returns undefined | Layer

    • Returns a list of all layers in this collection, including all children (recursively).

      Note: This includes base layers by default (see options.filter). Use the "base" or "operational" short hand values to filter by base layer or operational layers.

      If the layer hierachy is deeply nested, this function could potentially be expensive.

      Parameters

      Returns AnyLayer[]

    • Removes a layer identified by the id from the map.

      NOTE: The current implementation only supports removal of top level layers.

      Parameters

      • id: string

      Returns void