有没有可以在Python中使用的GPS库?
我正在寻找可以使用 GPS 坐标的 Python 库。比方说,我有一个坐标列表:
>>> gps = [
... (53.25012925, −6.24479338, 349.9, '2011-08-20T09:35:00Z'),
... (53.25028285, -6.24441800, 359.9, '2011-08-20T09:35:30Z'),
... (53.25049500, -6.24266032, 395.9, '2011-08-20T09:36:00Z'),
... # and so on...
... ]
>>>
我想计算平均速度、距离、获取最高点和其他信息。我知道,计算它非常简单,但我想知道是否有任何现有代码(我不喜欢重新发明轮子)。
注意:stackoverflow 中也有类似的问题(您会推荐哪个 gps 库对于Python?),但它是关于GPSD的。我没有使用任何设备,我只有文本文件中的 GPS 坐标。
I am looking for Python library, which can work with GPS coordinates. Let's say, I have a list of coordinates:
>>> gps = [
... (53.25012925, −6.24479338, 349.9, '2011-08-20T09:35:00Z'),
... (53.25028285, -6.24441800, 359.9, '2011-08-20T09:35:30Z'),
... (53.25049500, -6.24266032, 395.9, '2011-08-20T09:36:00Z'),
... # and so on...
... ]
>>>
I would like to compute average speed, distance, get the higest point, and other info. I know, it is quite simple to compute it, but I am wondering if there is any existing code (I do not like to reinvent the wheel).
Note: There is similar question here in stackoverflow (Which gps library would you recommend for python?), but it is about GPSD. I am not working with any device, I just have GPS coordinates in text file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现了一个有趣的库,名为 geopy。它可以计算两个GPS点之间的距离(它使用大圆距离和文森蒂距离方法)。最重要的是,geopy 可以进行地理编码(它可以从地址获取 GPS 坐标)。
其他特征(平均速度、最高点等)我可以自己破解。
I have found an interesting library named geopy. It can calculate distances between two GPS points (it uses great-circle distance and Vincenty distance methods). On top of that, geopy can do geocoding (it can get GPS coordinates from an address).
The other features (average speed, higest point, etc.) I can hack by myself.
您也许仍然可以使用 GPSD 的数据部分,而不是从头开始编写某些内容。以下代码来自 GPSD 源代码,并具有一个用于从 GPS 数据流创建路径的模块(然后获取路径长度等)
http://code.google.com/p/python-gpsd/source/browse/src/nmea/track.py
You may still be able to use data portions of GPSD, rather than writing something from scratch. The following code is from the GPSD source and has a module for making paths from streams of GPS data (and then getting the path length and whatnot)
http://code.google.com/p/python-gpsd/source/browse/src/nmea/track.py