0

I am trying to create a mathematical formula to convert meters to decimal degrees.

Reading this article Decimal Degrees, I thought this generic formula:

x = (Value_in_meter * 0.00001)/1.1132

But I know it is not 100% correct, I should use the other values according where is my point.

I am using Google Maps Api, so, how to discover if my point is at 23N/S, 45N/S or 67N/S?

Complementing

I did this function:

public static double convertMeterToDegrees(double meter, double latitude){

    double quotient;
    double degree = Math.floor(latitude);
    double modDegree = Math.abs(degree);

    if (modDegree == 0){
        quotient = 1.1132;
    } else if (modDegree <= 23){
        quotient = 1.0247;
    } else if (modDegree <= 45){
        quotient = 0.7871;
    } else {
        quotient = 0.43496;
    }

    return (meter * 0.00001)/quotient;
}

Is it correct?

2

1 Answer 1

0

I have the belief that what you actually want to know in the end is the distance between two points. If that is the case, I have written this function in Python, and it calculates exactely the same distance along a track (accumulating distances between consecutive points of a KML file) which is returned by google maps track properties. You should check if it correctly implements the Haversine Function, though (take a look at wikipedia) since this function was written some time ago and I am not sure if it has been modified:

from math import *

def distance(lat1, lon1, lat2, lon2):
        lat1=radians(lat1); long1=radians(long1); lat2=radians(lat2); long2=radians(long2)
        EARTH_RADIUS = 6378.137
        d_lat = lat2 - lat1; d_long = long2 - long1
        a = sin(d_lat/2)**2 + cos(lat1) * cos(lat2) * sin(d_long/2)**2
        c = 2 * atan2(sqrt(a), sqrt(1-a))

        R=(EARTH_RADIUS**2)/sqrt((EARTH_RADIUS*cos(lat1))**2 + (EARTH_RADIUS*sin(lat1))**2)
        return R * c

Not the answer you're looking for? Browse other questions tagged or ask your own question.