Skip to main content
The SDK provides multiple ways for you to manage the map camera. You can use pre-defined cameras, such as follow north up based on the user’s current location, or manually specify the camera parameters.
Assure the map is ready before making changes to the camera. Learn more.

Available Cameras

The SDK comes with a pre-defined set of cameras for common camera management scenarios. To set a camera, you can use:
// follow the user's location with the north facing up
await _mapManager.setCamera(MapManagerCameraTrackingMode.followNorthUp);

// follow the user's location with its direction facing up
await _mapManager.setCamera(MapManagerCameraTrackingMode.followDirection);

// disable the pre-defined camera
await _mapManager.setCamera(MapManagerCameraTrackingMode.none);
Please see the MapManagerCameraTrackingMode enum for all available values. The none value is automatically set when the user manually moves the map.

Manual Update

Use the MapManager.applyCamera() method to manually specify the camera’s parameters, such as its location, zoom, tilt, etc. Example:
await _mapManager.applyCamera(
  MapManagerApplyCameraArguments(
    cameraUpdate: MapManagerCameraUpdate(
      position: MapManagerLatLng(
        latitude: 52.3676,
        longitude: 4.9041,
      ),
      zoom: 12,
    ),
    animationDuration: 0.3, // in seconds
  ),
);

Relative Update

Use the MapManager.applyCameraBy() method to update the camera relative to its current state. This is helpful if you don’t need to update the camera’s location, but only its zoom or tilt. Example, to zoom out the camera two levels:
await _mapManager.applyCameraBy(
  MapManagerApplyCameraByArguments(
    cameraUpdateBy: MapManagerCameraUpdateBy(
      zoomBy: 2,
      zoomIn: true,
      zoomOut: false,
    ),
    animationDuration: 0.3, // in seconds
  ),
);