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.