Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double getLat(int inY, int zoom) {
        double y = Math.floor(inY * 256);
        double efactor = Math.exp((0.5 - y / 256 / Math.pow(2, zoom)) * 4 * Math.PI);
        double latitude = Math.asin((efactor - 1) / (efactor + 1)) * 180 / Math.PI;
        if (latitude < -90.0) {
            latitude = -90.0;
        } else if (latitude > 90.0) {
            latitude = 90.0;
        }
        return latitude;
    }
}