How Can I add Latitude, Longitude dynamically in Javascript?

A question about the spherical trigonometry?

  • So I'm using the formula of the spherical trigonometry to find the angle between any place on the map and a fixed point (let's take it as Antalya Turkey) The formula is: angle = tan^(-1) * sin (B-b) _________________________ cos(a)tan(A) - sin(a)cos(B-b) Where 'A' is the latitude of the fixed point, and 'B' is its longitude. And 'a' is the latitude of any point on the map, and 'b' is its longitude. The problem is when I calculate the angle, sometimes it's right when I compare it with the map, and sometimes it's wrong where I have to add 180 degrees or remove 180 degrees to get to the right answer. I'm kinda lost here. When do I add or remove 180 degrees to get the right answer?

  • Answer:

    Arctan isn't a function, because there are many angles that might give a particular tangent. The range of arctan on a calculator is -90 to +90. You might have to add/subtract 180 to get to the next angle that solves the equation. You do this when you understand the problem, rather than letting the calculator do all the thinking for you, and it makes sense to do so.

pokero.a... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.