+ // TODO: these only work with Spherical Mercator
+ public static double xToLongitude(double x) {
+ return x;
+ }
+
+ public static double yToLatitude(double y) {
+ double rad = Math.toRadians(y);
+ double sinh = Math.sinh(rad);
+ double atan = Math.atan(sinh);
+ double finald = Math.toDegrees(atan);
+ return finald;
+ }
+
+ public static double longitudeToX(double lon) {
+ return lon;
+ }
+
+ private static double asinh(double x) {
+ return Math.log(x + Math.sqrt(x*x + 1.0));
+ }
+
+ public static double latitudeToY(double lat) {
+ double frad = Math.toRadians(lat);
+ double ftan = Math.tan(frad);
+ double fsin = asinh(ftan);
+ double f = Math.toDegrees(fsin);
+ return f;
+ }