Position Log Playback¶
In this guide you will learn how to play back
a previously recorded position log, using DataSource
on an interactive map, displayed using MapView
,
with frame per second (FPS) counter.
GPS Log Data Source¶

First, get an API key token, see the Getting Started guide.
Qt should be installed to continue.The Maps SDK for Qt should be installed, see the Setup Maps SDK for Qt guide.
Overview¶
PositionLogPlayback
demonstrates how easy it is to use MapView
to display an interactive map and play back a position log using
DataSource
.
How it works
In Qt, go to the File menu and select Open File or Project…
then browse to the PositionLogPlayback example folder and open PositionLogPlayback.pro
You may want to have a look at Setting your API Key to see how to open and configure a project and set your API Key.
In main.qml, in the Component.onCompleted:
block, the datasource is
set by specifying the filename of a previously recorded [GPS] position log:
ServicesManager.dataSource.playbackFile = Qt.resolvedUrl("gpslog_paris_20230307.gm");
Also the content type that will be downloaded upon demand is specified:
let updater = ServicesManager.contentUpdater(ContentItem.Type.RoadMap);
The MapView
displaying the interactive map also has 2 buttons,
the one on the bottom left of the viewport to start/stop the position
datasource playback, and the one on the bottom right to start/resume
following position.
Panning the map during simulation/playback will stop follow position, and the button needs to be clicked again to resume following position.
1MapView {
2 id: mapView
3 anchors.fill: parent
4 viewAngle: 25
5 zoomLevel: 69
6 viewPerspective: MapView.ViewPerspective.View3D
7 buildingsVisibility: MapView.BuildingsVisibility.Show3D
8 detailsQualityLevel: MapView.DetailsQualityLevel.Medium
9 gestures: MapView.Gesture.Pan | MapView.Gesture.PanEnableVelocity
10 | MapView.Gesture.Pinch | MapView.Gesture.Rotate | MapView.Gesture.Tilt
11 Text {
12 anchors.right: parent.right
13 anchors.top: parent.top
14 text: fpsCounter.fps
15 }
16 Button {
17 anchors.left: parent.left
18 anchors.bottom: parent.bottom
19 text: ServicesManager.dataSource.type === DataSource.Type.Live
20 ? "Position Log playback" : "Live position"
21 onClicked: ServicesManager.dataSource.type = ServicesManager.dataSource.type
22 === DataSource.Type.Live ? DataSource.Type.Playback : DataSource.Type.Live;
23 }
24 Button {
25 anchors.left: parent.left
26 anchors.top: parent.top
27 //enabled: ServicesManager.dataSource.type === DataSource.Type.Live
28 text: ServicesManager.dataSourceRecorder.active ? "Stop recording" : "Start recording"
29 onClicked: ServicesManager.dataSourceRecorder.active = !ServicesManager.dataSourceRecorder.active;
30 }
31 Button {
32 anchors.right: parent.right
33 anchors.bottom: parent.bottom
34 text: qsTr("Follow position")
35 enabled: !mapView.followingPosition
36 onClicked: mapView.followingPosition = true
37 }
38}
Follow position means that the camera flies to the position of the green arrow and then follows the simulated position arrow. This is necessary, as the arrow is likely to be located elsewhere on the map, not at the current location of the camera.

The green position arrow plays back the previously recorded positions on the map, from the data source specified above.