GeoLeaf Core API - v3.19.0
    Preparing search index...

    Function setBaseLayer

    • Activates a registered basemap.

      The switch takes one of two paths depending on the target: raster→raster mutates the current style in place (a WMTS basemap fetches its GetCapabilities first), while anything involving a vector basemap goes through a full setStyle() — except between two vector basemaps that share one style and one credit, where the style already on the map is kept and only what differs between them is applied. Either way the work is deferred until the style is loaded — re-tested on styledata, sourcedata and idle, never on the one-shot load —, so the active key is not guaranteed to have changed by the time this returns. The last call wins: a deferred activation is dropped by any later call that asks for another basemap, the active one included.

      An unknown or missing key logs a warning and leaves the current basemap in place.

      Parameters

      • key: string

        Key of a previously registered basemap.

      • options: SetBaseLayerOptions = {}

        silent suppresses the geoleaf:basemap:change event.

      Returns void

      GeoLeaf.Baselayers.setBaseLayer("street");