Prefetch Map Data In Streaming Mode
Prefetch map data in streaming mode
This tutorial shows how to prefetch map data in streaming mode to reduce the chance of switching map content mode to base mode.
Get started
In the TA SDK, map content has two modes: base mode and streaming mode. The base mode works with map data preinstalled on the device, which goes out-of-date gradually. The streaming mode works with map data downloaded via the network, which is always up-to-date. When the TA SDK works in streaming mode, map data may be insufficient to make services work properly. In this case, services may report data issues that cause map content mode to switch to base mode. Meaning the navigation experience may be switched from an up-to-date version to an out-of-date version. To avoid this kind of degradation, the navigation service supports prefetching map data in streaming mode.
Set prefetch radius around vehicle in free mode
In free mode, map data is prefetched in a bounding box with a specified radius around the vehicle.
Illustrated in the following example, ⍋
is the indicator of the vehicle, r
is the radius of the bounding box.
The bounding box is a square with an edge length of 2r
.
The bounding box moves along with the vehicle, and prefetching occurs periodically.
When a vehicle moves out of the circle (radius is r/2
, center is the location of the vehicle), the circle and prefetching bounding box location are updated.
The update of the bounding box location triggers the prefetching of map data.
Set prefetch distance along route in navigation mode
In navigation mode, map data is prefetched in a corridor along the route.
Illustrated in the following example, ⌲
is the indicator of the vehicle, 2d
is the distance of the corridor, and
w
is the width of the corridor.
The width of the corridor is calculated internally to cover the necessary map data.
When a vehicle moves more than the specified distance along the route, i.e., d
, prefetching is triggered and the corridor moves forward.