def MetersToLatLon( mx, my ): 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 lon = (mx / originShift) * 180.0 lat = (my / originShift) * 180.0 lat = 180 / math.pi * (2 * math.atan(math.exp(lat * math.pi / 180.0)) - math.pi / 2.0) return lat, lon