hebcal / dotcom

deprecated hebcal.com source code
https://github.com/hebcal/hebcal-web
21 stars 9 forks source link

Shabbat times API accept decimal format coordinates #12

Closed lukecarbis closed 9 years ago

lukecarbis commented 9 years ago

The Shabbat times API only accepts cartesian style coordinates at the moment.

Typically, coordinates are obtained from devices in a decimal format, which look like this: latitude: 31.7684025, longitude: 35.2132987

However, the API only accepts coordinates in radians, which looks like this: 31.44º N, 35.12º E

It is possible to convert decimal to radians with a fairly simple formula: radians = decimal / π * 180

But unfortunately, this isn't very accurate due to the fact that the earth isn't exactly spherical.

It would be much easier if I could pass in a latitude in decimal format, e.g.: ?cfg=json&m=50&geo=pos&latitude= 31.7684025 &longitude= 35.2132987

Would this be difficult?

mjradwin commented 9 years ago

This shouldn't be too difficult. Thanks for suggesting it. We will try to find the time in the next week or two.

Sent from my mobile device On Jun 12, 2015 6:18 AM, "Luke Carbis" notifications@github.com wrote:

The Shabbat times API only accepts cartesian style coordinates at the moment.

Typically, coordinates are obtained from devices in a decimal format, which look like this: latitude: 31.7684025, longitude: 35.2132987

However, the API only accepts coordinates in radians, which looks like this: 31.44º N, 35.12º E

It is possible to convert decimal to radians with a fairly simple formula: radians = decimal / π * 180

But unfortunately, this isn't very accurate due to the fact that the earth isn't exactly spherical.

It would be much easier if I could pass in a latitude in decimal format, e.g.: ?cfg=json&m=50&geo=pos&latitude= 31.7684025 &longitude= 35.2132987

Would this be difficult?

— Reply to this email directly or view it on GitHub https://github.com/hebcal/dotcom/issues/12.

mjradwin commented 9 years ago

Easier than I thought. Just deployed 818b429a1b35273fc286c8b02769b885e8debc6d to hebcal.com. Give it a whirl and let me know what you find?

Note that in addition to lat/long, you'll also have to specify appropriate timezone identifier such as tzid=Asia/Jerusalem.

lukecarbis commented 9 years ago

Works great! Thanks @mjradwin!