public static void XYtoGL(Coordinate coordinate) { double R = 6378137; coordinate.x = coordinate.x / Math.PI * 180.0 / R; coordinate.y = ((Math.atan(Math.exp(coordinate.y / R)) - Math.PI/4) / Math.PI * 180.0)*2; } public static void GLtoXY(Coordinate coordinate) { double R = 6378137; coordinate.x = R * (coordinate.x - 0)/180 * Math.PI; coordinate.y = R * Math.log(Math.tan(Math.PI/4+coordinate.y/2*Math.PI/180)); }