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?
=============================================
double dDistance = Double.MinValue;
double dLat1InRad = _Latitude1 * (Math.PI / 180.0);
double dLong1InRad = _Longitude1 * (Math.PI / 180.0);
double dLat2InRad = _Latitude2 * (Math.PI / 180.0);
double dLong2InRad = _Longitude2 * (Math.PI / 180.0);
double dLongitude = dLong2InRad - dLong1InRad;
double dLatitude = dLat2InRad - dLat1InRad;
// Intermediate result a.
double a = Math.Pow(Math.Sin(dLatitude / 2.0), 2.0) +
Math.Cos(dLat1InRad) * Math.Cos(dLat2InRad) *
Math.Pow(Math.Sin(dLongitude / 2.0), 2.0);
Response.Write(a);
Response.Write("<br>");
double c = 2.0 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1.0 - a));
double dist = c * 3956.55;
Response.Write(dist);
=============================================
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
> athttp://groups.google.com/group/google-maps-api?hl=en.
--
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.