## Using the moveByBearing function

cmaranto
Registered Member
Posts
2
Karma
0

### Using the moveByBearing function

Tue Nov 03, 2015 10:16 pm
Hi,

I have an application where I need to draw a bearing line from one location to another. I need to calculate the destination position given the start position, the bearing, and the distance in meters. I found the GeoDataCoordinates::moveByBearing function which specifies the distance as "distance on a unit sphere". What is the formula to convert a distance in meters to a distance on the unit sphere?

Thanks
tackat
KDE Developer
Posts
121
Karma
0
OS

### Re: Using the moveByBearing function

Thu Nov 05, 2015 1:45 pm
A unit sphere is a sphere which has the (unitless) radius 1.
The circumference of a big circle in such a unit sphere is 2 * M_PI
For a given distance d_k in kilometers and an earth radius of
about 6378 km you can calculate the distance on a unit sphere
d_u using the rule of three:

d_u = d_k * M_PI / 20037

## Who is online

Registered users: ajmoss, Baidu [Spider], Bing [Bot], djarvie, Exabot [Bot], fbg13, flipwise, Google [Bot], kyrhammer, malger, mathewm, mathpfvr, OlafLostViking, Saru, Snudl