otm*_*ger 7 python math gps dictionary coordinates
我有一组十进制表示法的GPS坐标,我正在寻找一种方法来找到每个位置周围可变半径的圆坐标.
这是我需要的一个例子.它是一个1km围绕坐标的半径圆47,11.
我需要的是找到圆的坐标的算法,所以我可以使用多边形在我的kml文件中使用它.理想的python.
有任何想法吗?
另请参阅为GPS坐标添加距离,以获得 lat/lon和短距离之间的简单关系.
这工作:
import math
# inputs
radius = 1000.0 # m - the following code is an approximation that stays reasonably accurate for distances < 100km
centerLat = 30.0 # latitude of circle center, decimal degrees
centerLon = -100.0 # Longitude of circle center, decimal degrees
# parameters
N = 10 # number of discrete sample points to be generated along the circle
# generate points
circlePoints = []
for k in xrange(N):
# compute
angle = math.pi*2*k/N
dx = radius*math.cos(angle)
dy = radius*math.sin(angle)
point = {}
point['lat']=centerLat + (180/math.pi)*(dy/6378137)
point['lon']=centerLon + (180/math.pi)*(dx/6378137)/math.cos(centerLat*math.pi/180)
# add to list
circlePoints.append(point)
print circlePoints
Run Code Online (Sandbox Code Playgroud)
在此处使用"目标点给定距离和从起点开始承载"的公式:
http://www.movable-type.co.uk/scripts/latlong.html
将您的中心点作为起点,将您的半径作为距离,并在0度到360度的多个轴承上循环.这将给你一个圆圈上的点,并将在极地工作,因为它到处使用大圆圈.
| 归档时间: |
|
| 查看次数: |
5392 次 |
| 最近记录: |