Python 反向地球编码器在试图跟踪国际空间站时无法正常工作
当我试图使用Python 反向地球编码器在试图跟踪国际空间站时无法正常工作,python,python-3.x,Python,Python 3.x,当我试图使用reverse\u geocoder库来跟踪国际空间站(与ephem一起)时,我得到了严重不匹配的国家,并且坐标根本没有变化(一段时间后睡眠10秒为真),考虑到ephem返回的坐标是正确的(约1度),这不应该发生 以下是我仅用于坐标的代码,该代码有效: import ephem import time name = "ISS (ZARYA)" line1 = "1 25544U 98067A 19357.29284137 -.00000119 00000-0 59685-5
reverse\u geocoder
库来跟踪国际空间站(与ephem一起)时,我得到了严重不匹配的国家,并且坐标根本没有变化(一段时间后睡眠10秒为真),考虑到ephem返回的坐标是正确的(约1度),这不应该发生
以下是我仅用于坐标的代码,该代码有效:
import ephem
import time
name = "ISS (ZARYA)"
line1 = "1 25544U 98067A 19357.29284137 -.00000119 00000-0 59685-5 0 9991"
line2 = "2 25544 51.6427 143.8164 0007706 64.3789 19.8690 15.50124701204590"
while True:
iss = ephem.readtle(name, line1, line2)
iss.compute()
print ( iss.sublat, iss.sublong )
time.sleep(5)
下面是我与reverse_geocoder一起使用的代码:
import reverse_geocoder as rg
import time
from ephem import readtle, degree
name = "ISS (ZARYA)"
line1 = "1 25544U 98067A 19357.29284137 -.00000119 00000-0 59685-5 0 9991"
line2 = "2 25544 51.6427 143.8164 0007706 64.3789 19.8690 15.50124701204590"
iss = readtle(name, line1, line2)
while True:
iss.compute()
pos = (iss.sublat / degree, iss.sublong / degree)
location = rg.search(pos)
print(location)
time.sleep(10)
(你必须自己结束这些程序,否则它们将永远运行)
第二个项目持续返回安道尔的一个地点,而国际空间站在澳大利亚附近;此外,返回的坐标reverse\u geocoder
从未改变,这根本不正常
考虑到它接收到的坐标是正确的,为了使第二个代码工作,我能做些什么
更新:检查了reverse\u geocoder
查找名称的表格后,我发现它打印的安道尔城市正是列表中的第一个元素。rg.search
命令实际上并不需要经过第一个元素