Java tutorial
//package com.java2s; public class Main { public static double pixelYToLatitude(int pixelY, double zoomLevel, int tileSize) { int mapSize = getMapSize(zoomLevel, tileSize); if (pixelY < 0 || pixelY > mapSize) { throw new IllegalArgumentException( "invalid pixelY coordinate at zoom level " + zoomLevel + ": " + pixelY); } double y = .5d - ((double) pixelY / mapSize); return 90d - 360d * Math.atan(Math.exp(-y * (2d * Math.PI))) / Math.PI; } public static int getMapSize(double zoomLevel, int tileSize) { return (int) Math.pow(2d, getZoomLevelAsInt(zoomLevel)) * getTileSize(zoomLevel, tileSize); } public static int getZoomLevelAsInt(double zoomLevel) { return (int) Math.round(zoomLevel); } public static int getTileSize(double zoomLevel, int tileSize) { double f = zoomLevel - Math.floor(zoomLevel); f = f < .5f ? f + 1f : .5f * (f + 1f); return (int) (tileSize * f); } }