mapbox / mapbox/mapbox-maps-flutter

Is there a way to move location puck to other lat/lng

Open
#538 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.