Skip to content

Instantly share code, notes, and snippets.

@kampar
Created July 19, 2017 08:48
Show Gist options
  • Save kampar/56564f7675b26254f5ed11317578eaf5 to your computer and use it in GitHub Desktop.
Save kampar/56564f7675b26254f5ed11317578eaf5 to your computer and use it in GitHub Desktop.
Google Tile Visual Basic 6 (VBA)
Type titik
x As Long
y As Long
End Type
Private Function CalcTileXY(ByVal lat As Single, ByVal lon As Single, ByVal zoom As Long) As titik
CalcTileXY.x = CLng(((lon + 180) / 360 * 2 ^ zoom))
CalcTileXY.y = CLng(((1 - Math.Log(Math.Tan(lat * pi / 180) + 1 / Math.Cos(lat * pi / 180)) / pi) / 2 * 2 ^ zoom))
End Function
Function xyz2url(x As Long, y As Long, z As Byte) As String
xyz2url = CStr("http://maps.google.com/maps/vt?pb=!1m5!1m4!1i" _
& z & "!2i" & x & "!3i" & y _
& "!4i256!2m3!1e0!2sm!3i385078792!3m14!2sen-US!3sUS!5e18!12m1!1e47!12m3!1e37!2m1!1ssmartmaps!12m4!1e26!2m2!1sstyles!")
End Function
'please change tracking padding, added by google, use Network tab on your Inspect Element menu in your browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment