Bearing to Yerushalayim and Zmanim Map 3.0

Vintage Map with CompassThe Bearing to Yerushalayim and Zmanim Map was recently updated to version 3.0. This new release adds a number of new features to the Zmanim Map version 2.0 update released in March 2010. The main change was updating the Google Map API version from the deprecated v2 to v3. This change increases performance and adds much better support for mobile browsers. The upgrade also means that a Google Maps API key is no longer required. This makes it easy to drop it into any site without any configuration (contact me for details). Zmanim tab v3The technical notes on the original Technical Information about the Bearing to Yerushalayim Map post are still relevant, with very little having changed since the initial implementation.

The following is a partial list of the new features:

  • A number of additional zmanim in the More Zmanim tab, including tchilas and sof zman kiddush levana (if they occur on that day)
  • A link to download a 12 month Zmanim calendar directly from the map (using the same spreadsheet used in the Zmanim Calendar Generator). Clicking on the link from the Zmanim tab will generate a calendar with most typically used zmanim, while clicking on the link in the More Zmanim tab will download the full set of zmanim. These are available as the Calendar Type option in the Zmanim Calendar Generator
  • Increased use of jQuery and jQuery UI for formatting the zmanim tables to better match the site look & feel
  • Refactoring to make the code more robust and slightly more maintainable
  • Timezones for all of Israel now display the timezone of Asia/Jerusalem as opposed to the Asia/Gaza returned for parts of Israel by the GeoNames TimeZone web service

From a technical perspective there were a number of changes required due to updating the Google Maps API from v2 to v3. These include:

  • v3 no longer supports tabbed info windows, so the tabs are now implemented using jQuery UI
  • Renaming of a number of classes and functions such as GLatLng to LatLng
  • A number of functions that were part of API v2 were removed in v3. One example is the removal of radians in the LatLng that had been available and was replaced by the google.maps.LatLng class. These missing functions required for the direction to Yerushalayim calculations are now supported in the Zmanim Map using prototypes

FAQ: Why Some Zmanim Never Occur (Developers Beware)

Question:

Why do some zmanim never occur in some locations? Developers Beware!

Answer:

While most people realize that the sun may not rise or set in the Arctic and Antarctic Circles (see the Rabbi Dovid Heber’s article When Does One Pray When There Is No Day in the Star-K’s Kashrus Kurrents), many are not aware that some twilight dips will not occur during part of the year as far south of the Arctic Circle as London. For example around the summer solstice in London (on the zmanim map) the sun will never dip far enough below the horizon to reach alos 16°. This happens in London from June 4th through July 8th. The image seen on the top right (original at timeanddate.com) shows various civil twilights centered on London on Midnight June 21st. Look carefully to see the various bands of twilight. Gateshead will not have alos 16° from May 16th through July 28th, while Anchorage, Alaska (yes there is a Frum Shul in Anchorage with an interesting davening direction issue that is discussed in the Davening Direction from Alaska post ) will not have alos 16.1° from April 25th to August 20th. Zmanim based on sunrise such as alos 72 that is a 72 minute offset of sunrise can be calculated as long as sunrise can be calculated, something that will happen as long as you are not in the Arctic or Antarctic Circles.
For this reason, the Zmanim API will return a null when a zman will not happen. A Long.MIN_VALUE will be returned when a long is expected such as in the case of a shaah zmanis. While an inconvenience to developers who have to code for this, the alternative of a default date would mean that developers unaware of this would return incorrect zmanim, something far worse than a program error from a NullPointerException.
In recent weeks two publicly available programs using the Zmanim API ran into issues due to nulls returned for early alos times. Being something not anticipated by the developers, the nulls generated errors in the programs that quickly led to fixes. For this reason, Yitzchok updated the Zmanim .NET project to return the nullable DateTime? instead of the regular DateTime that it had previously been returning. While the Zmanim API documentation always made the possibility of a null being returned possible, I modified the documentation to make this clear on the return value documentation for every zman. Code with the modified documentation was part of the recently released Zmanim API 1.2.1.

Bearing to Yerushalayim and Zmanim Map 2.0

Vintage Map with CompassThe availability of the Bearing to Yerushalayim and Zmanim Map was originally announced on December 30, 2007. At the time there were a number of bugs related to the Google Map API. These bugs were reported to Google and eventually fixed. Since that time, the only change was a minor JavaScript fix for IE. The Bearing to Yerushalayim worked, but the zmanim tabs had a major issue because the timezone calculated was done based on the user’s current browser timezone. This made it tricky to check zmanim in a different location or timezone than the user’s current timezone.Zmanim tab using timezonesI recently updated the map to look-up the actual timezone of the latitude and longitude selected by the user. This was implemented by doing a look-up at the geonames.org timezone web-service. The timezone is passed to the Zmanim API and used to generate the XML output of a list of daily zmanim that is displayed in the map. Since the Olson timezone database changes a few times a year, there will almost certainly be cases where the proper timezone can’t be determined. Some of these are changes of timezone names, such as the change from Asia/Calcutta to Asia/Kolkata (my host will not run the TZ Updater tool). In these cases, a simple mapping between the old and new was added to the map. In cases where the timezone can’t be determined the timezone will default to GMT. Ocean locations within 10 km of land will use the closest landmass, but anywhere beyond 10 km will default to GMT. One issue with using the geonames.org webservice, is that when it is down, the map will timeout. I experimented with various ways of dealing with this, but unless my host updates the Java version from 1.4, they are too complex to use at this time.

See the Technical Information about the Bearing to Yerushalayim Map post for technical details about the original implementation.

Elevation Lookup Added to Zmanim Calendar Generator

Sunrise CalendarA lookup tool for elevation lookup was added to the Zmanim Calendar Generator page. This service is courtesy of Jonathan Stott’s earthtools.org elevation webservice. This Elevation data currently only covers all of mainland Europe (between latitudes 35°N and 60°N and longitudes 35°E and 15°W) and all of the contiguous states of the United States of America (between latitudes 20°N and 50°N and longitudes 65°W and 125°W). The source of the data is:

The terrain model used to find heights above sealevel is from the Shuttle Radar Topography Mission (SRTM) which was a joint project between the US National Geospatial-Intelligence Agency (NGA) and the National Aeronautics and Space Administration (NASA). Data was recorded for 11 days from the Space Shuttle Endevour from 11th February 2000. The data used here is at a resolution of 3 arc seconds (approximately 90m).

The lookup is done via an AJAX call.