from:http://blog.csdn.net/zhuqiuhui/article/details/53180395

1.  求两个经纬点的方位角,P0(latA, lonA), P1(latB, lonB)(很多博客写的不是很好,这里总结一下)

def getDegree(latA, lonA, latB, lonB):

"""

Args:

point p1(latA, lonA)

point p2(latB, lonB)

Returns:

bearing between the two GPS points,

default: the basis of heading direction is north

"""

radLatA = radians(latA)

radLonA = radians(lonA)

radLatB = radians(latB)

radLonB = radians(lonB)

dLon = radLonB - radLonA

y = sin(dLon) * cos(radLatB)

x = cos(radLatA) * sin(radLatB) - sin(radLatA) * cos(radLatB) * cos(dLon)

brng = degrees(atan2(y, x))

brng = (brng + 360) % 360

return brng

2.  求两个经纬点的距离函数:P0(latA, lonA), P1(latB, lonB)

def getDistance(latA, lonA, latB, lonB):

ra = 6378140 # radius of equator: meter

rb = 6356755 # radius of polar: meter

flatten = (ra - rb) / ra # Partial rate of the earth

# change angle to radians

radLatA = radians(latA)

radLonA = radians(lonA)

radLatB = radians(latB)

radLonB = radians(lonB)

pA = atan(rb / ra * tan(radLatA))

pB = atan(rb / ra * tan(radLatB))

x = acos(sin(pA) * sin(pB) + cos(pA) * cos(pB) * cos(radLonA - radLonB))

c1 = (sin(x) - x) * (sin(pA) + sin(pB))**2 / cos(x / 2)**2

c2 = (sin(x) + x) * (sin(pA) - sin(pB))**2 / sin(x / 2)**2

dr = flatten / 8 * (c1 - c2)

distance = ra * (x + dr)

return distance

python计算方位角_python实现两个经纬度点之间的距离和方位角相关推荐

  1. python计算两个点之间的距离_python实现两个经纬度点之间的距离和方位角的方法...

    最近做有关GPS轨迹上有关的东西,花费心思较多,对两个常用的函数总结一下,求距离和求方位角,比较精确,欢迎交流! 1. 求两个经纬点的方位角,P0(latA, lonA), P1(latB, lonB ...

  2. python 计算两个经纬度的距离_python实现两个经纬度点之间的距离和方位角的方法...

    最近做有关GPS轨迹上有关的东西,花费心思较多,对两个常用的函数总结一下,求距离和求方位角,比较精确,欢迎交流! 1. 求两个经纬点的方位角,P0(latA, lonA), P1(latB, lonB ...

  3. python基于经纬度距离汇聚点_python实现两个经纬度点之间的距离和方位角

    from:http://blog.csdn.net/zhuqiuhui/article/details/53180395 1.  求两个经纬点的方位角,P0(latA, lonA), P1(latB, ...

  4. geotools 计算两个经纬度点之间的距离

    geotools 计算两个经纬度点之间的距离 主要的maven依赖 代码实现 最近研究geotools,发现网上的直接搜索相关实现比较少,所以贴出示例代码,方便大家寻找. 主要的maven依赖 < ...

  5. python 笔记 haversine (两个经纬度坐标之间的距离)

    1 安装包 pip install haversine 2 haversine:计算两个点经纬度之间的距离 from haversine import haversine lyon = (45.759 ...

  6. Java:计算地球上两个经纬度坐标之间的距离-geodesy和geotools实现

    目录 方式一:自定义公式计算 方式二:geodesy计算距离 方式三:geotools计算距离 两个点的经纬度 latitude纬度 longitude经度 地点 22.678611 113.8056 ...

  7. python中文聊天_Python下两种曲线救国实现AIML中文聊天机器人功能的方法

    alicebot.jpg AIML,全称Artificial Intelligence Markup Language,是一种XML模式,用做自然语言聊天机器人的规则库. 最简单的AIML规则如下: ...

  8. php中getdistance函数_php计算两个经纬度地点之间的距离

    /** * @param $lat1 * @param $lng1 * @param $lat2 * @param $lng2 * @return int */ function getDistanc ...

  9. 球面上两个经纬度点之间的距离公式

    private static final double EARTH_RADIUS = 6378137.0; // private static double getRad(Double d) {ret ...

  10. php经纬度之间的距离计算公式,php计算两个经纬度地点之间距离的方法分享

    用php计算两个指定的经纬度地点之间的距离,代码: /** *求两个已知经纬度之间的距离,单位为米 *@param lng1,lng2 经度 *@param lat1,lat2 纬度 *@return ...

最新文章

  1. java Proxy(代理机制)
  2. AJAX 缓存问题的两种解决方法(IE
  3. linux mysql 5.6.22_linux下MySQL5.6.2安装过程
  4. HTTP使用BASIC认证的原理及实现方法
  5. 用例设计:判定表驱动法
  6. 使用Angular Router导航基础
  7. ipad如何连接电脑_台式电脑如何连接蓝牙耳机
  8. word——VBA编程
  9. 关闭appleid双重认证_iPhone 丢失怎么办?开启双重认证就能解决!
  10. 微软商店的iTunes备份文件路径正确修改方法(2022.3.25)
  11. 【Java】爬虫,看完还爬不下来打我电话
  12. 人纪--针灸---------12.7开始
  13. VUCA时代的领导力开发
  14. AWS创建用户、角色、策略
  15. 安鸾渗透实战平台综合渗透——SQL注入进阶渗透流程
  16. 【Axure高保真原型】能增删改的环形图
  17. Web前端从入门到精通自学之路
  18. 武汉工资收入现在一般是什么水平?
  19. 国仁网络资讯:短视频减肥瘦身项目怎么赚钱;揭秘减肥廋身项目具体操作玩法。
  20. 爬虫08-验证码的处理

热门文章

  1. IDEA内无法进行复制粘贴
  2. 序列化(boost serialization)
  3. Python做一个“盯盘机器人”,实时监控股票价格并通知你!
  4. 速读原著-TCP/IP(IP首部)
  5. python close函数_Python math.isclose() 方法
  6. 小程序更新数组操作push、pop、unshift、shift
  7. mysql查询多选项商品查询_MYSQL中的多类型查询及高级查询操作
  8. 最新仿720全景云系统/可生成小程序+带PC端和教程
  9. Difference between Vienna DL LLS and UL LLS
  10. std::weak_ptr(分析、仿写)