I've come up with a method that takes a coordinate and a range (in miles) and return a list of coordinates that form a circle around the origin. I seem to have made some progress with it, but I have an issue with getting the range part down.
private const Double LAT_MILE = 0.0144839;
private const Double LONG_MILE = 0.0190693;
public static List<Gps.Coordinate> GetRadius(Double OriginLatitude, Double OriginLongitude, Double Range, int Points)
{
List<Gps.Coordinate> Result = new List<Coordinate>();
//insert a new point
for (int i = 0; i < Points; i++)
{
Result.Add(new Gps.Coordinate()
{
Latitude = ((Range * LAT_MILE) * System.Math.Cos(i)) + OriginLatitude,
Longitude = ((Range * LONG_MILE) * System.Math.Sin(i)) + OriginLongitude
});
}
//sort using nearest neighbor
return SortCoords(ref Result);
}
The issue I've found is that the constant I'm using to tell the distance in miles to degrees changes depending on location.. Does anyone have any suggestions for resolving this issue, or a better mousetrap altogether?
EDIT: I should note, I'm horrible at math :)