Why do Some Zmanim Never Occur in Some Locations? (Developers Beware)
While most people realize that the sun may not rise or set in the Arctic and Antarctic Circles (see the Star-K’s When Does One Pray When There Is No Day), 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 5th till 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 Also 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.
A lookup tool for elevation lookup was added to the Zmanim Calendar Generator page. This service is courtesy of Jonathan Stott’searthtools.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 Zmanim Calendar Generator now has a simple way to look up longitude and latitude information using the Google MapsAPI. To use this feature, click on the Google Maps icon to display the map (location centered on Bais Medrash Gevoha in Lakewood), find the location that you want to generate zmanim for, and click that point in the map. This will update the longitude and latitude fields in the form. The Google API was pretty straight forward and simple. At the same time I tried to integrate an elevation lookup. Google does not provide elevation information, but I attempted to look it up using a webservice. This seemingly simple task was not very straight forward. The approach was to grab the SOAP response from the REST style elevation webservice made available by Jonathan Stott. My plan was to do this all via the client sided XML parsing. The first issue encountered was browser security that does not allow cross-domain loading of XML documents (By the way this was not using XMLHttpRequest, but the same security restrictions apply). This was solved by a simple PHP page that was just a proxy for the call. That done, I managed to get it to work in IE, but it crashed the browser every second call or so. The crashing was solved by adding a small delay. I never managed to get it working in Mozilla. I later tried to use the existing Google Maps API to load it, but never got it working. I commented out all elevation code, and will get to that part at some future date. I also removed the non decimal longitude and latitude option. I hope this will be useful.
Provide links to locate longitude and latitude information
Add support for the generation of a standard (not full as is the default now) calendar with a much smaller set of zmanim
Implement the generation of PDF calendars
Possibly use the Google MapsAPI to allow the selection of longitude and latitude information
The code for the PDF generation is already in the API but has not been updated in a while and does not work properly. This will also have to be updated for the standard calendar mentioned above. The way I envision interacting with Google Maps would be to allow the user to center their location in the map, and have those coordinates used for the zmanim calendar. This would have been relatively trivial if they provided geocoding information, by just allowing the user to enter their location as it can be done at Google Maps, but they currently do not provide geocoding information. I haven’t touched their API yet, and although it does not look too complex, it will probably take a while.