On Sep 28, 2:59 pm, tluczyns <[email protected]> wrote:
> It is possible to count latitude delta (and longitude delta) from
> given distance in meters in Google Maps API?

longitude and latitudes are not measured in meters.

>
> I've done it with approximate function given below:
>
> function translateDistanceToDeltaLatLng(distance: Number): Object {
>         var deltaLat: Number = (distance * 180) / 20000; //20000 - half of
> Earth circumference
>         var deltaLng: Number = (distance * 360) / 20000;
>         return {lat: deltaLat, lng: deltaLng};
>
> }
>
> Is there a Google API function which can do better without
> approximation?

You can't calculate the distance in meters without knowing the
position on the earth.

The GLatLng.distanceFrom() method returns "straight line" distance
between 2 GLatLngs (not north/south, east/west components):
http://code.google.com/apis/maps/documentation/reference.html#GLatLng.distanceFrom

+ Returns the distance, in meters, from this location to the given
location. By default, this distance is calculated
+ given the default equatorial earth radius of 6378137 meters. The
earth is approximated as a sphere, hence the
+ distance could be off as much as 0.3%, especially in the polar
extremes.

But it seems rather straight forward to calculate the north/south and
east/west components with 2 separate calls (if you know the latitude
and longitude of the two end points).

This might be useful:
http://forums.howwhatwhy.com/showflat.php?Cat=&Board=scigen&Number=-208125

  -- Larry

>
> Tomek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to