SkillAgentSearch skills...

Pyrtklib

Unleash all the performance of the most popular GNSS library -- RTKLIB in python. A python binding for RTKLIB provides full functions

Install / Use

/learn @IPNL-POLYU/Pyrtklib
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

PyRTKLIB -- A bridge between AI and GNSS.

News

2025.10.03

We now support python 3.12 and 3.13. And we roughly adapt pyrtklib5 binding to rtklib_demo5 2.5.0 EX. But it's not fully tested. Please kindly report issue when you have trouble. And we have a more pythonic frontend called TASGNSS. Feel free to have try.

Our paper has been successfully published in IEEE Transactions on Intelligent Transportation Systems! If you find our tool useful, please cite our paper, thanks so much!

@ARTICLE{10965937,
  author={Hu, Runzhi and Xu, Penghui and Zhong, Yihan and Wen, Weisong},
  journal={IEEE Transactions on Intelligent Transportation Systems}, 
  title={pyrtklib: An Open-Source Package for Tightly Coupled Deep Learning and GNSS Integration for Positioning in Urban Canyons}, 
  year={2025},
  volume={26},
  number={7},
  pages={10652-10662},
  keywords={Global navigation satellite system;Deep learning;Python;Artificial intelligence;Weight measurement;Satellites;Receivers;Mathematical models;Training;Position measurement;Artificial intelligence;deep learning;GNSS;RTKLIB},
  doi={10.1109/TITS.2025.3552691}}

Note that Python 3.6 and 3.7 will be no longer supported in the future possible update, while Python 3.12 and 3.13 are now officially supported.

| Python | Linux(After 2010) | Macos Sonoma(M1) | Macos Ventura(Intel)| Windows | | :----: | :----: | :----: | :----: | :----: | | 3.6 | ❌ | ❌ | ❌ | ✅ | | 3.7 | ✅ | ❌ | ❌ | ✅ | | 3.8 | ✅ | ✅ | ✅ | ✅ | | 3.9 | ✅ | ✅ | ✅ | ✅ | | 3.10 | ✅ | ✅ | ✅ | ✅ | | 3.11 | ✅ | ✅ | ✅ | ✅ | | 3.12 | ✅ | ✅ | ✅ | ✅ | | 3.13 | ✅ | ✅ | ✅ | ✅ |

2024.10.25

  1. We opensourced a new light urban dataset with LOS/NLOS label and other sensor data. Please find and play in KLTDatset.

  2. We optimized the file structure, and put the example script to the example folder to avoid error importing issue. The example observation data is also uploaded to the folder.

2024.09.23

The preprint version of our paper pyrtklib: An open-source package for tightly coupled deep learning and GNSS integration for positioning in urban canyons is now available on arxiv.

We would greatly appreciate it if you could cite our work:

@misc{hu2024pyrtklibopensourcepackagetightly,
      title={pyrtklib: An open-source package for tightly coupled deep learning and GNSS integration for positioning in urban canyons}, 
      author={Runzhi Hu and Penghui Xu and Yihan Zhong and Weisong Wen},
      year={2024},
      eprint={2409.12996},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2409.12996}, 
}

2024.09.22 v0.2.7 Experimental Features - Tightly coupled deep learning and GNSS integration

  1. A tightly coupled deep learning and GNSS integration subsystem is currently under development and several useful functions are implemented(e.g. weight least squares in rtk_util.py)! For more details, please refer to the dev repo TDL-GNSS.

  2. A File Wrapper has been introduced to manage the context of file descriptors. In previous versions, the file handler lacked proper context management. In this version, the "FILE*" parameters are replaced by a FileWrapper. For more details, refer to the definition in cbind.h. Additionally, the previous expansion const char *filename, const char *mode is still supported.

    Here is an example: Suppose you need to use an RTCM stream from an NTRIP server, and the file may be updated frequently. We can use the following program to create a FileWrapper:

    import pyrtklib as prl
    
    def get_rtcmf(rtcm, fp):
        ret = 1
        while ret != -2:
            ret = prl.input_rtcm3f(rtcm, fp)
        fp.cleareof()  # Clears EOF to continue reading
        return rtcm
    
    rtcm = prl.rtcm_t()
    prl.init_rtcm(rtcm)
    eph_file = prl.FileWrapper("eph.rtcm3", "rb")
    get_rtcmf(rtcm, eph_file)
    

    Note that the cleareof() method uses clearerr() to reset the EOF status of file reading, allowing the program to continue reading from where it left off rather than starting from the beginning.

2024.07.10 Add windows support

The release packages now are built with github actions. And windows support is testing. They are available on linux, macos, and windows now. If you find any bug, please submit issues.

| Python | Linux(After 2010) | Macos Sonoma(M1) | Macos Ventura(Intel)| Windows | | :----: | :----: | :----: | :----: | :----: | | 3.6 | ❌ | ❌ | ❌ | ✅ | | 3.7 | ✅ | ❌ | ❌ | ✅ | | 3.8 | ✅ | ✅ | ✅ | ✅ | | 3.9 | ✅ | ✅ | ✅ | ✅ | | 3.10 | ✅ | ✅ | ✅ | ✅ | | 3.11 | ✅ | ✅ | ✅ | ✅ |

2024.07.08 v0.2.6 Bug fix

  • The attributions about PRNQZS and PRNIRN are set to the right number now.
  • In cbind.h, I forgot to allocate one more byte for string to store '\0', thus segmentation fault may occur in function "convertChar" (I met several times). Besides, in convertType, the copy size is not correct and only the first object is copied. All the bugs now have been fixed.

2023.11.23 v0.2.5 Optimize the folder structure

In previous versions, the .so file is directly in site-packages folder, which is disgusting. To let the code editor can make use of the .pyi, the .so file is moved, and is loaded by the init.py file now.

2023.11.07 v0.2.4 Update the rtklib to 2.4.3 b34

I found that there is a more recent branch on rtklib, thus I update the rtklib to 2.4.3 b34.

  • The support number of Beidou up to 63
  • No implementation functions are deleted. I don't know why they remain in the source code.
    • readfcb
    • init_cmr
    • free_cmr
    • update_cmr
  • And these files are deleted
    • delete pyrtklib/rtksrc/qzslex.c
    • delete pyrtklib/rtksrc/rcv/gw10.c
    • delete pyrtklib/rtksrc/rcv/rcvlex.c

2023.11.05 v0.2.3 Bug fix and code optimization

This version contains follow updates:

  1. Using template binding functions to replace binding macros.
  2. Arr1Dchar now has an own constructor and can be constructed from a python string.
    output_path = Arr1Dchar("pyexample_output.txt")
    
  3. Now all the pointer member in structure has a setter function, you can directly modify it like:
    obs = obs_t()
    data = Arr1Dobsd_t(100)
    obs.data = data
    obs.n = len(data)
    obs.nmax = obs.n
    
    But it's not recommended to do so, because this may lead memory leakage. Many pointers in rtklib may refer to anther variable, thus, call free() to directly clear it may cause other problems. Please make sure you won't modify it too often.
  4. obs.set_data() has been removed.
  5. "FILE*" params in functions (input_ubxf, input_rawf e.g.) is devided into "const char *filename, const char *mode", the file open operation will be processed in the overloaded function. Here is an example.
    raw = raw_t()
    ret = input_rawt(raw,STRFMT_UBX,Arr1Dchar("example.ubx"),Arr1Dchar("rb"))
    
  6. Fix a serious bug on MacOS in rtkcmn.c. On MacOS (or BSD), _POSIX_C_SOURCE should larger than 199309, or the function strtok_r will have a different behavior, and make segmentation fault.
  7. Optimized the example.

2023.10.14 Install via pip

Big Progress!!!!

Now you can install it via pip

pip install pyrtklib

Introduction

This is a Python binding for RTKLIB, the most popular GNSS-RTK positioning C library. However, many researchers are currently using Python for research, especially in deep learning field. Thus, we implement this Python interface of RTKLIB to build a bridge between Python and positioning. By means of RTKLIB, you can easily read data from rinex file and process the positioning using the methods provided by RTKLIB, such as SPP, RTK, PPP.

If you want to use the rtklib deeply, please refer to the point position example.

If you just need the result, please refer to the post position example.

If you want to use the rtklib version based on rtklibexplorer/rtklib_demo5, please refer to pyrtklib_demo5.

Why pyrtklib?

| Project | pyrtklib | rtklib-py | pyRTKLib | | :----: | :----: | :----: | :----: | | Author | Runzhi Hu | Tim Everett | Alain Muls| | Implementation Method| C++ with pybind11 | Pure python | Directly use rtklib binary | | pros | All functions and structures in rtklib are available.| Modern and easy interface| easy to plot | | cons | Interfaces are in C style, need further wrapping for convenience | No support for BDS, and only supports PPK solutions currently.| More focus on plotting, can't be used for deep process of positioning | | Installation| pip install | git clone | git clone|

<table> <tr sytle="font-size:10px"> <td width='50%' style="vertical-align:top;">

Python Code

</td> <td width='50%' style="vertical-align:top;">

C Code

</td> </tr> </table>

Installation

Install Via Pip (Recommend)

pip install pyrtklib

The package relies on both system version and pyt

View on GitHub
GitHub Stars166
CategoryDevelopment
Updated1d ago
Forks29

Languages

C

Security Score

100/100

Audited on Mar 26, 2026

No findings