# Show location on map

Last updated:

<!-- -->

November 2, 2026

<!-- -->

\| 7 minutes read

<br />

<br />

The device location is shown by default using an arrow position tracker. When `setLiveDataSource` is successfully set and permissions are granted, the position tracker appears on the map as an arrow.

![Default position tracker showing current position](/docs/flutter/assets/images/example_flutter_position_default-2186c936d7348e9b661554007cdf4265.png)

**Default position tracker showing current position**

Multiple position trackers on the map are not currently supported.

info

GPS accuracy may be limited in environments such as indoor spaces, areas with weak GPS signals, or locations with significant obstructions like narrow streets or tall buildings. In these situations, the tracker may exhibit erratic movement within a confined area. Device sensor performance, such as accelerometer and gyroscope, can further impact GPS positioning accuracy.

This behavior is more pronounced when the device is stationary.

## Follow position[​](#follow-position "Direct link to Follow position")

Call the `startFollowingPosition` method on the mapController to follow the position tracker:

```dart
mapController.startFollowingPosition();

```

When called, the camera automatically follows the movement and rotation of the position tracker, keeping the user's current location and orientation centered on the map.

The `startFollowingPosition` method accepts parameters such as `animation` (controls camera movement to the tracker position), `zoomLevel`, and `viewAngle`.

Tip

Setting `zoomLevel` and `viewAngle` via `startFollowingPosition` may behave differently than configuring them through `setZoomLevel` and `setViewAngle` on `FollowPositionPreferences`, especially in scenarios involving complex user interactions (for example, when user-modified values via touch need to be persisted). It is recommended to try both approaches and choose the one that best fits your specific use case.

### Set map rotation mode[​](#set-map-rotation-mode "Direct link to Set map rotation mode")

Rotate the map with the user orientation when following position:

```dart
final prefs = mapController.preferences.followPositionPreferences;
prefs.setMapRotationMode(FollowPositionMapRotationMode.positionHeading);

```

Use the compass sensor for map rotation with `FollowPositionMapRotationMode.compass`:

```dart
prefs.setMapRotationMode(FollowPositionMapRotationMode.compass);

```

Fix the map rotation to a given angle using `FollowPositionMapRotationMode.fixed` and providing a `mapAngle` value:

```dart
prefs.setMapRotationMode(FollowPositionMapRotationMode.fixed, mapAngle: 30);

```

A value of `0` for the `mapAngle` parameter represents north-up alignment.

The `mapRotationMode` returns a record containing:

* The current `FollowPositionMapRotationMode` mode
* The map angle set in case of `FollowPositionMapRotationMode.fixed`

### Exit follow position[​](#exit-follow-position "Direct link to Exit follow position")

Call the `stopFollowingPosition` method to programmatically stop following the position:

```dart
mapController.stopFollowingPosition();

```

Follow mode exits automatically when the user interacts with the map. Actions such as panning or tilting disable automatic tracking. Deactivate this by setting `touchHandlerExitAllow` to false (see the section below).

## Customize follow position settings[​](#customize-follow-position-settings "Direct link to Customize follow position settings")

The `FollowPositionPreferences` class customizes the behavior of following the position. Access this from the `preferences` getter of the mapController.

The fields defined in `FollowPositionPreferences` take effect only when the camera is in follow position mode. To customize camera behavior when not following the position, refer to the fields available in `MapViewPreferences` and `GemMapController`.

| Field                             | Type   | Explanation                                                                                          |
| --------------------------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| cameraFocus                       | Point  | The position on the viewport where the position tracker is located on the screen.                    |
| timeBeforeTurnPresentation        | int    | The time interval before starting a turn presentation                                                |
| touchHandlerExitAllow             | bool   | If set to false then gestures made by the user will exit follow position mode                        |
| touchHandlerModifyPersistent      | bool   | If set to true then changes made by the user using gestures are persistent                           |
| viewAngle                         | double | The viewAngle used within follow position mode                                                       |
| zoomLevel                         | int    | The zoomLevel used within follow position mode                                                       |
| accuracyCircleVisibility          | bool   | Specifies if the accuracy circle should be visible (regardless if is in follow position mode or not) |
| isTrackObjectFollowingMapRotation | bool   | Specifies if the track object should follow the map rotation                                         |

Refer to the [adjust map guide](/docs/flutter/guides/maps/adjust-map.md) for more information about the `viewAngle`, `zoomLevel`, and `cameraFocus` fields.

If no zoom level is set, a default value is used.

### Use touchHandlerModifyPersistent[​](#use-touchhandlermodifypersistent "Direct link to Use touchHandlerModifyPersistent")

When the camera enters follow position mode and manually adjusts the zoom level or view angle, these modifications are retained until the mode is exited.

If `touchHandlerModifyPersistent` is set to `true`, invoking `startFollowingPosition` (with default parameters for zoom and angle) restores the zoom level and view angle from the previous follow position session.

If `touchHandlerModifyPersistent` is set to `false`, calling `startFollowingPosition` (with default zoom and angle parameters) recalculates appropriate values for the zoom level and view angle.

Tip

Set the `touchHandlerModifyPersistent` property value right before calling the `startFollowingPosition` method.

### Use touchHandlerExitAllow[​](#use-touchhandlerexitallow "Direct link to Use touchHandlerExitAllow")

If the camera is in follow position mode and the `touchHandlerExitAllow` property is set to `true`, a two-finger pan gesture in a non-vertical direction exits follow position mode.

If `touchHandlerExitAllow` is set to false, the user cannot manually exit follow position mode through touch gestures. The mode can only be exited programmatically by calling the `stopFollowingPosition` method.

### Set circle visibility[​](#set-circle-visibility "Direct link to Set circle visibility")

Show the accuracy circle on the map (hidden by default):

```dart
FollowPositionPreferences prefs = mapController.preferences.followPositionPreferences;
GemError error = prefs.setAccuracyCircleVisibility(true);

```

![Accuracy circle turned on](/docs/flutter/assets/images/example_flutter_position_circle-93606e5623b16383fad8428ce2f6fe4a.png)

**Accuracy circle turned on**

### Customize circle color[​](#customize-circle-color "Direct link to Customize circle color")

Set the accuracy circle color using the `setDefPositionTrackerAccuracyCircleColor` static method from the `MapSceneObject` class:

```dart
final GemError setErrorCode = MapSceneObject.setDefPositionTrackerAccuracyCircleColor(Colors.red);
print("Error code for setting the circle color: $setErrorCode");

```

Tip

Use colors with partial opacity instead of fully opaque colors for improved visibility and usability.

Retrieve the current color using the `defPositionTrackerAccuracyCircleColor` static getter:

```dart
final Color color = MapSceneObject.defPositionTrackerAccuracyCircleColor;

```

Reset the color to the default value using the `resetDefPositionTrackerAccuracyCircleColor` static method:

```dart
final GemError resetErrorCode = MapSceneObject.resetDefPositionTrackerAccuracyCircleColor();
print("Error code for resetting the circle color: $resetErrorCode");

```

### Set position of the position tracker on the viewport[​](#set-position-of-the-position-tracker-on-the-viewport "Direct link to Set position of the position tracker on the viewport")

Set the position tracker on a particular spot of the viewport while in follow position mode using the `cameraFocus` property:

```dart
// Calculate the position relative to the viewport
double twoThirdsX = 2 / 3;
double threeFifthsY = 3 / 5;
Point<double> position = Point(twoThirdsX, threeFifthsY);

// Set the position of the position tracker in the viewport
// while in follow position mode
FollowPositionPreferences prefs =
    mapController.preferences.followPositionPreferences;
GemError error = prefs.setCameraFocus(position);

mapController.startFollowingPosition();

```

The `setCameraFocus` method uses a coordinate system relative to the viewport, not physical pixels. `Point(0.0, 0.0)` corresponds with the top-left corner and `Point(1.0, 1.0)` corresponds with the bottom-right corner.

## Customize position icon[​](#customize-position-icon "Direct link to Customize position icon")

Customize the position tracker to suit your application's requirements. Set a simple PNG as the position tracker:

```dart
    // Read the file and load the image as a binary resource
    final imageByteData = (await rootBundle.load('assets/navArrow.png'));

    // Convert the binary data to Uint8List
    final imageUint8List = imageByteData.buffer.asUint8List();
    
    // Customize the position tracker
    MapSceneObject.customizeDefPositionTracker(imageUint8List, SceneObjectFileFormat.tex);

```

Besides simple 2D icons, 3D objects as `glb` files can be set. The format parameter of the customizeDefPositionTracker should be set to `SceneObjectFileFormat.tex` in this case.

Setting different icons for different maps is not currently supported.

warning

Ensure the resource (in this example `navArrow.png`) is correctly registered within the `pubspec.yaml` file. See the [Flutter documentation](https://docs.flutter.dev/ui/assets/assets-and-images) for more information.

![Custom position tracker](/docs/flutter/assets/images/example_flutter_position_custom_arrow-faa4bc8336d78a08f96198f9b80bbb43.png)

**Custom position tracker**

## Other position tracker settings[​](#other-position-tracker-settings "Direct link to Other position tracker settings")

Change settings such as scale and visibility of the position tracker using the methods available on the `MapSceneObject`, obtained using `MapSceneObject.getDefPositionTracker`.

### Change the position tracker scale[​](#change-the-position-tracker-scale "Direct link to Change the position tracker scale")

Use the `scale` setter to change the position tracker scale:

```dart
// Get the position tracker
MapSceneObject mapSceneObject = MapSceneObject.getDefPositionTracker();

// Change the scale 
mapSceneObject.scale = 0.5;

```

A value of 1 corresponds with the default scale. The parameter passed to the setter should be in the range `(0, mapSceneObject.maxScale]`. The code snippet above sets half the scale.

info

The scale of the position tracker stays constant on the viewport regardless of the map zoom level.

### Change the position tracker visibility[​](#change-the-position-tracker-visibility "Direct link to Change the position tracker visibility")

Use the `visibility` setter to change the position tracker visibility:

```dart
// Get the position tracker
MapSceneObject mapSceneObject = MapSceneObject.getDefPositionTracker();

// Change the visibility
mapSceneObject.visibility = false;

```

The snippet above makes the position tracker invisible.

## Relevant examples demonstrating custom position icon related features[​](#relevant-examples-demonstrating-custom-position-icon-related-features "Direct link to Relevant examples demonstrating custom position icon related features")

* [Custom Position Icon](/docs/flutter/examples/maps-3dscene/custom-position-icon.md)
