The direction between any two places on Earth can be calculated using the spherical trigonometry.
We can use the following equation to do that
Direction Angle =tan-1 (sin(longitude2 – longitude1)/cos(latitude1)*tan(latitude2)-sin(latitude1)*cos(longitude2-longitude1))
In spherical trigonometry values of latitude and longitude represent angles as in the following diagram:
One famous example is The Islamic Qibla. Muslims need to pray toward qibla wherever they are.
But because earth is spheroid, after 90 longitude lines from mecca east and west direction towards kaaba loses meaning. On the other side of earth there is no meaning to orient yourself towards kaaba. For this purpose, Moslem Scholars agree on taking on the great circle as a direction. That mean they orient themselves towards the north pole in their prayers. Whether you are in Canada or in Argentina you will direct your self toward north pole. This is because any great circle from the other half of earth passing by your place and kaaba will pass also by the North Pole point.
The Following web app draws the straight line between your place and kaaba on a flat map.
Line To Kaaba