Classdesc

An element to be displayed over the map and attached to a single map location. Like ol.control.Control, Overlays are visible widgets. Unlike Controls, they are not in a fixed position on the screen, but are tied to a geographical coordinate, so panning the map will move an Overlay but not a Control.

Example:

var popup = new ol.Overlay({
element: document.getElementById('popup')
});
popup.setPosition(coordinate);
map.addOverlay(popup);

Param: options

Overlay options.

Api

stable

Hierarchy

Constructors

  • Parameters

    Returns Overlay

    Classdesc

    An element to be displayed over the map and attached to a single map location. Like ol.control.Control, Overlays are visible widgets. Unlike Controls, they are not in a fixed position on the screen, but are tied to a geographical coordinate, so panning the map will move an Overlay but not a Control.

    Example:

    var popup = new ol.Overlay({
    element: document.getElementById('popup')
    });
    popup.setPosition(coordinate);
    map.addOverlay(popup);

    Api

    stable

Methods

  • Increases the revision counter and dispatches a 'change' event.

    Returns void

    Api

  • Dispatches an event and calls all listeners listening for events of this type. The event parameter can either be a string or an Object with a type property.

    Parameters

    Returns void

    Function

    Api

  • Gets a value.

    Parameters

    • key: string

      Key name.

    Returns any

    Value.

    Api

    stable

  • Get the DOM element of this overlay.

    Returns Element

    The Element containing the overlay.

    Observable

    Api

    stable

  • Get the overlay identifier which is set on constructor.

    Returns string | number

    Id.

    Api

  • Get a list of object property names.

    Returns string[]

    List of property names.

    Api

    stable

  • Get the map associated with this overlay.

    Returns Map

    The map that the overlay is part of.

    Observable

    Api

    stable

  • Get the offset of this overlay.

    Returns number[]

    The offset.

    Observable

    Api

    stable

  • Get the current position of this overlay.

    Returns Coordinate

    The spatial point that the overlay is anchored at.

    Observable

    Api

    stable

  • Get the current positioning of this overlay.

    Returns OverlayPositioning

    How the overlay is positioned relative to its point on the map.

    Observable

    Api

    stable

  • Get an object of all property names and values.

    Returns {
        [k: string]: any;
    }

    Object.

    • [k: string]: any

    Api

    stable

  • Get the version number for this object. Each time the object is modified, its version number will be incremented.

    Returns number

    Revision.

    Api

  • Listen for a certain type of event.

    Parameters

    • type: string | string[]

      The event type or array of event types.

    • listener: Function

      The listener function.

    • Optional opt_this: Object

      The object to use as this in listener.

    Returns Object | Object[]

    Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.

    Api

    stable

  • Listen once for a certain type of event.

    Parameters

    • type: string | string[]

      The event type or array of event types.

    • listener: Function

      The listener function.

    • Optional opt_this: Object

      The object to use as this in listener.

    Returns Object | Object[]

    Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.

    Api

    stable

  • Sets a value.

    Parameters

    • key: string

      Key name.

    • value: any

      Value.

    • Optional opt_silent: boolean

      Update without triggering an event.

    Returns void

    Api

    stable

  • Set the DOM element to be associated with this overlay.

    Parameters

    • element: Element

      The Element containing the overlay.

    Returns void

    Observable

    Api

    stable

  • Set the map to be associated with this overlay.

    Parameters

    • map: Map

      The map that the overlay is part of.

    Returns void

    Observable

    Api

    stable

  • Set the offset for this overlay.

    Parameters

    • offset: number[]

      Offset.

    Returns void

    Observable

    Api

    stable

  • Set the position for this overlay. If the position is undefined the overlay is hidden.

    Parameters

    • position: Coordinate

      The spatial point that the overlay is anchored at.

    Returns void

    Observable

    Api

    stable

  • Set the positioning for this overlay.

    Parameters

    • positioning: OverlayPositioning

      how the overlay is positioned relative to its point on the map.

    Returns void

    Observable

    Api

    stable

  • Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).

    Parameters

    • values: {
          [k: string]: any;
      }

      Values.

      • [k: string]: any
    • Optional opt_silent: boolean

      Update without triggering an event.

    Returns void

    Api

    stable

  • Unlisten for a certain type of event.

    Parameters

    • type: string | string[]

      The event type or array of event types.

    • listener: Function

      The listener function.

    • Optional opt_this: Object

      The object which was used as this by the listener.

    Returns void

    Api

    stable

  • Removes an event listener using the key returned by on() or once(). Note that using the ol.Observable.unByKey static function is to be preferred.

    Parameters

    • key: Object | Object[]

      The key returned by on() or once() (or an array of keys).

    Returns void

    Function

    Api

    stable

  • Unsets a property.

    Parameters

    • key: string

      Key name.

    • Optional opt_silent: boolean

      Unset without triggering an event.

    Returns void

    Api

    stable

  • Removes an event listener using the key returned by on() or once().

    Parameters

    • key: Object | Object[]

      The key returned by on() or once() (or an array of keys).

    Returns void

    Api

    stable

Generated using TypeDoc