Results 1 to 3 of 3

Math Help - Reversing forumla

  1. #1
    Newbie
    Joined
    Jun 2011
    Posts
    1

    Reversing forumla

    Hey there, I am an Iphone developer from New Zealand and I am currently working on a project that requires me to use some equations for calculating X and Y coordinates from latitude and longitude values.

    I have a function that converts lat and long to x and y and it is working perfectly in my application. However now i need to do the reverse of this. I need to convert X and Y values into lat and long.

    I have gotten halfway by myself, i have worked out the longitude side of things, but the other line is more complicated.

    This is what I started with:

    x = (offset + radius * longitude * M_PI / 180.0);
    y = (offset - radius * logf((1.0 + sinf(latitude * M_PI / 180.0)) / (1.0 - sinf(latitude * M_PI / 180.0))) / 2.0);

    and this is where i have gotten so far:

    float longitude = (x - offset) * 180 / radius / M_PI;

    Could someone please give me a hand with the second line.

    If you could please lay this out in steps for me it would be very much appreciated.
    I need some insight as to how to do this myself.
    Cheers
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member
    Joined
    Dec 2009
    From
    1111
    Posts
    872
    Thanks
    3

    Re: Reversing forumla

    Quote Originally Posted by howsyourface View Post
    Hey there, I am an Iphone developer from New Zealand and I am currently working on a project that requires me to use some equations for calculating X and Y coordinates from latitude and longitude values.

    I have a function that converts lat and long to x and y and it is working perfectly in my application. However now i need to do the reverse of this. I need to convert X and Y values into lat and long.

    I have gotten halfway by myself, i have worked out the longitude side of things, but the other line is more complicated.

    This is what I started with:

    x = (offset + radius * longitude * M_PI / 180.0);
    y = (offset - radius * logf((1.0 + sinf(latitude * M_PI / 180.0)) / (1.0 - sinf(latitude * M_PI / 180.0))) / 2.0);

    and this is where i have gotten so far:

    float longitude = (x - offset) * 180 / radius / M_PI;

    Could someone please give me a hand with the second line.

    If you could please lay this out in steps for me it would be very much appreciated.
    I need some insight as to how to do this myself.
    Cheers
    Dear howsyourface,

    Your formula for y is not clear, do you mean,

    y=\mbox{offset}-\frac{\mbox{radius}\times \log f\left[(1.0 + \sin f\left(latitude\times \frac{M_{PI}}{180.0}\right)\right]}{2.0\left[1.0 - \sin f\left(latitude\times\frac{M_{PI}}{180.0}\right) \right]}

    Try to learn some simple LaTeX, then you would be able to clearly present your equations. http://www.mathhelpforum.com/math-he...orial-266.html
    Follow Math Help Forum on Facebook and Google+

  3. #3
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,110
    Thanks
    68

    Re: Reversing forumla

    Quote Originally Posted by howsyourface View Post
    y = (offset - radius * logf((1.0 + sinf(latitude * M_PI / 180.0)) / (1.0 - sinf(latitude * M_PI / 180.0))) / 2.0);
    May make your life easier:

    let k = latitude * M_PI / 180.0

    y = (offset - radius * logf((1.0 + sinf(k)) / (1.0 - sinf(k))) / 2.0)
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Changing subject forumla
    Posted in the Algebra Forum
    Replies: 3
    Last Post: November 7th 2012, 01:11 PM
  2. Heron's forumla
    Posted in the Geometry Forum
    Replies: 1
    Last Post: November 2nd 2010, 08:37 PM
  3. Double Angle Forumla
    Posted in the Trigonometry Forum
    Replies: 2
    Last Post: May 31st 2009, 09:17 AM
  4. Transpose forumla.
    Posted in the Algebra Forum
    Replies: 2
    Last Post: January 7th 2009, 08:27 AM
  5. Sequence Forumla?
    Posted in the Algebra Forum
    Replies: 3
    Last Post: February 1st 2008, 11:53 PM

Search Tags


/mathhelpforum @mathhelpforum