Open Pioneer Trails Packages
    Preparing search index...

    Interface MapModel

    Represents a map.

    interface MapModel {
        get center(): Coordinate | undefined;
        get container(): HTMLElement | undefined;
        destroy(): void;
        get destroyed(): EventSource<void>;
        highlight(
            geometries: DisplayTarget[],
            options?: HighlightOptions,
        ): Highlight;
        highlightAndZoom(
            geometries: DisplayTarget[],
            options?: HighlightZoomOptions,
        ): Highlight;
        get id(): string;
        get initialExtent(): ExtentConfig | undefined;
        get layers(): LayerCollection;
        get olMap(): Map;
        get olView(): View;
        get projection(): Projection;
        removeHighlights(): void;
        get resolution(): number | undefined;
        get scale(): number | undefined;
        setScale(newScale: number): void;
        whenDisplayed(): Promise<void>;
        zoom(geometries: DisplayTarget[], options?: ZoomOptions): void;
        get zoomLevel(): number | undefined;
    }
    Index

    Accessors

    • get center(): Coordinate | undefined

      Returns the current center of the map. Same as olView.getCenter(), but reactive.

      Returns Coordinate | undefined

    • get container(): HTMLElement | undefined

      The container in which the map is currently being rendered. This is the same as the target element of the underlying OpenLayers map.

      May be undefined if the map is not being rendered at the moment. May change at runtime.

      Returns HTMLElement | undefined

    • get destroyed(): EventSource<void>

      Emitted when the map model is destroyed.

      Returns EventSource<void>

    • get layers(): LayerCollection

      Contains all known layers of this map.

      Note that not all layers in this collection may be active in the OpenLayers map. Also note that not all layers in the OpenLayers map may be contained in this collection.

      Returns LayerCollection

    • get olView(): View

      Returns the current view of the OpenLayers map.

      Returns View

    • get projection(): Projection

      Returns the current projection of the map (reactive).

      Returns Projection

    • get resolution(): number | undefined

      Returns the current resolution of the map. Same as olView.getResolution(), but reactive.

      Returns number | undefined

    • get scale(): number | undefined

      Returns the current scale of the map.

      The scale is a value derived from the current center, resolution and projection of the map. The scale will change when the map is zoomed in our out, but depending on the projection, it may also change when the map is panned.

      NOTE: Technically, this is the denominator of the current scale. In order to display it, use a format like 1:${scale}.

      Returns number | undefined

    • get zoomLevel(): number | undefined

      Returns the current zoom level of the map. Same as olView.getZoom(), but reactive.

      Returns number | undefined

    Methods

    • Destroys this objects, including all layers, highlights and the OL map itself.

      Returns void

    • Removes any existing highlights from the map.

      Returns void

    • Changes the current scale of the map to the given value.

      Internally, this computes a new zoom level / resolution based on the scale and the current center. The new resolution is then applied to the current olView.

      See also scale.

      Parameters

      • newScale: number

      Returns void

    • Returns a promise that resolves when the map has mounted in the DOM.

      Returns Promise<void>