mapbox / mapbox/mapbox-maps-flutter
Is there a way to move location puck to other lat/lng
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
I was wondering if there is a way to move the location puck. I am having a line on the map. When the position is near this line I would like to snap it to the line.
This snippet fetches the location of the puck, but I could not find a way to change the location.
try {
if (Platform.isAndroid) {
layer =
await mapboxMap?.style.getLayer('mapbox-location-indicator-layer');
} else {
layer = await mapboxMap?.style.getLayer('puck');
}
} catch (e) {
developer.log(e.toString());
}
if (layer == null) return;
var location = (layer as LocationIndicatorLayer).location;
Currently I solve this issue to use a pointAnnotationManager to add an annotation to act as the location puck and move it around. However the "real" puck looks a lot better and it would save a lot of calculation.
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 from the platform-specific map style layer lookups for mapbox-location-indicator-layer on Android and puck elsewhere, and inspect the LocationIndicatorLayer.location usage shown in the issue. Determine the supported way to provide a replacement latitude/longitude, with completion meaning the real location puck can be moved to the requested coordinates instead of using a point annotation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100