# -*- coding: utf-8 -*- # -------------------------------------- # DATE: 2018-12-09 # OUT: calculate_line_distance_amap.py # DEV: yulong # -------------------------------------- import sys import math NF_pi = 0.01745329251994329 #//创建1角度:PI/180弧度...... start_longitude = float(sys.argv[1]) start_latitude = float(sys.argv[2]) end_longitude = float(sys.argv[3]) end_latitude = float(sys.argv[4]) print(start_longitude) d2 = start_longitude * NF_pi d3 = start_latitude * NF_pi d4 = end_longitude * NF_pi d5 = end_latitude * NF_pi d6 = math.sin(d2) d7 = math.sin(d3) d8 = math.cos(d2) d9 = math.cos(d3) d10 = math.sin(d4) d11 = math.sin(d5) d12 = math.cos(d4) d13 = math.cos(d5) arrayOfDouble10 = (d9 * d8) arrayOfDouble11 = (d9 * d6) arrayOfDouble12 = d7 arrayOfDouble20 = (d13 * d12) arrayOfDouble21 = (d13 * d10) arrayOfDouble22 = d11 d14 = math.sqrt((arrayOfDouble10 - arrayOfDouble20) * (arrayOfDouble10 - arrayOfDouble20) + (arrayOfDouble11 - arrayOfDouble21) * (arrayOfDouble11 - arrayOfDouble21) + (arrayOfDouble12 - arrayOfDouble22) * (arrayOfDouble12 - arrayOfDouble22)); print(math.asin(d14 / 2.0) * 12742001.579854401)
高德地图计算两坐标之间直线距离-python
最新推荐文章于 2022-08-17 08:59:33 发布