Calculate the area of a polygon with latitude and longitude
I have this code, written using this: source1 and this: source 2 public static double CalculatePolygonArea(IList<GpsLocation> coordinates) { double area = 0; if (coordinates.Count > 2) { for (var i = 0; i < coordinates.Count-1; i++) { GpsLocation p1, p2; p1 = coordinates[i]; p2 = coordinates[i + 1]; area += ToRad(p2.Longitude - p1.Longitude) * (2 + Math.Sin(ToRad(p1.Latitude)) + Math.Sin(ToRad(p2.Latitude))); area = area * R * R / 2; } } return Math.Abs(area); } Here is my test code: [Fact] public void GpsPolygonAreaTest() { var poly = new List<GpsLocation>(); var p1 = new GpsLocation(0, 0);