def MetersToPixels( mx, my, zoom): import math tileSize = 256 initialResolution = 2 * math.pi * 6378137 / tileSize # 156543.03392804062 for tileSize 256 pixels originShift = 2 * math.pi * 6378137 / 2.0 # 20037508.342789244 res = initialResolution/(2**zoom) px = (mx + originShift) / res py = (my + originShift) / res return px, py