我有一组十进制表示法的 GPS 坐标,我正在寻找一种方法来找到每个位置周围半径可变的圆中的坐标。
Here is an example我需要的东西。它是围绕坐标 47,11
以 1km
为半径的圆。
我需要的是查找圆坐标的算法,这样我就可以在我的 kml 文件中使用多边形了。非常适合 python。
最佳答案
另见 Adding distance to a GPS coordinate用于纬度/经度与短程距离之间的简单关系。
这个有效:
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
关于python:查找围绕某个 GPS 位置的圆的 GPS 坐标的优雅方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15886846/