Skip to content

SymbolLayer labels are not rendered #3939

@jcortega1234

Description

@jcortega1234

MapLibre Android Version

'org.maplibre.gl:android-sdk:11.0.0'.

Android SDK Version

Android 15

Device

Samsung Galaxy Tab A9

What happened?

Labels from a SymbolLayer are not being rendered on the map under certain conditions, even when using a simple literal() for the textField. Other layer types like FillLayer and CircleLayer from the same VectorSource render correctly. The issue seems to be specific to the rendering of SymbolLayer.

Steps to reproduce

Create a new Android project using the "Empty Views Activity" template (important: not the Jetpack Compose template).
Add the MapLibre Android SDK dependency: implementation 'org.maplibre.gl:android-sdk:11.0.0'.
Add a MapView to the activity_main.xml layout.
In MainActivity.kt, on the onMapReady callback, set a style and add a VectorSource pointing to a public vector tile service (e.g., GeoServer).
Add a SymbolLayer that uses this source and a specific source-layer.
Set the textField property of the SymbolLayer to a hardcoded literal value, like PropertyFactory.textField(literal("TEST")).
Run the application on an Android Emulator with a standard configuration (e.g., Pixel 7, API 33).
Expected behavior: The map displays, and the "TEST" labels appear over the corresponding features.
Actual behavior: The map displays, other layers (polygons, circles) are visible, but the "TEST" labels from the SymbolLayer do not appear.

Renderer

No response

Relevant log output

// Minimal function to demonstrate the issue
fun addTestLabelLayer(): List<Layer> {
    val sourceId = "geoserver-vectores" // A valid VectorSource ID
    val sourceLayerId = "t_depositos"    // A valid source-layer from the tiles

    val labelLayer = SymbolLayer("test-labels", sourceId).apply {
        sourceLayer = sourceLayerId
        setProperties(
            // Using a literal value to rule out data issues
            PropertyFactory.textField(literal("TEST LABEL")),
            PropertyFactory.textSize(20f),
            PropertyFactory.textColor("#FF0000"),
            // Forcing the label to be drawn
            PropertyFactory.textAllowOverlap(true),
            PropertyFactory.textIgnorePlacement(true)
        )
    }
    return listOf(labelLayer)
}

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions