Rubke
(Rubke)
5
this is a routine i’m using (in vb.net)
Private Function CalcTileXY(ByVal lat As Single, ByVal lon As Single, ByVal zoom As Long) As Point
Dim xf As Single = (lon + 180) / 360 * 2 ^ zoom
Dim yf As Single = (1 - Math.Log(Math.Tan(lat * Math.PI / 180) + 1 / Math.Cos(lat * Math.PI / 180)) / Math.PI) / 2 * 2 ^ zoom
CalcTileXY.X = CLng(Math.Floor(xf))
CalcTileXY.Y = CLng(Math.Floor(yf))
End Function
see also : http://wiki.openstreetmap.org/index.php/Slippy_map_tilenames
i’m right now searching for the inverse calculation so X,Y to lat,lon