Android examples for Map:Latitude Longitude
Calculate the amount of degrees of latitude for a given distance in meters.
/******************************************************************************* * Copyright (c) 2011 MadRobot./*from w w w. jav a2s. c om*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * Elton Kent - initial API and implementation ******************************************************************************/ import static java.lang.Math.cos; import static java.lang.Math.pow; import static java.lang.Math.sin; import static java.lang.Math.sqrt; import static java.lang.Math.tan; import java.util.List; import android.location.Location; public class Main{ /** * Calculate the amount of degrees of latitude for a given distance in meters. * * @param meters * distance in meters * @return latitude degrees */ public static double latitudeDistance(int meters) { return (meters * 360) / (2 * Math.PI * LocationConstants.EQUATORIALRADIUS); } }