mapbox / mapbox/mapbox-maps-flutter
Marker Location Inaccuracy and Size Scaling Issue with Zoom
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
I’m experiencing two issues while using the Mapbox Flutter plugin:
-
Marker Location Inaccuracy on Zoom: The marker appears to shift from its original position when zooming in on the map.
-
Marker Size Scaling: The custom marker appears disproportionately large when zooming in, which I would like to adjust to be proportional to the zoom level.
Issues:
1. Marker Location Shifting:
When I add a custom marker using PointAnnotationManager with specific latitude and longitude coordinates, the marker's position is accurate initially. However, as I zoom in (either programmatically or by pinching), the marker location shifts and becomes increasingly inaccurate at higher zoom levels.
2. Marker Size Issue:
I’m using custom markers with numbers displayed on them, and while zooming in, the marker's size becomes excessively large. I would like the marker to scale in proportion to the zoom level, so it appears smaller at higher zoom levels and maintains consistent size relative to the map zoom.
Steps to Reproduce:
- Initialize the
MapboxMapand set the camera center withCameraOptionsat specific coordinates. - Add a custom marker using
PointAnnotationManagerat a set latitude and longitude. - Zoom in on the map (via pinch zoom or programmatically).
- Observe:
- The marker location shifts as the zoom level increases.
- The custom marker becomes much larger as you zoom in, despite the size being set.
Expected Behavior:
- Marker Location: The marker should stay fixed at the set coordinates, even when zooming in or out.
- Marker Size: The size of the marker should scale proportionally to the zoom level, remaining smaller at higher zoom levels and larger at lower zoom levels.
Actual Behavior:
- The marker’s position becomes inaccurate as you zoom in, and it shifts away from its original position.
- The custom marker grows disproportionately in size when zooming in, despite setting an
iconSizeproperty.
Code Snippet:
PointAnnotationOptions pointAnnotationOptions = PointAnnotationOptions(
geometry: Point(
coordinates: Position(
markerPos['lng']!,
markerPos['lat']!,
),
),
image: markerImage,
iconSize: 0.25, // This value should scale with zoom
);
// Create annotation
PointAnnotation? annotation = await pointAnnotationManager?.create(pointAnnotationOptions);
Questions:
- How can I ensure that the marker stays at the correct coordinates when zooming in or out?
- Is there a way to scale the marker size dynamically based on the zoom level, so it doesn't become too large when zooming in?
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 behavior with MapboxMap, CameraOptions, PointAnnotationManager, and PointAnnotationOptions using the provided coordinates and iconSize. Compare the marker position and rendered size across pinch and programmatic zoom, then check the Flutter plugin's annotation and camera behavior. Done means the marker remains at its coordinates and its size follows the stated zoom expectations, with regression coverage if the project provides a relevant test location.
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