问题描述
我正在寻找一个免费的 python 库,它可以根据 GPS 坐标计算你的方向和速度,也许可以计算你是否在某些边界或类似的地方.
I'm looking for a free library for python that can calculate your direction and your speed from GPS coordinates and maybe can calculate if you are in some boundaries or things like this.
是否有您知道并且对您很有效的库?
Are there Libraries that you know and that worked well for you?
我们在 linux 机器上使用 python 并从 gpsd 获取数据.所以我希望不需要一个只与设备对话的特殊库.我正在寻找的是 python 代码对数据进行一些基本计算.比如比较最后的位置,计算速度和方向.
We are using python on a linux machine and getting the data from the gpsd. So I hope there is no need for a speciel library for only talking to the device. What I'm looking for is python code doing some basic calculations with the data. Such as comparing the last positions and calculate speed and direction.
推荐答案
显然gpsd自带的python模块是我们最好的模块.
Apparently the python module that comes with gpsd is the best module to go with for us.
gpsd 自带的gps 模块有一些非常有用的功能.第一个是从 gpsd 获取数据并将这些数据转换为可用的数据结构.然后,模块可以让您访问您的速度,以及您当前相对于北方的航向.还包括一个函数,用于计算地球上两个坐标之间的距离,同时考虑到地球的球形特性.
The gps module coming with the gpsd has some very useful functions. The first one is getting the data from gpsd and transforming those data in a usable data structure. Then the moduls give you access to your speed, and your current heading relative to north. Also included is a function for calculating the distance between two coordinates on the earth taking the spherical nature of earth into account.
我们的特殊情况缺少的函数是:
The functions that are missing for our special case are:
计算点之间的航向.意味着我在一个面向北方的点,我必须转向哪个角度才能面向我想要导航到的点.
Calculating the heading between to points. Means I am at point a facing north to which degree do I have to turn to face the point I want to navigate to.
利用第一个函数的数据和我们当前的航向来计算我们面对所需点所必须做的转角(没什么大不了的,因为它大多只是一个减法)
Taking the data of the first function and our current heading to calculate a turn in degrees that we have to do to face a desired point (not a big deal because it is mostly only a subtraction)
使用这个库的最大问题是它主要是 gpsd 的包装器,所以如果你在不同的操作系统上编程,那么你的 gpscode 应该像 Windows 或 MacOS 一样工作,你无法运行代码或安装模块.
The biggest problem for working with this library is that it is mostly a wrapper for the gpsd so if you are programming on a different OS then you gpscode should work on like Windows or MacOS you are not able to run the code or to install the module.
这篇关于你会为 python 推荐哪个 gps 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!