加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT
Test Status PyPI downloads MIT License

trajectory

trajectory is a library for lossy compression of trajectory data based on Google's Encoded Polyline Algorithm Format (http://goo.gl/PvXf8Y). It is heavily based on (in fact forked from) https://github.com/hicsail/polyline.

Installation

trajectory can be installed using pip or easy_install

$ pip install trajectory
or
$ easy_install trajectory

API Documentation

Encoding

To serialize a trajectory (set of (lat, lon, unix time in seconds) tuples)

import trajectory
trajectory.encode([
    (38.500, -120.200, 1582482601),
    (40.700, -120.950, 1582482611),
    (43.252, -126.453, 1582482627)
], 5)

This should return _p~iF~ps|U_ynpijgz~G_ulLnnqC_c`|@_mqNvxq`@__t`B.

You can set the required precision with the optional precision parameter. The default value is 5.

Decoding

To deserialize a trajectory (set of (lat, lon, unix time in seconds) tuples) represented by an encoded string

import trajectory
trajectory.decode('_p~iF~ps|U_ynpijgz~G_ulLnnqC_c`|@_mqNvxq`@__t`B', 5)

This should return the following:

[
    (38.500, -120.200, 1582482601),
    (40.700, -120.950, 1582482611),
    (43.252, -126.453, 1582482627)
]

You can set the required precision with the optional precision parameter. The default value is 5.

Development

Setup Dependencies

$ poetry install

Running Tests

$ poetry run pytest

Contributing

Issues and pull requests are welcome.

  • For proposing new features/improvements or reporting bugs, create an issue.
  • Check open issues for viewing existing ideas, verify if it is already proposed/being worked upon.
  • When implementing new features make sure to add relavant tests and documentation before sending pull requests.
Copyright (c) 2014 Bruno M. Custódio Copyright (c) 2019 Frederick Jansen Copyright (c) 2020 B Krishna Chaitanya Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

python语言的采用google polyline对轨迹数据进行压缩编码和解码 展开 收起
Python
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化