mapbox / mapbox/mapbox-maps-flutter
Symbols not showing on Map when offline
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
I have a map where I add a symbol layer like so:
```
await mapboxMap.style.addLayer(
SymbolLayer(
id: '${zone.id}_symbol_layer',
sourceId: geoJsonSourceId,
textField: zone.name,
textColor: Colors.black.value,
textHaloColor: Colors.white.value,
textHaloWidth: 3,
textSize: 18,
symbolSortKey: 10,
),
);
```
I also then add symbols via the PointAnnotationManager when a user selects a point on the map:
```
final bytes =
await rootBundle.load('assets/images/default_map_marker.png');
final list = bytes.buffer.asUint8List();
final pointAnnotation = await pointAnnotationManager.create(
PointAnnotationOptions(
geometry: Point(coordinates: Position(lng, lat)),
textField: numWildlife.toString(),
textOffset: [0.0, 0.0],
textColor: Colors.black.value,
textHaloColor: Colors.white.value,
textHaloWidth: 3,
textSize: 18,
iconSize: 3,
iconOffset: [0.0, -5.0],
symbolSortKey: 10,
image: list,
),
);
return pointAnnotation.id;
```
Online all of this works as expected. However when offline (I have downloaded the map tiles successfully) the symbols are not showing. Other Line and Fill layers are showing as expected however. When calling `pointAnnotationManager.create` a `pointAnnotation` is being returned successfully and no errors are being thrown.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the shown SymbolLayer and PointAnnotationManager setup after downloading map tiles, then compare offline symbol rendering with the Line and Fill layers that work. Done means both kinds of symbols render offline without errors and the annotation creation still succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100