6378137 meters. For this very precise answer to make some sense, I have to refine Andy's question somewhat: "How does Google Maps convert a pair of LatLngs into a distance in meters?" If you assume the Earth is round, this is just basic spherical geometry, but you need to know the diameter of the Earth -- not just any diameter, but the one that Google uses. I've never seen that in the documentation, but you can work backwards. The Geometry Library http://code.google.com/intl/en/apis/maps/documentation/javascript/geometry.html states that it is based on the assumption that the Earth is a sphere. (The geometry library is part of V3, but I'm going to guess that the diameter of the Earth didn't change between versions.) The library doesn't give the radius. So ask for the distance from (0,0) to (0,90) (around the equator) and (0,0) to (0,90) (equator to pole). The result is equal (confirming that Google is using a sphere) and converts to a radius of 6378137 meters.
Note that, despite what you learned in the Third Grade, the Earth is NOT round. It's pretty closely approximated by an "oblate spheroid" (flattened at the poles). Unfortunately, it isn't exactly an oblate spheroid either, so using different parameters for that approximation (major axis a of ellipse and eccentricity e) gives better "fits" in some places than in others. So there is not universal agreement as what oblate spheroid to use, so you need to be aware of the "projection" used. Such as WGS 84 or Airy, for instance. http://en.wikipedia.org/wiki/Reference_ellipsoid Marcelo: SRID 4326 is not a sphere, but a spheroid. So it only has radius 6378137 at the equator, and a smaller radius at the poles. Google uses a 6378137 radius sphere. Using a sphere to approximate the shape of the Earth instead of one of the oblate spheroids can produce errors of 100s of meters over long distances. But if you're trying to determine the distance from Whiteman Air Force Base to Baghdad using Google Maps, you're using the wrong tool. - Jeff On Feb 7, 10:33 pm, Marcelo <[email protected]> wrote: > In PostgreSQL I use SRID 4326, and that has an Earth radius of 6378137 > meters. > > -- > Marcelo -http://maps.forum.nu > -- > > On Feb 7, 9:12 am, andy <[email protected]> wrote: > > > > > > > > > hi, > > > need help for correct google earth radius. > > > i am getting + 7 km approx mismatch on results. > > > i am passing 3961 miles as earth radius. > > > andy -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
