distanceTo

Returns the tree distance from the specified position to the start offset of the given horizon element. The distance is strictly positive for elements in front of the position, i.e.: 1. elements on the position path in front of the position (the start offset of the element is greater than the position offset) 2. elements on sub-paths that the vehicle can reach by successively deviating to child paths. The distance is strictly negative for elements behind the vehicle that the vehicle has driven past, i.e.: 1. elements on the position path, which are completely behind the position or overlap the position, but start before the position (the start offset of the element is less than the position offset) 2. elements on sub-paths that the vehicle has deviated from at some point in the past. The distance is 0 for elements that start at the position (the start offset of the element on the position path is the same as the position offset). The distance is null if any of the following is true: 1. the position does not have a valid path id 2. there is no path in the snapshot with the same id as the one stored in the position 3. the given element does not exist in the snapshot 4. the given element is an element behind the position that the vehicle has not moved past, i.e. elements on sub-paths behind the vehicle that the vehicle has not taken.

Important: This is a Public Preview API. It may be changed or removed at any time.

Return

Tree distance to the given horizon element.

Parameters

element

Horizon element.

position

Horizon positionHorizonPosition.