convert Pixel To Latitude - Java java.lang

Java examples for java.lang:Math Convert

Description

convert Pixel To Latitude

Demo Code


//package com.java2s;

public class Main {
    static private int map_offset = 268435456;
    static private double map_radius = map_offset / Math.PI;

    static public double convertPixelToLat(int px) {
        return Math.asin((Math.pow(Math.E,
                ((map_offset - px) / map_radius * 2)) - 1)
                / (1 + Math.pow(Math.E,
                        ((map_offset - px) / map_radius * 2))))
                * 180 / Math.PI;/* w  w  w. j a v  a  2  s .  c  o m*/
    }
}

Related Tutorials