1
Q
西南和东北点
A
回答
2
考虑:
A point (LAT, LNG) A distance or radius DIST 1° of latitude ~= 69 miles ~= 111 kms 1° of longitude ~= cos(latitude)*69 ~= cos(latitude)*111
的SW点是:
lng_sw = LNG - (DIST/abs(cos(radians(LAT))) * 111) lat_sw = LAT - (DIST/111)
的NE的一点是:
lng_ne = LNG + (DIST/abs(cos(radians(LAT))) * 111) lat_ne = LAT + (DIST/111)
如果您使用里程为您度量单位使用69而不是111 。
0
这是C#代码,如果有人需要
private double DegreeToRadian(double angle) {
return Math.PI * angle/180.0;
}
private bool CalculateNeSw(double distance, double lat, double lng, out MapPoint[] points) {
/*
* 1° of latitude ~= 69 miles ~= 111 kms, 1° of longitude ~= cos(latitude)*69 ~= cos(latitude)*111
* SW.LNG = LNG - (DIST/abs(cos(radians(LAT))) * 111), SW.LAT = LAT - (DIST/111)
* NE.LNG = LNG + (DIST/abs(cos(radians(LAT))) * 111), NE.LAT = LAT + (DIST/111)
*/
points = new MapPoint[2];
try {
double deltaLat = distance/69;
double deltaLng = distance/Math.Abs(Math.Cos(DegreeToRadian(lat)) * 69);
/* South-West */
points[1] = new MapPoint {
Lng = (lng - deltaLng).ToString(),
Lat = (lat - deltaLat).ToString(),
IsSet = true,
FormattedAddress = "South-West"
};
/* North-East */
points[0] = new MapPoint {
Lng = (lng + deltaLng).ToString(),
Lat = (lat + deltaLat).ToString(),
IsSet = true,
FormattedAddress = "North-East"
};
return true;
}
catch (Exception ex) {
return false;
}}
注:
的MapPoint与纬度/经度属性
我用英里一个简单的数据类==> 69
相关问题
- 1. OpenGL北,东,南,西
- 2. 从skmaps获取东北和西南
- 3. 两点之间的距离。东西+南北
- 4. 计算给定东北和西南的视口坐标
- 5. 如何在地图上找到北,南,东,西的方向?
- 6. ios在地图屏幕上获取东北和西南的坐标
- 7. Android的触摸方向西北,东北为UP方向,如果
- 8. 在MySQL东北和西南坐标的边界框内从数据库中获取所有点
- 9. 知道角度可能是北,南,西或东的最快代码
- 10. java:将char [] []数组中的元素移动一个空格,无论是北,南,东,西等。
- 11. 如何通过小数坐标确定纬度是北或南,还是经度西或东?
- 12. 在vsx中画点东西
- 13. C - 虽然(东西||东西)
- 14. 如果有东西存在,请用东西做点什么
- 15. 更改北/南取向的Android的MapView
- 16. 如何查找简写或标准版本的地址? N或北,西北或西北
- 17. 是什么应用程序之间(“东西”)和Session(“东西”)
- 18. 的NSString和的NSTextField东西
- 19. jquery:包含东西或其他东西
- 20. 在==东西或别的东西,
- 21. X =东西(X)的东西(X)
- 22. 东西好&关于SharePoint坏东西
- 23. PostgreSQL按季节分组(北半球和南半球)
- 24. ExtJS 3让南面板进入东面板和西面板之间
- 25. 批量东北亚sql在php
- 26. 来自东北部的Imagemagick作物
- 27. 如何编码这个西北方法
- 28. 断点不输出任何东西
- 29. Android通知,点击做东西
- 30. xmlns =“东西” - 必须在父节点