|
-
Oct 26th, 2009, 08:08 AM
#1
Thread Starter
Not NoteMe
Rearrange Formula
I have the following code which implements a formula:
Code:
double xtile = (Coordinate.Long + 180) / 360 * (1 << ZoomLevel);
double ytile = (1 - Math.Log(Math.Tan(Coordinate.Lat * Math.PI / 180) + 1 / Math.Cos(Coordinate.Lat * Math.PI / 180)) / Math.PI) / 2 * (1 << ZoomLevel);
It converts map lat/long coordinates (degrees) into X/Y coordinates (on an image).
ZoomLevel is a constant.
I need to go the other way round i.e. from x,y coords on the image, to a lat,long coord on earth.
I'm thinking that to do this i just need to rearrange the formula(s?) in terms of coordinate.lat/long.
I'm ok with the X => Long conversion, but am having trouble rearranging the Y => Lat one.
Any help would be greatly appreciated.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|