### Install and Launch PyGPSClient Source: https://context7.com/semuconsulting/pygpsclient/llms.txt Standard installation and launching of the PyGPSClient application using pip. Includes instructions for virtual environment setup. ```bash python3 -m pip install --upgrade pygpsclient ``` ```bash python3 -m venv pygpsclient source pygpsclient/bin/activate # or .\pygpsclient\Scripts\activate on Windows python3 -m pip install --upgrade pygpsclient ``` ```bash pygpsclient ``` -------------------------------- ### Download and run Debian installation script Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Downloads the PyGPSClient installation script for Debian-based systems, makes it executable, and then runs it to install PyGPSClient and its dependencies. ```shell wget https://raw.githubusercontent.com/semuconsulting/PyGPSClient/refs/heads/master/examples/pygpsclient_debian_install.sh # or use curl -O ... if you prefer chmod +x pygpsclient_debian_install.sh ./pygpsclient_debian_install.sh ``` -------------------------------- ### Set up and install PyGPSClient in a virtual environment Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Best practice for managing dependencies. This creates a virtual environment, activates it, installs PyGPSClient, and then runs the application. ```shell python3 -m venv pygpsclient source pygpsclient/bin/activate # (or .\pygpsclient\Scripts\activate on Windows) python3 -m pip install --upgrade pygpsclient pygpsclient ``` -------------------------------- ### Install PyGPSClient using pipx Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Installs pipx if not already present, ensures its binaries are in the PATH, and then installs PyGPSClient using pipx for simplified virtual environment management. ```shell python3 -m pip install pipx # if not already installed pipx ensurepath # ensures venv binaries folder is in PATH pipx install pygpsclient ``` -------------------------------- ### Example Preset Formats Source: https://github.com/semuconsulting/pygpsclient/blob/master/README.md These are examples of how UBX, NMEA, and TTY messages are formatted as presets in configuration files. Note the different delimiters and structures for each message type. ```text Configure NAV-STATUS Message Rate on ZED-F9P, CFG, CFG-MSG, 0103000100000000, 1 Configure UART baud rate on LGSERIES; P; QTMCFGUART; W,460800; 1 IM19 System reset CONFIRM; AT+SYSTEM_RESET ``` -------------------------------- ### Convert UBX Preset Example Source: https://github.com/semuconsulting/pygpsclient/blob/master/RELEASE_NOTES.md An example script demonstrating the usage of ubx2preset() and nmea2preset() helper functions for converting UBX presets. This is part of the enhancements in Release 1.5.10. ```python from pygpsclient.helpers import ubx2preset, nmea2preset # Example usage (assuming you have UBX or NMEA data) # ubx_data = b'...' # Replace with actual UBX data # nmea_data = "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47" # Convert UBX to preset (example placeholder) # preset_from_ubx = ubx2preset(ubx_data) # print(f"UBX Preset: {preset_from_ubx}") # Convert NMEA to preset (example placeholder) # preset_from_nmea = nmea2preset(nmea_data) # print(f"NMEA Preset: {preset_from_nmea}") # Note: Actual data and function calls would be needed for a runnable example. ``` -------------------------------- ### UBX Configuration File Examples Source: https://github.com/semuconsulting/pygpsclient/blob/master/RELEASE_NOTES.md Examples of hexadecimal representations of MON-VER and CFG_VALGET UBX messages found in u-center *.txt configuration files for Generation 9+ devices. ```text MON-VER - 0A 04 DC 00 45 ... CFG-VALGET - 06 8B 44 01 ... CFG-VALGET - 06 8B 44 01 ... ``` -------------------------------- ### Install PyGPSClient in a virtual environment Source: https://github.com/semuconsulting/pygpsclient/blob/master/README.md Commands to create, activate, install dependencies into, and deactivate a Python virtual environment for PyGPSClient. ```shell python3 -m venv pygpsclient source pygpsclient/bin/activate # (or .\pygpsclient\Scripts\activate on Windows) python3 -m pip install --upgrade pygpsclient deactivate ``` -------------------------------- ### Install PyGPSClient using pip Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Use this command to install or upgrade PyGPSClient to the latest version. It's recommended to use the `python3 -m pip` form for clarity, especially with multiple Python installations. ```shell python3 -m pip install --upgrade pygpsclient ``` -------------------------------- ### Install PyGPSClient on Arch Linux Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Use this script to install PyGPSClient on Arch-based systems. Ensure you have curl installed. ```shell curl -O https://raw.githubusercontent.com/semuconsulting/PyGPSClient/refs/heads/master/examples/pygpsclient_arch_install.sh # or use wget ... if you prefer chmod +x pygpsclient_arch_install.sh ./pygpsclient_arch_install.sh ``` -------------------------------- ### Example Usage: Convert Single UBX File Source: https://context7.com/semuconsulting/pygpsclient/llms.txt Demonstrates how to use the 'convert_ubx_file_to_preset' function to convert a single UBX file and print the resulting preset string. Assumes 'config_zedf9p.ubx' exists. ```python # Usage example preset = convert_ubx_file_to_preset( "config_zedf9p.ubx", "ZED-F9P Base Station Configuration" ) print(f'Add to ubxpresets_l in config file:\n"{preset}",') ``` -------------------------------- ### Install Rust Compiler and Build Dependencies Source: https://github.com/semuconsulting/pygpsclient/blob/master/README.md Use this command to install the Rust compiler and necessary build dependencies on 32-bit Linux platforms like Raspberry Pi OS to install the 'cryptography' package. ```shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh sudo apt-get install build-essential libssl-dev libffi-dev python3-dev pkg-config ``` -------------------------------- ### Example PyGPSClient Configuration File Structure Source: https://context7.com/semuconsulting/pygpsclient/llms.txt Illustrates the structure of a typical `pygpsclient.json` configuration file, including settings for NMEA, UBX, RTCM protocols, presets, and user preferences. ```json { "version_s": "1.6.6", "screengeom_s": "1373x798+71+44", "showsettings_b": 1, "nmeaprot_b": 1, "ubxprot_b": 1, "rtcmprot_b": 1, "degreesformat_s": "DD.D", "units_s": "Metric m/s", "maptype_s": "world", "mapzoom_n": 10, "mqapikey_s": "YOUR_MAPQUEST_API_KEY", "datalog_b": 0, "logformat_s": "Binary", "recordtrack_b": 0, "database_b": 0, "serialport_s": "/dev/ttyACM0", "bpsrate_n": 115200, "timeout_f": 0.1, "ubxpresets_l": [ "Enable NAV-PVT on USB, CFG, CFG-VALSET, 000100000691200001, 1", "Poll MON-VER, MON, MON-VER, , 0", ], "nmeapresets_l": [ "Configure 10Hz fix rate; P; QTMCFGFIX; W,10; 1", ], "ttypresets_l": [ "Septentrio Init; SSSSSSSSSS", ], "ntripclientserver_s": "rtk2go.com", "ntripclientport_n": 2101, "ntripclientmountpoint_s": "", "ntripclientuser_s": "anon", "colortags_l": [ ["NAV-PVT", "#00FF00"], ["ERROR", "#FF0000"], ["WARNING", "#FFFF00"], ], "usermaps_l": [ ["/path/to/custommap.tif", [51.0, -1.5, 52.0, -0.5]], ], } ``` -------------------------------- ### PyGPSClient Command Line Arguments Source: https://context7.com/semuconsulting/pygpsclient/llms.txt Examples of launching PyGPSClient with various command-line arguments to customize configuration, ports, API keys, and logging. ```bash pygpsclient --config /path/to/myconfig.json ``` ```bash pygpsclient --userport /dev/ttyUSB0 ``` ```bash pygpsclient --mqapikey YOUR_MAPQUEST_API_KEY ``` ```bash pygpsclient --ntripcasteruser myuser --ntripcasterpassword mypassword ``` ```bash pygpsclient --verbosity 4 ``` ```bash pygpsclient --verbosity 3 --logtofile /path/to/pygpsclient.log ``` -------------------------------- ### Install Python Tkinter and LibSpatialite on macOS Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Use this command to install Python with Tkinter support and libspatialite on macOS using Homebrew. This is an alternative to official Python.org installers if specific non-default configurations are needed. ```shell brew install python-tk@3.13 libspatialite ``` -------------------------------- ### Install optional dependency rasterio Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Installs the 'rasterio' package, which is required for the 'Import Custom Map' facility in PyGPSClient. ```shell python3 -m pip install rasterio ``` -------------------------------- ### Install rasterio on Debian-based Linux Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Alternative method to install 'rasterio' using the system's package manager on some Linux distributions. ```shell sudo apt install python3-rasterio ``` -------------------------------- ### TTY Presets Examples Source: https://github.com/semuconsulting/pygpsclient/blob/master/RELEASE_NOTES.md Examples of ASCII TTY commands for various GNSS and related devices, including Septentrio Mosaic X5 Receiver and Feyman IM19 IMU. This is part of the enhancements in Release 1.5.9. ```python # examples/ttypresets_examples.py # Example for Septentrio devices: Send an 'Initialise Command Mode' string first. # initialise_command_mode = "SSSSSSSSSS\r\n" # Example commands (replace with actual commands for your device): # command1 = "YOUR_COMMAND_1\r\n" # command2 = "YOUR_COMMAND_2\r\n" # If the 'Delay checkbox' is checked in the TTY Preset Commands dialog, # a small delay will be inserted between individual TTY commands. # Note: This is a conceptual example. The actual script would involve # serial communication setup and sending these commands. ``` -------------------------------- ### Install optional dependency cryptography Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Installs the 'cryptography' package, necessary for decrypting SPARTN messages within the PyGPSClient console. ```shell python3 -m pip install cryptography ``` -------------------------------- ### Get PyGPSClient command line help Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Displays available command-line arguments and options for PyGPSClient, which can override configuration file settings. ```shell pygpsclient -h ``` -------------------------------- ### GNSSMQTTClient Utility Source: https://github.com/semuconsulting/pygpsclient/blob/master/RELEASE_NOTES.md Example of using the GNSSMQTTClient as a command line utility. Refer to the pygnssutils documentation for more details. ```bash gnssmqttclient --help ``` -------------------------------- ### Install Tk and LibSpatialite on Arch-based Linux Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Installs Tk and libspatialite packages on Arch-based Linux distributions. These are common dependencies for PyGPSClient on this platform. ```shell sudo pacman -S tk libspatialite ``` -------------------------------- ### Install PyGPSClient on MacOS Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md This script installs PyGPSClient on MacOS 13+ with ZSH. It also installs Python 3 with tkinter 8.6. Ensure you have curl installed. ```shell curl -O https://raw.githubusercontent.com/semuconsulting/PyGPSClient/refs/heads/master/examples/pygpsclient_macos_install.sh chmod +x pygpsclient_macos_install.sh ./pygpsclient_macos_install.sh ``` -------------------------------- ### Create Linux Desktop Entry File Source: https://github.com/semuconsulting/pygpsclient/blob/master/APPLAUNCH.md Create a .desktop file for Linux distributions to register PyGPSClient as an application. This file specifies the application type, terminal usage, name, icon, and executable path. ```ini [Desktop Entry] Type=Application Terminal=false Name=PyGPSClient Icon=/home/myuser/pygpsclient/lib/python3.11/site-packages/pygpsclient/resources/pygpsclient.ico Exec=/home/myuser/pygpsclient/bin/pygpsclient ``` -------------------------------- ### Reactivate and run from virtual environment Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Commands to reactivate a virtual environment and then launch PyGPSClient from within it. ```shell source pygpsclient/bin/activate # (or .\pygpsclient\Scripts\activate on Windows) pygpsclient ``` -------------------------------- ### Run PyGPSClient from the command line Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Launches the PyGPSClient application. This assumes the Python binaries folder is in your system's PATH. ```shell pygpsclient ``` -------------------------------- ### Process Multiple UBX Configuration Files Source: https://context7.com/semuconsulting/pygpsclient/llms.txt Iterates through a list of UBX configuration files, converts each to a preset string, and prints them. Includes basic error handling for 'FileNotFoundError'. ```python # Process multiple configuration files config_files = [ ("rover_config.ubx", "Rover Configuration"), ("base_config.ubx", "Base Station Configuration"), ("survey_config.ubx", "Survey-In Configuration"), ] for filename, desc in config_files: try: preset = convert_ubx_file_to_preset(filename, desc) print(f'"{preset}",') except FileNotFoundError: print(f"File not found: {filename}") ``` -------------------------------- ### Initialize UBX Presets with INIT_PRESETS Source: https://github.com/semuconsulting/pygpsclient/blob/master/RELEASE_NOTES.md To reinstate the initial set of user-defined UBX presets, insert the item "INIT_PRESETS" at the top of the "ubxpresets_l" configuration setting. Note that initial UBX CFG-VALSET commands take effect in volatile RAM; save to BBR to persist. ```json "INIT_PRESETS" ``` -------------------------------- ### Convert UBX Configuration File to Preset String Source: https://context7.com/semuconsulting/pygpsclient/llms.txt Converts a binary UBX configuration file into a preset string format suitable for configuration files. Requires the 'ubx2preset' function and 'UBXReader' from 'pyubx2'. The function reads UBX messages from a file and formats them. ```python from pygpsclient import ubx2preset from pyubx2 import UBXReader, SET def convert_ubx_file_to_preset(infile: str, description: str) -> str: """ Convert binary UBX configuration file to preset string. :param str infile: path to .ubx file :param str description: preset description :return: preset string for config file """ ubx_messages = () with open(infile, "rb") as stream: ubr = UBXReader(stream, msgmode=SET) for _, parsed in ubr: ubx_messages += (parsed,) return ubx2preset(ubx_messages, description) ``` -------------------------------- ### Install Core Python Libraries on Debian-based Linux Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Installs essential Python 3 libraries including pip, tkinter, Pillow, venv, and libspatialite on Debian-based Linux distributions. These are often required for PyGPSClient's full functionality. ```shell sudo apt install python3-pip python3-tk python3-pil python3-venv python3-pil.imagetk libjpeg-dev zlib1g-dev tk-dev libspatialite ``` -------------------------------- ### Find Python script directory Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md These commands help locate the directory where Python scripts (like the PyGPSClient executable) are installed. ```python python3 -c "import os,sysconfig;print(sysconfig.get_path('scripts'))" ``` ```python python3 -c "import os,sysconfig;print(sysconfig.get_path('scripts',f'{os.name}_user'))" ``` -------------------------------- ### Convert UBX, NMEA, and TTY Messages to Presets Source: https://github.com/semuconsulting/pygpsclient/blob/master/README.md Use these helper functions to convert message objects into strings suitable for configuration files. Ensure correct message types and descriptions are provided. ```python from pygpsclient import ubx2preset, nmea2preset, tty2preset from pyubx2 import UBXMessage from pynmeagps import NMEAMessage, SET ubx = UBXMessage("CFG", "CFG-MSG", SET, msgClass=0x01, msgID=0x03, rateUART1=1) print(ubx2preset(ubx, "Configure NAV-STATUS Message Rate on ZED-F9P")) nmea = NMEAMessage("P", "QTMCFGUART", SET, baudrate=460800) print(nmea2preset(nmea, "Configure UART baud rate on LGSERIES")) tty = b"AT+SYSTEM_RESET\r\n" print(tty2preset(tty, "IM19 System Reset CONFIRM")) ``` -------------------------------- ### Upgrade PyGPSClient within a virtual environment Source: https://github.com/semuconsulting/pygpsclient/blob/master/INSTALLATION.md Ensures you have the latest version of PyGPSClient installed while working within an activated virtual environment. ```shell source pygpsclient/bin/activate # (or .\pygpsclient\Scripts\activate on Windows) python3 -m pip install --upgrade pygpsclient ``` -------------------------------- ### Command Line Argument for Custom Config File Source: https://github.com/semuconsulting/pygpsclient/blob/master/RELEASE_NOTES.md Specify a custom configuration file for PyGPSClient using the -C or --config command line arguments. ```bash python -m pygpsclient -C /path/to/custom/pygpsclient.json ``` -------------------------------- ### Set MQTT Client Settings for SPARTN Source: https://context7.com/semuconsulting/pygpsclient/llms.txt Configures the MQTT client ID and region for SPARTN services using environment variables. ```bash export MQTTCLIENTID="your_mqtt_client_id" export MQTTCLIENTREGION="eu" ``` -------------------------------- ### Set NTRIP Caster Credentials Source: https://context7.com/semuconsulting/pygpsclient/llms.txt Configures username and password for connecting to an NTRIP caster using environment variables. ```bash export NTRIPCASTER_USER="myusername" export NTRIPCASTER_PASSWORD="mypassword" ``` -------------------------------- ### Set TLS Certificate Paths Source: https://context7.com/semuconsulting/pygpsclient/llms.txt Specifies the paths to the server's PEM certificate and the client's CRT certificate for secure connections using environment variables. ```bash export PYGNSSUTILS_PEMPATH="/path/to/server.pem" export PYGNSSUTILS_CRTPATH="/path/to/client.crt" ```