Class Markers

API to control adding 2D markers to the scene.

Hierarchy

  • Markers

Accessors

  • get markers(): Marker[]
  • An array of Marker instances that currently exist.

    Returns Marker[]

Methods

  • Create a new Marker, containing some HTML, at the specified position.

    mapView.Markers.add(coordinate, `
    <div
    id="my-marker"
    style="width:100px;height:40px;background:red;"
    >
    My Marker
    </div>
    `);

    Parameters

    Returns Marker

    The Marker object that was created.

  • Moves an existing Marker to a new position smoothly over time.

    const marker = mapView.Markers.add(...);

    // Animate the marker to a new coordinate over 500ms
    mapView.Markers.animate(marker, newCoordinate, {
    duration: 500
    });

    Parameters

    Returns Promise<void>

  • Removes an existing Marker.

    const marker = mapView.Markers.add(...);

    ...

    // The marker is no longer needed
    mapView.Markers.remove(marker);

    Parameters

    • markerOrMarkerId: string | Marker

      the Marker to be removed.

    Returns void

  • Remove all Marker instances from all maps.

    mapView.Markers.removeAll();
    

    Returns void

  • Moves an existing Marker to a new position instantaneously. See also animate.

    const marker = mapView.Markers.add(...);

    // Move the marker to a new coordinate
    mapView.Markers.setPosition(marker, newCoordinate);

    Parameters

    Returns void