Open Pioneer Trails Packages
    Preparing search index...

    Interface MapModel

    Represents a map.

    interface MapModel {
        get attributionItems(): AttributionItem[];
        get center(): Coordinate | undefined;
        get container(): HTMLElement | undefined;
        destroy(): void;
        get destroyed(): EventSource<void>;
        getCenterPointResolution(): number | undefined;
        getViewResolutionForScale(
            scale: number,
            targetDpi?: number,
        ): number | undefined;
        highlight(
            geometries: DisplayTarget[],
            options?: HighlightOptions,
        ): Highlight;
        highlightAndZoom(
            geometries: DisplayTarget[],
            options?: HighlightZoomOptions,
        ): Highlight;
        get highlights(): Highlights;
        get id(): string;
        get initialExtent(): ExtentConfig | undefined;
        get layers(): LayerCollection;
        get loading(): boolean;
        get olMap(): Map;
        get olView(): View;
        get overlays(): Overlays;
        get projection(): Projection;
        removeHighlights(): void;
        get resolution(): number | undefined;
        get rotation(): number | undefined;
        get scale(): number | undefined;
        setScale(newScale: number): void;
        get viewport(): HTMLElement;
        whenDisplayed(): Promise<void>;
        zoom(displayTargets: DisplayTarget[], options?: ZoomOptions): void;
        get zoomLevel(): number | undefined;
    }
    Index
    • 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 resolution(): number | undefined

      Returns the current view resolution of the map, in projection units per pixel. Same as olView.getResolution(), but reactive.

      NOTE: This is only a distance in meters if the map's projection uses meters as its unit. Use getCenterPointResolution to obtain meters per pixel for any projection.

      Returns number | undefined

    • get rotation(): number | undefined

      Returns the current rotation of the map. Same as olView.getRotation(), 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}. The value is rounded to an integer, since it is intended for display.

      Returns number | undefined

    • get zoomLevel(): number | undefined

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

      Returns number | undefined

    • Returns the point resolution at the current map center, in meters per pixel.

      Unlike resolution (which is in projection units per pixel), this is a real world distance for every projection. It is derived from the current resolution, projection and center of the map, and therefore also changes when the map is panned.

      Returns undefined while the map has no resolution or center yet.

      Returns number | undefined

    • Computes the view resolution (in projection units per pixel) needed to display the map at the given scale around the current map center.

      The result can be passed to olView.setResolution(); see also setScale.

      Returns undefined while the map has no center yet.

      Parameters

      • scale: number

        The target scale (the denominator, i.e. 1:${scale}).

      • OptionaltargetDpi: number

        Optional pixel density, for computing a resolution for an output medium other than the screen. Defaults to DEFAULT_DPI (~90.71), the standardized screen dpi.

      Returns number | undefined

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

      Internally, this computes the view resolution for the given scale and the current center (see getViewResolutionForScale) and applies it to the current olView.

      Reading scale afterwards returns the given value again, rounded to an integer.

      Parameters

      • newScale: number

      Returns void