For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Class MaptilerGeolocateControlMaptiler

The MaptilerGeolocateControl is an extension of the original GeolocateControl with a few changes. In this version, the active mode persists as long as the location is still centered. This means it's robust to rotation, pitch and zoom.

Hierarchy (View Summary)

Index

Constructors

Properties

Methods

  • Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.

    Parameters

    Returns boolean

    true if there is at least one registered listener for specified event type, false otherwise

  • Register a control on the map and give it a chance to register event listeners and resources. This method is called by Map.addControl internally.

    Parameters

    • map: MapMLGL

      the Map this control will be added to

    Returns HTMLElement

    The control's container element. This should be created by the control and returned by onAdd without being attached to the DOM: the map will insert the control's element into the DOM as necessary.

  • Programmatically request and move the map to the user's location.

    Returns boolean

    false if called before control was added to a map, otherwise returns true.

    // Initialize the geolocate control.
    let geolocate = new GeolocateControl({
     positionOptions: {
       enableHighAccuracy: true
     },
     trackUserLocation: true
    });
    // Add the control to the map.
    map.addControl(geolocate);
    map.on('load', () => {
      geolocate.trigger();
    });
    
Was this helpful?