Java tutorial
//package com.java2s; public class Main { public static int latitudeToPixelY(double latitude, double zoomLevel, int tileSize) { double sinLatitude = Math.sin(latitude * (Math.PI / 180)); int mapSize = getMapSize(zoomLevel, tileSize); return (int) Math .round((0.5d - Math.log((1d + sinLatitude) / (1d - sinLatitude)) / (4d * Math.PI)) * mapSize); } 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); } }