Skip to content

Add configurable text-field property for symbol layers#326

Merged
birkskyum merged 1 commit intomaplibre:mainfrom
birkskyum:custom-source
Feb 19, 2026
Merged

Add configurable text-field property for symbol layers#326
birkskyum merged 1 commit intomaplibre:mainfrom
birkskyum:custom-source

Conversation

@birkskyum
Copy link
Member

@birkskyum birkskyum commented Feb 19, 2026

Add configurable text-field property for symbol layers, allowing style definitions to specify which feature property to use for label text (e.g. "name", "name:en", "ref"), instead of the previously hardcoded "name".

💻 Examples

In the style definition, symbol layers can now specify text-field:

{
  "type": "symbol",
  "paint": {
    "text-field": "name"
  }
}

The property flows through: StyleLayer → process_vector → TextTessellatorNew::new(text_field) → PropertyProcessor::property() which matches the configured field name when reading tile features.

🚨 Test instructions

Run cargo run -p maplibre-demo -- headed . Labels should render using the feature property specified by text-field in the style. Changing the value (e.g. to "name:en" or a non-existent field) should change which labels appear.

E.g. in mod.ts, if you change:

// mod.ts 148:159
                StyleLayer {
                    index: 9,
                    id: "text".to_string(),
                    maxzoom: None,
                    minzoom: None,
                    metadata: None,
                    paint: Some(LayerPaint::Symbol(SymbolPaint {
                        text_field: Some("name:en".to_string()), // <- name:en or name:da will control label language
                    })),
                    source: None,
                    source_layer: Some("place".to_string()),
                },

name:da - København

Screenshot 2026-02-19 at 01 37 46

name:en - Copenhagen

Screenshot 2026-02-19 at 01 39 20

@birkskyum birkskyum mentioned this pull request Feb 19, 2026
7 tasks
@birkskyum birkskyum merged commit 6942370 into maplibre:main Feb 19, 2026
12 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant