Technical Information about the Bearing to Yerushalayim Map

Vintage Map with CompassI have been asked a number of questions recently about the directional accuracy of the Bearing to Yerushalayim and Zmanim Map calculations. The rhumb line calculations are very straightforward, and I will not spend much time on them in this article. As a side note, for those interested in the subject, I would like to mention that Rabbi Gavriel Goetz recently published a very comprehensive pamphlet, Gevuras Moishe, on the subject, and it is well worth reading.

My original calculations and implementation of the great circle route (geodesic line) used simple spherical trigonometry to calculate the initial bearing (and distance) based on a sphere using an authalic mean radius of 6,371 km. These calculations were very similar to the method used in Rabbi Yehuda Herskowitz’s article in Yeshurun volume III page 586. This model of the earth is more than accurate enough for these calculations (you would need a very accurate “nose alignment” and the total lack of shuckling to even get within a degree of being correct). The Google Maps API, Yahoo Maps and Microsoft’s Live Maps, for simplicity’s sake, all use very similar calculations, as mentioned in the cfis blog quoting Morten Nielsen:

Google Maps / Virtual Earth / Yahoo Maps(?) all use a spherical datum based on WGS84. That is, it has the same center, orientation and scale as WGS84, but has no flattening. The radius of the sphere is the same as the semi-major axis of WGS84 (6378137 meters).

Using a sphere, all the above-mentioned mapping APIs use the spherical law of cosines formula for the calculations, which yields an identical result to the more complex haversine formula.

Curious how accurate these calculations really are, being based on a perfect sphere and not the oblate ellipsoid/spheroid that the earth actually is, I started looking into the subject a little more. The current standard reference ellipsoid model of the earth is the WGS84 model. The geodesist/mathematician Thaddeus Vincenty published the Vincenty formulae for this type of calculation, which are said to be accurate to about one-half millimeter, more than adequate for our calculation. Chris Veness implemented this formula in JavaScript and released it under the LGPL, making it very simple to use. I slightly modified his work to allow easier interaction with the Google Maps API. The implementation that I used when I finally published the map on December 30, 2007, uses the Vincenty formula with the WGS84 ellipsoid (the Vincenty formula can easily be used with different ellipsoid models). The table below compares the initial bearing and distance results of the different calculations for a Lakewood, NJ (latitude: 40.095965°, longitude: -74.22213°) to Har Habayis (latitude: 31.77805°, longitude: 35.235149°) example.

Calculation MethodInitial BearingDistance
6,371 km (authalic mean radius) sphere using spherical trigonometry53.86555°9224.67442 km
Google Maps API 6,378.137 km (WGS84 equatorial radius) sphere using spherical trigonometryN/A9235.00819 km
Vincenty formula using the WGS84 ellipsoid53.81786°9244.61686 km
rhumb line95.37152°9891.16074 km
Note: The table shows the original 2008 JavaScript results. Running the same calculations with version 3.1.0 of the KosherJava Zmanim API gives a Vincenty initial bearing of 53.81787° and distance of 9244.61720 km, and a rhumb line distance of 9891.16103 km. The distances differ by less than a meter, a result of small differences between the JavaScript and Java code.

3 thoughts on “Technical Information about the Bearing to Yerushalayim Map”

Leave a Reply

Your email address will not be published. Required fields are marked *

To post code, wrap it in a shortcode for its language, such as [java]…[/java], [js]…[/js] or [php]…[/php], or [code]…[/code] for plain text.