Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static double[] geoToMercator(double[] g) {
        double d = g[0] * Math.PI / 180, m = g[1] * Math.PI / 180, l = 6378137, k = 0.0818191908426,
                f = k * Math.sin(m);
        double h = Math.tan(Math.PI / 4 + m / 2), j = Math.pow(Math.tan(Math.PI / 4 + Math.asin(f) / 2), k),
                i = h / j;
        // return new DoublePoint(Math.round(l * d), Math.round(l *
        // Math.log(i)));
        return new double[] { l * d, l * Math.log(i) };
    }
}