TomTom Maps for JavaScript
    Preparing search index...

    Type Alias SourceWithLayerIDs

    Contains the IDs of a source and its related layers.

    This type provides a convenient way to reference a MapLibre source and all its associated layers. Using these IDs, you can customize the source and layers directly through the MapLibre API.

    Common Use Cases:

    • Accessing layers for custom styling
    • Modifying layer properties at runtime
    • Removing or updating data sources
    • Debugging layer hierarchies
    // Get source and layer IDs from a module
    const { sourceID, layerIDs } = routeModule.getSourceWithLayerIDs();

    // Update layer paint properties
    for (const layerID of layerIDs) {
    map.setPaintProperty(layerID, 'line-opacity', 0.5);
    }

    // Remove all layers and source
    layerIDs.forEach(id => map.removeLayer(id));
    map.removeSource(sourceID);
    type SourceWithLayerIDs = {
        layerIDs: string[];
        sourceID: string;
    }
    Index

    Properties

    Properties

    layerIDs: string[]

    Array of layer IDs associated with this source.

    All layers in this array use the same source. The order typically represents the rendering order, but check the actual map style for definitive ordering.

    // Hide all layers from this source
    layerIDs.forEach(id => {
    map.setLayoutProperty(id, 'visibility', 'none');
    });
    sourceID: string

    The unique identifier of the MapLibre data source.

    Use this ID to access or modify the source via MapLibre's source API.

    const source = map.getSource(sourceID);