TrackDistance (FPScript)

21.09.2021

Calculates the distance between locations on Earth.

Syntax

TrackDistance(Coordinates)
or
TrackDistance(SourceCoordinate, DestinationCoordinate)

 

The syntax of the TrackDistance function consists of the following parts:

Part

Description

Coordinates

Coordinates with the longitude as a real component and the latitude as an imaginary component. In this case, the distances between the individual waypoints are totaled.

Permitted data structures are data series und signal. All complex data types are permitted.The argument is transformed to the unit °.

SourceCoordinate

Specifies the longitude as a real component and the latitude as an imaginary component of the starting point.

Permitted data structures are scalar value. All complex data types are permitted.The argument is transformed to the unit °.

DestinationCoordinate

Specifies the longitude as a real component and the latitude as an imaginary component of the ending point.

Permitted data structures are scalar value. All complex data types are permitted.The argument is transformed to the unit °.

Remarks

The result has the unit km.

With the algorithm used, the distance between two locations on Earth can be calculated accurately to 50 m. During the calculation, the GRS80 ellipsoid is used instead of a sphere. If the coordinates are in the 'degrees, minutes and seconds' display format, you will obtain the coordinates displayed in decimals through the following conversion: Degree + Minutes / 60. + Seconds / 3600.. If the Unit Manager is enabled, you can also specify the coordinates in degrees, minutes and seconds, e. g. 51.51° = 51° + 30' + 36".

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Available in

FlexPro View, Basic, Professional, Developer Suite

Examples

TrackDistance((-0.12, 51.5), (-74.0, 40.7))

Results in 5586.5 km. Calculates the distance between London and New York in kilometers.

TrackDistance((-(7' + 12"), 51° + 30'), (-74°, 40° + 42'))

Results in 5586.5 km. Here the positions are in degrees, minutes and seconds. Please note the parentheses for the first negative argument.

TrackDistance(Coordinates)

If the latitudes and longitudes are present in the 'Coordinates' data set, the formula calculates the distance to the next relevant waypoint and aggregates the distances.

Share article or send as email:

You might be interested in these articles