In my application i need to find mid point of some number(3 or more) of GPS points.
i have find the distance between the two points as below
public class DistanceOfGeoPoints {
public static long distanceinKMeters(double dblLat, double dblNewLat, double dblLong, double dblNewLong)
{
try
{
//double dblDistance = 180 / (dblPI * Math.Acos(Math.Sin(dblLat) * Math.Sin(dblNewLat) + Math.Cos(dblLat) * Math.Cos(dblNewLat) * Math.Cos(dblLong - dblNewLong)));
double dblDegree2Radius = Math.PI / 180;
double dbllongdiff = (dblNewLong - dblLong) * dblDegree2Radius;
double dbllatdiff = (dblNewLat - dblLat) * dblDegree2Radius;
double a = Math.pow(Math.sin(dbllatdiff / 2.0), 2) + Math.cos(dblNewLat * dblDegree2Radius) * Math.cos(dblLat * dblDegree2Radius) * Math.pow(Math.sin(dbllongdiff / 2.0), 2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
double dblDistance = 6367 * c; //Earth Radius * value (result in KM)
// return dblDistance;
long intdistance = (Math.round(dblDistance * 1000));
return intdistance;
}
catch (Exception ex)
{
return 0;
}
}
}
Now i want the mid point of the N number of GPS points
Please help me out.