Search code examples
javascriptgoogle-maps-api-3

Google API V3: computeOffset function


I would like to know the units of measurement for the ComputeOffset function in the geometry library in Google Maps API V3.

The documentation says

computeOffset(from:LatLng, distance:number, heading:number, radius?:number)

I can see that heading is in degrees. In what units is the distance. What is the use of the optional radius?

Any help is appreciated.


Solution

  • The distance is in meters.

    radius is defined in the first method listed.

    The radius defaults to the Earth's radius in meters

    If you change the radius to be in other units (like miles), the answer will be in those units.