convert Latitude To Pixel - Java java.lang

Java examples for java.lang:Math Convert

Description

convert Latitude To Pixel

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 int convertLatToPixel(double lat) {
        return (int) Math.round(map_offset
                - map_radius/*from   w  ww  . j a va 2  s .  c om*/
                * Math.log((1 + Math.sin(lat * Math.PI / 180))
                        / (1 - Math.sin(lat * Math.PI / 180))) / 2);
    }
}

Related Tutorials