mapbox-maps-flutter
mapbox-maps-flutter copied to clipboard
Point annotations disapear when zooming out
Hello, When i zoom out my pointannotaions dissapear, when i zoom in again they show up once again. Im currently testing on IOS. Do i do something wrong here?
The following code, is what i use for making the points at the moment:
_onMapCreated(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
mapboxMap.annotations.createPointAnnotationManager().then((value) async {
pointAnnotationManager = value;
final ByteData bytes =
await rootBundle.load('assets/images/onboarding0.png');
final Uint8List list = bytes.buffer.asUint8List();
pointAnnotationManager?.setIconAllowOverlap(true);
pointAnnotationManager?.setIconIgnorePlacement(true);
createEventAnnotations();
pointAnnotationManager?.addOnPointAnnotationClickListener(
AnnotationClickListener(context, events, mapboxMap));
});
}
List<Event> events = [
Event(
id: '1',
holderName: 'Pizza Boys',
address: 'husene, 2',
title: 'Spis min gris',
tags: 'food',
description: 'Lækker skinke!',
imageUrls: ['http://example.com/image1.jpg'],
latitude: 56.1685,
longitude: 10.2134,
),]
void createEventAnnotations() async {
final ByteData bytes =
await rootBundle.load('assets/images/onboarding0.png');
final Uint8List list = bytes.buffer.asUint8List();
List<PointAnnotationOptions> annotationOptions = events.map((event) {
return PointAnnotationOptions(
geometry: Point(
coordinates:
TurfPosition.Position(event.longitude, event.latitude)),
textField: event.title,
textOffset: [0.0, -4.0],
textColor: Colors.red.value,
iconSize: 0.3,
iconOffset: [0.0, -5.0],
symbolSortKey: 10.0,
image: list,
);
}).toList();
pointAnnotationManager?.createMulti(annotationOptions);
}
https://github.com/mapbox/mapbox-maps-flutter/assets/55810497/8dec1d56-542e-490d-95fb-02fa6892859b
Hi @Mowglli, you can read about symbol placement optimization here: Mapbox - Optimize map label placement.
@evil159 - Thank you, i'll have a read. It works as intended on Android.
Hey @evil159! I have a similar issue (occurring on both Android and iOS): when zooming out the map, all the point annotations (polyline works fine 🤔) blink. It doesn't happen when zooming in, though. I've noticed it happens mostly when the map changes its level of detail (by hiding internal streets and smaller cities' names). Do you have any ideas?
Hello, When i test on a physical device it works. Apparrently its just in simulator it dissapears
Venlig hilsen Jesper Egsgaard Nielsen On 6 Nov 2024 at 12.07 +0100, Gabriel Samojło @.***>, wrote:
Hey @evil159! I have a similar issue (occurring on both Android and iOS): when zooming out the map, all the point annotations (polyline works fine 🤔) blink. It doesn't happen when zooming in, though. I've noticed it happens mostly when the map changes its level of detail (by hiding internal streets and smaller cities' names). Do you have any ideas? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>