maplibre / maplibre/maplibre-plugins-android

MapLibre Android: Using textField on SymbolLayer/SymbolOptions makes the symbol invisible.

Open
#60 24 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-more-info
Dominant language
Java
Stars
50
Forks
33
PR merge metrics
No merged PRs in 30d

Description

Using the SymbolManager or SymbolLayer to display symbols is working fine, but as soon as I add the textField property, it breaks the symbol and it no longer appears.

I have read several past issues similar to this where people have said it's related to the font, but I just want to use the default font and can't even figure out a way to change where the font is coming from, just the textFont property that wants the font name.

I am using the default Style Builder:
```kotlin
mapboxMap.setStyle(Style.Builder())
```

This is how I'm adding the source & layer (from a custom waypoint class):
```kotlin
val identifier = waypoint.icon().id()
val feature = Feature.fromGeometry(Point.fromLngLat(waypoint.backing.longitude, waypoint.backing.latitude))
val point = FeatureCollection.fromFeature(feature)
val source = GeoJsonSource(identifier, point)
val symbolLayer = SymbolLayer(GPMapLayers.WAYPOINTS.layerID + waypoint.uuid, identifier).withProperties(
PropertyFactory.iconImage(identifier),
PropertyFactory.textField(waypoint.title()),
PropertyFactory.textSize(12f),
PropertyFactory.textColor("#000000")
)

style.addSource(source)
style.addLayer(symbolLayer)
```

I have also tried passing "sans-serif" (the default Android font as well as the default font for MapLibre Android), as well as Open Sans Regular & Arial Unicode MS Regular, the defaults for MapBox.

I was using an older version of MapLibre Android, but updated to Version 11 to try and fix the problem. With the older version, I was using a SymbolManager to add the symbols to the map, but it appears MapLibre 11 doesn't support the Annotation Plugin. Is this the case, or am I missing something?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Style.Builder, SymbolLayer, SymbolManager, and textField setup shown in the issue, then verify the behavior on MapLibre Android version 11. Compare the font configuration and annotation-plugin support described in the report. Done means identifying why adding textField hides the symbol and documenting or resolving the behavior with a reproducible result.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.