我没有太多的数学知识,但我无法找到为什么我收到不正确的数据。我试图从中心顶点(纬度,长度)和半径500英里找到圆周上的所有点。我通过将坐标传递给谷歌地图并获得状态列表来验证结果。输入纬度为41.8781,长-87,6297(芝加哥IL),我得到的结果只是状态IL
public List<Coordinates> PointOnCircle(double lat, double longi, float radius)
{
var r = radius / EARTH_RADIUS_NM;
var list = new List<Coordinates>();
for (int i = 0; i <= 360;)
{
Coordinates coordinates = new Coordinates();
// Convert from degrees to radians via multiplication by PI/180
double x = (r * Math.Cos(i * Math.PI / 180F)) + lat;
double y = (r * Math.Sin(i * Math.PI / 180F)) + longi;
coordinates.Latitude = x;
coordinates.Longitude = y;
i += 5;
list.Add(coordinates);
}
return list;
}
public Dictionary<string,string> GetStatesFromCordinates(List<Coordinates> coordinates)
{
var states = new Dictionary<string, string>();
foreach(var co in coordinates)
{
var geoLocation = GoogleService.GetGeoLocation(co.Latitude, co.Longitude);
var state= geoLocation.results.FirstOrDefault().address_components.FirstOrDefault(ac => ac.types.Any(ty => ty == "administrative_area_level_1"));
if(state != null)
{
var longstatename = state.long_name;
var shortstatename = state.short_name;
if(!states.ContainsKey(shortstatename))
states.Add(shortstatename, longstatename);
}
}
return states;
答案 0 :(得分:1)
根据以英里为单位的距离计算增量角的公式是错误的。虽然一个纬度在地球上任何地方约69英里,但经度取决于纬度。在赤道,经度有一定程度,但在极点,移动一度经度并不会让你走得很远。
有关适当使用的公式的讨论,请参阅https://gis.stackexchange.com/questions/142326/calculating-longitude-length-in-miles。