MapLibre Style Layer Identifiers (src/style-layer-ids.ts)

GeoLibre · packages/map/src/style-layer-ids.ts · typescript · MIT
ui, integration, tag:gis, tag:utility

Provides a standardized naming scheme for MapLibre style layers and sources. Use this to maintain consistency when dynamically managing map layers across different plugins or test suites.

// Source: https://github.com/opengeos/GeoLibre | License: MIT | Copyright 2026 Qiusheng Wu
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * The MapLibre source and style layer ids `syncLayers` derives for a store layer.
 *
 * Kept apart from `geojson-loader` (and so from the package index, which pulls in
 * MapLibre and its stylesheet) so the plugins package and the frontend test suite
 * can import the id scheme on its own -- the same reason `pmtiles-layer` is split
 * out. `geojson-loader` re-exports everything here, so every existing import path
 * still resolves.
 */

export function sourceId(layerId: string): string {
  return `source-${layerId}`;
}

/**
 * The prefix every MapLibre style layer id `syncLayers` derives for a store
 * layer shares (`layer-<id>-…`

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key