On Apr 22, 12:25 pm, Disha <[email protected]> wrote: > Rosska/Esa > > Thanks for guidance, still it is returning incorrect value. As I > mentioned earlier my addres are > From Address - 4610 N Fairfax Drive, Arlington, VA 22203" > To Address - 2870 HIGHWAY 35, HAZLET, NJ 07730 > > Their long/lat information > From -> Longitude = 38.8818321228027 -> Latitude = -77.1175231933594 > To -> Longitude = 40.4165077209473 -> Latitude = -74.1717681884766 > > As you sugested I used Haversine formula with below code, let me know > what wrong I am doing?
>>> But if you compare in google map it return 227 miles. That is the driving distance: http://www.geocodezip.com/example_geo2.asp?addr1=4610%20N%20Fairfax%20Drive,%20Arlington,%20VA%2022203&addr2=%202870%20HIGHWAY%2035,%20HAZLET,%20NJ%2007730&geocode=1&geocode=2 The calculated "straight line" distance (as straight as a line can be on the surface of a ellipsoid) is: javascript:GLog.write(new GLatLng(38.881834, -77.117527).distanceFrom(new GLatLng(40.416506, -74.171771))); 304825.15 meters or 189.4 miles http://www.google.com/search?client=gmail&rls=gm&q=304825.15%20meters%20to%20miles You can't calculate the driving directions without a route to drive. -- Larry > On Apr 22, 2:44 pm, Esa <[email protected]> wrote: > > > > > > > On Apr 22, 9:34 pm, Disha <[email protected]> wrote: > > > > In the above mentioend url they are using following formula > > > float distance = ((Math.Abs((69.1 * (latitude1 - latitude2))) + > > > Math.Abs((53.0 * (longitude1 - longitude2)))); > > > > Can anyone tell me what wrong with the calculation? > > > Forget that formula. > > > This is a great resource of geo > > formulas.http://www.movable-type.co.uk/scripts/latlong.html -- 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.
