Camera and animations

VERSION 0.3.34

The camera position controls how the map is displayed. The camera position is a combination of its location, zoom, tilt, and rotation. To change the user’s view of the map, change the camera position. The map in the Map Display module is represented as a globe, so that the sizes and shapes of features are not distorted.

The default position of the camera is:

  • Located at 0 latitude and 0 longitude.
  • With a zoom of 0, which shows the whole globe.
  • Rotated to be north-up.
  • Tilted to point straight down.

Changing the camera position does not affect the map style, markers or any other map configuration.

Camera options

In the Map Display module, every change to the camera’s position has to be done using the CameraOptions class. It specifies the camera’s location, zoom, tilt, and rotation to set.


The location is the geographical coordinate marking where the camera view should be pointed. The map view is always centered on it.

The position is specified with a GeoCoordinate object.


The camera zoom can be set between 0 and 22. Approximate zoom scales:

  • 0 - The camera is fully zoomed out the whole globe is visible.
  • 5 - Country-level.
  • 10 - City-level.
  • 15 - Neighborhood-level.
  • 20 - Street-level.
  • 22 - Maximum zoom in.


The tilt is the angle from the nadir (the camera pointing toward the center of the earth), where the tilt is set to zero 0. When the tilt is 90, the camera is pointing towards the horizon.

The closer the tilt level approaches 90, the more tiles may need to be downloaded. This can result in high data usage.


Sets the cardinal direction that the camera is heading. By default, the rotation is set to 0, meaning that the orientation of the map is toward the north. The direction increases as the camera rotates clockwise. This means that east is 90 degrees, south is 180 degrees, and west is 270.

Current camera position

You can access the current camera position by calling the TomTomMap.currentPosition() method on the TomTomMap instance. The CameraPosition object that is returned contains a snapshot of the camera’s location, zoom, tilt, and rotation.

val cameraPosition = tomTomMap.cameraPosition()

Moving the camera

The Map Display module provides two ways of changing the camera position: transitioning with a smooth animation or moving immediately to the new position.

To change the camera position immediately, call the moveCamera method on the TomTomMap object.

1val amsterdam = GeoCoordinate(52.379189, 4.899431)
2val cameraOptions = CameraOptions(
3 position = amsterdam,
4 zoom = 10.0,
5 tilt = 45.0,
6 rotation = 90.0

Animating the camera move

To animate a camera move, first define CameraOptions with the new camera position. Then use the AnimationDuration class to set the duration of the animation. The animation time is set to 1.5 seconds by default.

Note that setting AnimationDuration to null is equivalent to using the moveCamera method.

1val amsterdam = GeoCoordinate(52.379189, 4.899431)
2val newCameraOptions = CameraOptions(
3 position = amsterdam,
4 zoom = 10.0,
5 tilt = 45.0,
6 rotation = 90.0
8tomTomMap.animateCamera(newCameraOptions, AnimationDuration(Duration.ofSeconds(3)))

The animation can also be monitored, so that you receive a notification when it completes or it is cancelled. You can cancel an animation by moving the camera before the animation is finished.

1val amsterdam = GeoCoordinate(52.379189, 4.899431)
2val newCameraOptions = CameraOptions(
3 position = amsterdam,
4 zoom = 10.0,
5 tilt = 45.0,
6 rotation = 90.0
9 options = newCameraOptions,
10 animationDuration = AnimationDuration(Duration.ofSeconds(3)),
11 actionCallback = object : OnCancellableActionCallback {
12 override fun onComplete() {
14 }
16 override fun onCancelled() {
18 }
19 }

Tracking mode

The Map Display module allows you to set how the camera tracks the user locations to suit different interaction modes. Do this by setting CameraTrackingMode to the TomTomMap instance. There are three options for tracking mode:

  • NONE - The camera does not track the user’s location. This is the default setting and is mainly used to show the user location on the map.
  • FOLLOW - The camera follows the user’s location, but its tilt and zoom do not change.
  • FOLLOW_WITH_HEADING - The camera follows the user’s location. As the user moves, the camera properties change to show where the user is heading.

The last two modes are mainly used in navigation applications.

To apply a given tracking mode, call the changeCameraTrackingMode method:


To check what tracking mode is currently set:

val cameraTrackingMode = tomTomMap.cameraTrackingMode()

Camera listeners (Camera events)

The camera position can be modified by calling moveCamera and animateCamera. But users can also affect the camera when they use gestures to interact with the map. You can listen to camera changes by setting OnCameraChangeListener and OnCameraSteadyListener.

  • The OnCameraChangeListener reports on every change of a camera property. Be aware that doing too much inside this listener can slow down the application.
1tomTomMap.addOnCameraChangeListener(object : OnCameraChangeListener {
2 override fun onCameraChange() {
4 }
1tomTomMap.addOnCameraSteadyListener(object : OnCameraSteadyListener {
2 override fun onCameraSteady() {
4 }

Both listeners can be removed when they are no longer needed. To remove them, call removeOnCameraChangeListener or removeOnCameraSteadyListener on the TomTomMap instance to which listeners were added. Specify which listener you want to remove by providing it as a parameter to the methods listed above.