Skip to content

Commit 042ab3b

Browse files
authored
Merge pull request #209 from semuconsulting/RELEASE-CANDIDATE-1.5.14
Add spatial database recording facility
2 parents 550ec24 + b1d48fb commit 042ab3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1458
-451
lines changed

INSTALLATION.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Though by no means mandatory, it is [generally considered best practice](https:/
2626
1. Use different versions of the same package across applications.
2727
1. Keep your application dependencies clean and organized.
2828

29-
Some platforms (e.g. Ubuntu Linux) **enforce** the use of virtual environments via a so-called 'Externally Managed Environment' constraint². Attempting to install a package into the global environment will result in an `error: externally-managed-environment` error.
29+
Some platforms (e.g. Ubuntu Linux and Homebrew-installed Python environments) **enforce** the use of virtual environments via a so-called 'Externally Managed Environment' constraint². Attempting to install a package into the global environment will result in an `error: externally-managed-environment` error.
3030

3131
¹ In practice, 'global' generally means the user's home environment. Installing into the platform's global system environment typically results in a `Defaulting to user installation because normal site-packages is not writeable` warning.
3232

@@ -61,23 +61,28 @@ The exact location of the site_packages and binary directories will depend on th
6161

6262
In the following, `python3` & `pip` refer to the Python 3 executables. You may need to substitute `python` for `python3`, depending on your particular environment (*on Windows it's generally `python`*).
6363

64-
- Python >= 3.9
65-
- Tk (tkinter) >= 8.6 (*tkinter is a commonly used library for developing Graphical User Interfaces (GUI) in Python*)
64+
- Python >= 3.9
65+
- Tk (tkinter) >= 8.6 (*tkinter is a commonly used library for developing Graphical User Interfaces (GUI) in Python*)
6666
- Screen resolution >= 640 x 400; Ideally 1920 x 1080, though at lower screen resolutions (<= 1024 width), top level dialogs will be resizable and scrollable.
6767

6868
**NB** It is highly recommended to use the latest official [Python.org](https://www.python.org/downloads/) installation package for your platform, rather than any pre-installed version.
6969

7070
**NB** It is highly recommended that the Python 3 [binaries](#binaries) (`../bin` or `..\Scripts`) directory is included in your PATH (*most standard Python 3 installation packages will do this automatically if you select the 'Add to PATH' option during installation*).
7171

72+
⁴ PyGPSClient's optional spatialite database recording facility is dependent upon the following:
73+
74+
- The Python environment must support the loading of sqlite3 extensions i.e. it must have been compiled with the `--enable-loadable-sqlite-extensions` option. This is true by default for most Windows and Linux platforms but **NOT** for most MacOS platforms.
75+
- The mod_spatialite module (.so, .dll or .dylib) must be installed and in the `PATH` (or `LD_LIBRARY_PATH` on Linux).
76+
7277
### Windows 10 or later
7378

7479
Normally installs without any additional steps.
7580

7681
### MacOS 13 or later
7782

78-
The version of Python supplied with some older Apple MacOS platforms includes a [deprecated version of tkinter](https://www.python.org/download/mac/tcltk/) (8.5). Use an official [Python.org](https://www.python.org/downloads/macos) installation package instead.
83+
The version of Python supplied with some older Apple MacOS platforms includes a [deprecated version of tkinter](https://www.python.org/download/mac/tcltk/) (8.5). Use an official [Python.org](https://www.python.org/downloads/macos) installation package instead.
7984

80-
**NB:** Python does ***NOT*** require Homebrew or MacPorts to be installed on MacOS. The Python organisation provides serviceable [64-bit universal installation packages](https://www.python.org/downloads/macos/) for all current and legacy versions of Python, including release candidates.
85+
**NB:** Python does ***NOT*** normally require Homebrew or MacPorts to be installed on MacOS. The Python organisation provides serviceable [64-bit universal installation packages](https://www.python.org/downloads/macos/) for all current and legacy versions of Python, including release candidates.
8186

8287
However, if you wish to install Python using [Homebrew](https://brew.sh/) to take advantage of certain non-default configurations (*e.g. support for sqlite3 extensions*), use the `python-tk` formula rather than `python`, e.g.
8388

@@ -89,12 +94,14 @@ Note also that the Homebrew formulae for python-tk>=3.12 include the latest tkin
8994

9095
### Linux (including Raspberry Pi OS)
9196

92-
Some Linux distributions may not include the necessary pip, tkinter or Pillow imaging libraries by default. They may need to be installed separately, e.g.:
97+
Some Linux distributions may not include the necessary pip, tkinter, Pillow or spatialite libraries by default. They may need to be installed separately, e.g.:
9398

9499
```shell
95-
sudo apt install python3-pip python3-tk python3-pil python3-pil.imagetk libjpeg-dev zlib1g-dev tk-dev
100+
sudo apt install python3-pip python3-tk python3-pil python3-pil.imagetk libjpeg-dev zlib1g-dev tk-dev libspatialite
96101
```
97102

103+
⁴ Support for the sqlite3 `mod_spatialite` extension may require a custom version of Python to be [compiled from source](https://github.com/semuconsulting/PyGPSClient/blob/master/examples/python_compile.sh) if a suitable version is not available from any of the distribution's repos.
104+
98105
## <a name="userpriv">User Privileges</a>
99106

100107
To access the serial port on most Linux platforms, you will need to be a member of the

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License ("BSD License 2.0", "Revised BSD License", "New BSD License", or "Modified BSD License")
22

3-
Copyright (c) 2020, SEMU Consulting
3+
Copyright (c) 2020, semuadmin (Steve Smith)
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ Please refer to [INSTALLATION.md](https://github.com/semuconsulting/PyGPSClient/
104104
1. Tags - enable color tags in console (see Console Widget below).
105105
1. Position Format and Units - Change the displayed position (D.DD / D.M.S / D.M.MM / ECEF) and unit (metric/imperial) formats.
106106
1. Show Unused Satellites - Include or exclude satellites that are not used in the navigation solution (e.g. because their signal level is too low) from the graph and sky view panels.
107-
1. DataLogging - Turn Data logging in the selected format on or off. You will be prompted to select the directory into which timestamped log files are saved.
108-
1. GPX Track - Turn track recording (in GPX format) on or off. You will be prompted to select the directory into which timestamped GPX track files are saved.
107+
1. DataLogging - Turn Data logging in the selected format on or off. On first selection, you will be prompted to select the directory into which timestamped log files are saved.
108+
1. GPX Track - Turn track recording (in GPX format) on or off. On first selection, you will be prompted to select the directory into which timestamped GPX track files are saved.
109+
1. Database - Turn spatialite database recording (*where available*) on or off. On first selection, you will be prompted to select the directory into which the `pygpsclient.sqlite` database is saved. Note that, when first created, the database's spatial metadata will take a few seconds to initialise (*up to a minute on Raspberry Pi and similar SBC*). **NB** This facility is dependent on your Python environment supporting the requisite [sqlite3 `mod_spatialite` extension](https://www.gaia-gis.it/fossil/libspatialite/index) - see [INSTALLATION.md](https://github.com/semuconsulting/PyGPSClient/blob/master/INSTALLATION.md#prereqs) for further details. If not supported, the option will be greyed out. Check the Menu..Help..About dialog for an indication of the current spatialite support status.
109110
1. To save the current configuration to a file, go to File..Save Configuration.
110111
1. To load a saved configuration file, go to File..Load Configuration. The default configuration file location is `$HOME/pygpsclient.json`. **NB** Any active serial or RTK connection must be stopped before loading a new configuration.
111112

@@ -389,7 +390,8 @@ By default, the server/caster binds to the host address '0.0.0.0' (IPv4) or '::'
389390

390391
*GPX Track Viewer screenshot*
391392

392-
The GPX Track Viewer can display any valid GPX file containing trackpoints (`<trkpt>..</trkpt>` elements) against either an ["custom" offline map image](#custommap), or an online MapQuest "map" or "sat" view. The "map" and "sat" options require a free [MapQuest API key](#mapquestapi). The Y axis scales will reflect the current choice of units (metric or imperial). Click ![refresh icon](https://github.com/semuconsulting/PyGPSClient/blob/master/src/pygpsclient/resources/iconmonstr-refresh-lined-24.png?raw=true) to refresh the display after any changes (e.g. resizing, zooming or change of units). The location marker indicates the nominal center point of the track.
393+
The GPX Track Viewer can display any valid GPX file containing track point (`trkpt`), route point (`rtept`) or waypoint (`wpt`)elements against either an ["custom" offline map image](#custommap), or an online MapQuest "map", "sat" or "hyb" view. The "map", "sat" and "hyb" options require a free [MapQuest API key](#mapquestapi). The Y axis scales will reflect the current choice of units (metric or imperial). If the GPX track omits a time element, the time and speed axes will be flagged as nominal. GPX track metadata, including min, max, average (mean) and median elevation and speed values, is displayed in the selected units.
394+
Click ![refresh icon](https://github.com/semuconsulting/PyGPSClient/blob/master/src/pygpsclient/resources/iconmonstr-refresh-lined-24.png?raw=true) to refresh the display after any changes (e.g. resizing, zooming or change of units). The location marker indicates the nominal center point of the track.
393395

394396
---
395397
## <a name="mapquestapi">MapQuest API Key</a>

RELEASE_NOTES.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
# PyGPSClient Release Notes
22

3+
### RELEASE 1.5.14
4+
5+
FIXES:
6+
7+
1. Fix Chart update issue #210
8+
2. Fix Exit button not invoking on_exit() clean up routines (causing any in-progress GPX track recording to be unterminated).
9+
3. Fix `IndexError` when loading GPX tracks with no `<time></time>` elements - a synthetic timestamp sequence wil be used instead.
10+
4. Fix incorrect type formatting for some NMEA commands in NMEA Dynamic Configuration panel.
11+
12+
ENHANCEMENTS:
13+
14+
1. Add facility to write gnss status data to a spatialite (sqlite3 with spatial extension) database, which can be utilised by many standard GNSS visualisation and analysis applications e.g. QGIS, GDAL, GRASS, GeoPandas etc. The facility may be enabled via a new 'Database' checkbox on the Settings panel. The default database path is `$HOME/pygpsclient.sqlite`. A single table `pygpsclient` is populated with all the information displayed in PyGPSClient's banner panel, with lat/lon/hmsl available as a POINTZ (3D) geometry. Note that, when first created, the database spatial metadata will take a few seconds to initialise.
15+
16+
**NB**: This optional facility is subject to the following Python environmental criteria:
17+
18+
- The Python environment must support the loading of sqlite3 extensions i.e. it must have been compiled with the `--enable-loadable-sqlite-extensions` option. This is true by default for most Windows and Linux platforms but **NOT** for most MacOS platforms.
19+
- The mod_spatialite module (.so, .dll or .dylib) must be installed and in `PATH` (or `LD_LIBRARY_PATH` on Linux).
20+
- The 'About' dialog displays a new Spatial version/status - 'No ext' signifies the platform's Python does not support sqlite3 extensions; 'No m_s' signifies Python *does* support extensions but mod_spatialite is not installed or cannot be found in `PATH` or `LD_LIBRARY_PATH`.
21+
22+
On MacOS platforms, it *may* be necessary to install (*e.g. via Homebrew*) a custom version of Python with the `--enable-loadable-sqlite-extensions` flag set and the `libspatialite` package installed e.g.
23+
24+
`brew install [email protected] libspatialite`
25+
26+
On Linux platforms which do not support sqlite3 extensions out of the box, it may be possible to compile from source a suitable version of [Python](https://github.com/semuconsulting/PyGPSClient/blob/master/examples/python_compile.sh) and/or [libspatialite](https://github.com/semuconsulting/PyGPSClient/blob/master/examples/libspatialite_compile.sh).
27+
2. BSD 3-Clause license attribution clarified in all modules.
28+
3. Enhance elevation profile and metadata rendering in GPX track viewer. Add support for route and waypoint elements in addition to track.
29+
4. Enhance NMEA Dynamic Configuration dialog to support additional NMEA command types, including Quectel proprietary $PAIR (Quectel LC29H/LC79H), Garmin $PGRM, Locosys %PINV (limited) and u-Blox $PUBX (requires pynmeagps>=1.0.53).
30+
5. Add support
31+
5. Various minor improvements to file exception handling.
32+
333
### RELEASE 1.5.13
434

535
ENHANCEMENTS:

docs/pygpsclient.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,14 @@ pygpsclient.spectrum\_frame module
332332
:show-inheritance:
333333
:undoc-members:
334334

335+
pygpsclient.sqllite\_handler module
336+
-----------------------------------
337+
338+
.. automodule:: pygpsclient.sqllite_handler
339+
:members:
340+
:show-inheritance:
341+
:undoc-members:
342+
335343
pygpsclient.status\_frame module
336344
--------------------------------
337345

3.62 MB
Loading

examples/libspatialite_compile.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
# bash shell script to compile and install libspatialite
4+
# (mod_spatialite.so) on Debian Linux platforms which do not
5+
# include a suitable binary in their standard repos
6+
# (e.g. Raspberry Pi OS).
7+
#
8+
# Remember to run chmod +x libspatialite_compile.sh to make this script executable.
9+
#
10+
# Source code:
11+
# https://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-5.1.0.tar.gz
12+
#
13+
# Created by semuadmin on 27 Sep 2023.
14+
#
15+
# exit on error
16+
set -e
17+
18+
# install build dependencies if required and available (we'll omit the freexl dependency)
19+
sudo apt install libspatial-dev || true
20+
sudo apt install libproj-dev || true
21+
sudo apt install libgdal-dev || true
22+
sudo apt install libgeos-dev || true
23+
# download and unzip source code
24+
wget https://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-5.1.0.tar.gz
25+
tar zxvf libspatialite-5.1.0.tar.gz
26+
cd libspatialite-5.1.0
27+
# compile source and install - this will take several minutes
28+
# aarch64-unknown-linux-gnu is appropriate for ARM-based SBC platforms like RPi
29+
./configure --build=aarch64-unknown-linux-gnu --enable-freexl=no
30+
make
31+
sudo make install-strip
32+
33+
# typically installs mod_spatialite.so to /usr/local/lib, which
34+
# must be added to the LD_LIBRARY_PATH environment variable:
35+
#
36+
export LD_LIBRARY_PATH=/usr/local/lib
37+
38+
# make this permanent via your .bashrc or .zshrc shell profile
39+
echo "Adding directory to PATH..."
40+
BASHPROF1=$HOME/.profile
41+
BASHPROF2=$HOME/.bashrc
42+
ZSHPROF1=$HOME/.zprofile
43+
ZSHPROF2=$HOME/.zshrc
44+
if test -f $BASHPROF1
45+
then
46+
PROF=$BASHPROF1
47+
elif test -f $BASHPROF2
48+
then
49+
PROF=$BASHPROF2
50+
fi
51+
if test -f $ZSHPROF1
52+
then
53+
PROF=$ZSHPROF1
54+
elif test -f $ZSHPROF2
55+
then
56+
PROF=$ZSHPROF2
57+
fi
58+
sed -i '$a# Path to mod_spatialite.so\nexport LD_LIBRARY_PATH=/usr/local/lib' $PROF
59+
source $PROF # this will throw an error if running as bash script in zsh shell

examples/pygpsclient_debian_install.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,21 @@ python3 -m pip install --upgrade pip pygpsclient
3737
deactivate
3838

3939
echo "Adding desktop launch icon..."
40+
# the LD_LIBRARY_PATH env setting allows PyGPSClient to find the
41+
# mod_spatialite.so module, which is typically installed in this location
42+
# you can set other env variables in a similar fashion if required
4043
cat > $HOME/.local/share/applications/pygpsclient.desktop <<EOF
4144
[Desktop Entry]
4245
Type=Application
4346
Terminal=false
4447
Name=PyGPSClient
4548
Icon=$HOME/pygpsclient/lib/python$PYVER/site-packages/pygpsclient/resources/pygpsclient.ico
46-
Exec=$HOME/pygpsclient/bin/pygpsclient
49+
Exec=env LD_LIBRARY_PATH=/usr/local/lib $HOME/pygpsclient/bin/pygpsclient
4750
EOF
4851

4952
echo "Adding directory to PATH..."
5053
BASHPROF1=$HOME/.profile
51-
BASHPROF2=$HOME/.bash_rc
54+
BASHPROF2=$HOME/.bashrc
5255
ZSHPROF1=$HOME/.zprofile
5356
ZSHPROF2=$HOME/.zshrc
5457
if test -f $BASHPROF1

examples/python_compile.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
set -e
2020

2121
# set required Python major and minor version e.g. 3.10.10
22-
PYVER="3.13.0"
22+
PYVER="3.13.7"
2323
# NB: uncomment this line to install this version alongside existing versions
2424
# ALTINSTALL=1
2525

@@ -46,13 +46,21 @@ fi
4646
sudo apt update
4747
sudo apt build-dep python3
4848
sudo apt install build-essential gdb lcov pkg-config \
49-
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
49+
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev \
5050
libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
51-
lzma lzma-dev tk-dev uuid-dev zlib1g-dev -y
51+
lzma tk-dev uuid-dev zlib1g-dev -y
52+
sudo apt install liblzma-dev || true
53+
# liblzma-dev may be lzma-dev on some platforms
54+
sudo apt install lzma-dev || true
55+
sudo apt install libspatialite || true
56+
# libspatialite may not be available as standard on some platforms
57+
# (e.g. Rasperry PI OS) but it is relatively straightforward to
58+
# compile from source using the libspatialite_compile.sh script
59+
# in the /examples folder
5260

53-
# compile, install and verify installed version
61+
# compile source and install - this will take several minutes
5462
cd Python-${PYVER}
55-
./configure --enable-optimizations
63+
./configure --enable-optimizations --enable-loadable-sqlite-extensions
5664
make
5765
# make test
5866
if [ -z ${ALTINSTALL+x} ]

0 commit comments

Comments
 (0)