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

    A layer definition, in the shape a profile's layer entry carries.

    This is deliberately the SAME object an integrator already writes in a profile — id and an optional label, then a source (url, dataFile, or a data block), plus the optional style, clustering, geometry and per-layer capability blocks. It is declared here rather than invented so that a layer created at runtime and a layer declared in a profile are described by one contract, and so the JSON Schema that validates profiles keeps describing both.

    Only id is required, exactly as in the profile schema; every other key is optional and reaches the loader untouched.

    interface LayerDefinition {
        id: string;
        label?: string;
        url?: string;
        dataFile?: string;
        inlineData?: unknown;
        data?: Record<string, unknown>;
        styles?: Record<string, unknown>;
        labels?: {
            enabled: boolean;
            field?: string;
            visibleByDefault?: boolean;
            [key: string]: unknown;
        };
        showInLayerManager?: boolean;
        themeable?: boolean;
        searchable?: { fields: string[] };
        clustering?: Record<string, unknown>;
        geometry?: string;
        plugin?: string;
        active?: boolean;
        [key: string]: unknown;
    }

    Indexable

    • [key: string]: unknown
    Index
    id: string

    Unique layer identifier.

    label?: string

    Display label; falls back to id when absent.

    url?: string

    Absolute or origin-relative URL of the layer's GeoJSON.

    dataFile?: string

    Profile-relative data file, resolved against the active profile.

    inlineData?: unknown

    Raw source data supplied by the caller, INSTEAD of a URL to resolve — the same shape a fetched url would yield (it goes through the same mapping and conversion). Supplying it makes url/dataFile unnecessary.

    🛑 RUNTIME-ONLY, and this is the one key of this interface that a profile may NOT carry. The interface's contract is that a runtime layer and a profile layer are described once; this key is the deliberate exception, and the motive is that a profile is a static document — a payload inlined there would be data frozen into configuration, which is the defect dataFile exists to avoid. ⚠️ The exception is mechanical, not merely documented: layers.schema.json declares the layer object additionalProperties: false, so a profile carrying this key fails validation rather than silently working.

    📌 Consumed once and not retained: the loader deletes its internal copy after conversion, so a large collection is not held by the stored layer definition.

    data?: Record<string, unknown>

    Data-source block (dataUrl, vectorTiles, directory…).

    styles?: Record<string, unknown>

    Style references (default, available, directory).

    labels?: {
        enabled: boolean;
        field?: string;
        visibleByDefault?: boolean;
        [key: string]: unknown;
    }

    Map labels declared on the layer itself — the same object, with the same meaning, as a style file's label (enabled required; field, visibleByDefault, font, color, opacity, buffer, offset). A style that carries its own label object keeps priority; this block applies otherwise, including when the default style file is missing. visibleByDefault defaults to false, as in a style file. Since 3.7.0.

    showInLayerManager?: boolean

    false keeps the layer out of the layer manager, and out of it only: the layer still loads, follows its theme's visibility, keeps its legend and stays drivable through GeoLeaf.GeoJSON.showLayer / hideLayer. It is simply not offered as a toggle — for a snapping support or a computation layer. Absent or true lists it. Since 3.9.0.

    themeable?: boolean

    false puts the layer out of the themes' reach: applying a theme neither hides it for not listing it nor changes its visibility or style when it lists it. For a technical layer whose visibility no theme decides (a clustering support, a computation layer). Its visibility stays drivable through GeoLeaf.GeoJSON.showLayer / hideLayer. Absent or true: the themes drive it. Since 3.19.0.

    searchable?: { fields: string[] }

    Makes the layer findable by GeoLeaf.Layers.search, on the feature's id and on the listed fields — property names, bare ("ref") or dotted ("properties.ref"). A layer without this block is never searched. Since 3.10.0.

    clustering?: Record<string, unknown>

    Point-clustering configuration.

    geometry?: string

    Geometry type, when it cannot be inferred from the features.

    plugin?: string

    Id of the plugin that renders this layer, when it is plugin-backed.

    active?: boolean

    false skips the layer, as in a profile.