DJ_AM_Juicebox
asked on
Convert lat/ longitude to meters?
Hi,
Is there a way to convert latitude / longitude to meters? For example, I want to know (roughly) how many lat/lon units roughly equals 100 meters.
I have a bounding box that encloses some points on a map. I basically want to add 100 meters of padding around the bounding box (specified in lat/lon). So it doesn't need to be precise, just for presentation purposes.
Thanks
Is there a way to convert latitude / longitude to meters? For example, I want to know (roughly) how many lat/lon units roughly equals 100 meters.
I have a bounding box that encloses some points on a map. I basically want to add 100 meters of padding around the bounding box (specified in lat/lon). So it doesn't need to be precise, just for presentation purposes.
Thanks
pi = 3.14159265
f = 1/298.257223563
a = 6378137/1000
F = (lat1+lat2)/2
G = (lat1-lat2)/2
l = (lon1-lon2)/2
F = pi / 180 * F
G = pi / 180 * G
l = pi / 180 * l
S = sin(G)*sin(G) * cos(l)*cos(l) + cos(F)*cos(F) * sin(l)*sin(l)
C = cos(G)*cos(G) * cos(l)*cos(l) + sin(F)*sin(F) * sin(l)*sin(l)
w = atan(sqrt(S/C))
D = 2 * w * a
R = (sqrt(S*C)/w)
H1 = (3*R-1) / (2*C)
H2 = (3*R+1) / (2*S)
distanceInMeters = 1000 * D * (1+f*H1*sin(F)*sin(F) * cos(G) * cos(G) - f*H2*cos(F)*cos(F)*sin(G)* sin(G))
f = 1/298.257223563
a = 6378137/1000
F = (lat1+lat2)/2
G = (lat1-lat2)/2
l = (lon1-lon2)/2
F = pi / 180 * F
G = pi / 180 * G
l = pi / 180 * l
S = sin(G)*sin(G) * cos(l)*cos(l) + cos(F)*cos(F) * sin(l)*sin(l)
C = cos(G)*cos(G) * cos(l)*cos(l) + sin(F)*sin(F) * sin(l)*sin(l)
w = atan(sqrt(S/C))
D = 2 * w * a
R = (sqrt(S*C)/w)
H1 = (3*R-1) / (2*C)
H2 = (3*R+1) / (2*S)
distanceInMeters = 1000 * D * (1+f*H1*sin(F)*sin(F) * cos(G) * cos(G) - f*H2*cos(F)*cos(F)*sin(G)*
Further to ozo's comment, remember that the circumference of the earth is 40,000 km or 40,000,000 m (close enough for practical purposes anyway). That is equivalent to 360 degrees.
Hence 90 degrees = 40,000,000 / 4 = 10,000,000 m and
100 m = 90/100,000 = 3.24"
Hence 90 degrees = 40,000,000 / 4 = 10,000,000 m and
100 m = 90/100,000 = 3.24"
ASKER
Argh I am getting confused:
earth = 40,000,000 meters in circumference (roughly)
latitude is measured from -90 to +90 degrees, 180 degrees all together, so 1 meter in latitude is:
180 / 40,000,000
is that in any way correct?
Thanks
earth = 40,000,000 meters in circumference (roughly)
latitude is measured from -90 to +90 degrees, 180 degrees all together, so 1 meter in latitude is:
180 / 40,000,000
is that in any way correct?
Thanks
so 1 meter in latitude is 360/40,000,000
ASKER
Ok, so 1 meter in latitude = 360/40,000,000
the 1 meter in longitude is the same then?:
1 meter in longitude = 360/40,000,000
I guess the earth isn't perfectly round, but should be close enough?
the 1 meter in longitude is the same then?:
1 meter in longitude = 360/40,000,000
I guess the earth isn't perfectly round, but should be close enough?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
With longitudes you can't use the simple formula, unless you are close to the equator. The longitude lines come together at the poles, where 360 degrees = 0 metres. For that you need to use ozo's more general formula. For normal latitudes, say outside the arctic circles, the quick formula should be close enough, as you only want some padding.
for longitude, multiply that by cosine of the latitude