- Joined
- Oct 30, 2009
- Messages
- 14,020
- Reaction score
- 4
- Points
- 0
Surftile coordinates:One last question,
How do I convert from Lat/long to Surface Tile?
{...}
Does anyone have the maths or can give me a URL because I have spent hours and found nothing of use.
[math]x=longitude\cdot\frac{2^{(level+8)}}{180}[/math]
[math]y=latitude\cdot\frac{2^{(level+8)}}{180}[/math]
You could also get it from converting the formulas I gave you on the "[Problem] Exact size of tiles" thread.
You round down the result to integer to get the number for the file name. The fraction part tells you how far you are from edge of the tile. Longitude is in -180 to 180 range, latitude in -90 to 90.