python:查找围绕某个 GPS 位置的圆的 GPS 坐标的优雅方法

标签 python dictionary math gps coordinates

我有一组十进制表示法的 GPS 坐标,我正在寻找一种方法来找到每个位置周围半径可变的圆中的坐标。

Here is an example我需要的东西。它是围绕坐标 47,111km 为半径的圆。

我需要的是查找圆坐标的算法,这样我就可以在我的 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/

相关文章:

python - OpenCV Haar 特征检测,仅限于 Camshift 跟踪区域

c# - 如何将字典分配给组合框的项目(显示和值成员)?

python - 为什么字典排序是不确定的?

python - pyEphem - 计算非地球卫星的位置

Python单元测试: Assertion Error issue

python - 比较第一个字典中的键与第二个字典中的值

python - PyCharm 显示 input() 函数错误

java - 迭代Hashmap时更新不同的项目

c++ - 通过 MPI 在集群中进行主成分分析

flash - 将二维坐标转换为等距坐标