mapbox-maps-flutter
mapbox-maps-flutter copied to clipboard
Is there a way to move location puck to other lat/lng
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.