Skip to main content

Installation

[sudo [-H]] pip[2|3] install gps3

For example, sudo -H pip3 install gps3 for your default P3 installation. sudo pip2 install gps3 for Python 2.7.

gps3.py will install at /usr/local/lib/python[3.5]/dist-packages/gps3/gps3.py

gps3.py is a Python 2.7-3.5 GPSD interface (http://www.catb.org/gpsd) and defaults to host=’127.0.0.1’, port=2947, gpsd_protocol=’json’ in two classes.

  1. GPSDSocket creates a GPSD socket connection & request/retrieve GPSD output.

  2. DataStream unpacks the streamed gpsd data into python dictionaries.

These dictionaries are literated from the JSON data packet sent from the GPSD.

from gps3 import gps3
gps_socket = gps3.GPSDSocket()
data_stream = gps3.DataStream()
gps_socket.connect()
gps_socket.watch()
for new_data in gps_socket:
    if new_data:
        data_stream.unpack(new_data)
        print('Altitude = ', data_stream.TPV['alt'])
        print('Latitude = ', data_stream.TPV['lat'])

Consult Lines 147-ff for Attribute/Key possibilities. or http://www.catb.org/gpsd/gpsd_json.html

agps3.py is installed at /usr/local/lib/python[3.5]/dist-packages/gps3/agps3.py

It is functionally similar to gps.py, but literates object attributes rather than Python dictionaries.

agps3.py is also a Python 2.7-3.5 GPSD interface (http://www.catb.org/gpsd) and defaults to host=’127.0.0.1’, port=2947, gpsd_protocol=’json’ in two classes.

  1. GPSDSocket creates a GPSD socket connection & request/retrieve GPSD output.

  2. DataStream unpacks the streamed gpsd data into object attribute values.

from gps3 import agps3
gps_socket = agps3.GPSDSocket()
data_stream = agps3.DataStream()
gps_socket.connect()
gps_socket.watch()
for new_data in gps_socket:
    if new_data:
        data_stream.unpack(new_data)
        print('Altitude = ', data_stream.alt)
        print('Latitude = ', data_stream.lat)

Consult Lines 140-ff for Attribute-value possibilities.

For a human experience, both versions have trivial showcase scripts, located at

/usr/local/share/gps3/examples/

agpsthreaded.py is agps3 prethreaded as a default daemon thread with all data exposed as attributes of the threaded data stream.

from gps3.agps3threaded import AGPS3mechanism
agps_thread = AGPS3mechanism()  # Instantiate AGPS3 Mechanisms
agps_thread.stream_data()  # From localhost (), or other hosts, by example, (host='gps.ddns.net')
agps_thread.run_thread()  # Throttle time to sleep after an empty lookup, default '()' 0.2 two tenths of a second

while True:  # All data is available via instantiated thread data stream attribute.
    # line #140-ff of /usr/local/lib/python3.5/dist-packages/gps3/agps.py
    print('---------------------')
    print(                   agps_thread.data_stream.time)
    print('Lat:{}   '.format(agps_thread.data_stream.lat))
    print('Lon:{}   '.format(agps_thread.data_stream.lon))
    print('Speed:{} '.format(agps_thread.data_stream.speed))
    print('Course:{}'.format(agps_thread.data_stream.track))
    print('---------------------')
    sleep(60) # Sleep, or do other things for as long as you like.

human.py showcases gps3.py, ahuman.py showcases agps3.py

python[X] /usr/local/share/gps3/examples/[a]human.py [-host] [-port] or --help for list of commandline options.

Toggle Lat/Lon form with ‘0’, ‘1’, ‘2’, ‘3’ for RAW, DDD, DMM, DMS

Toggle units with ‘0’, ‘m’, ‘i’, ‘n’, for ‘raw’, Metric, Imperial, Nautical

Toggle between JSON and NMEA outputs with ‘j’ and ‘a’ respectively.

Refresh the display of device information with ‘d’ to see the return after issuing gps3.misc.hertz(5) to change capable gps devices to 5Hz

Quit with ‘q’ or ‘^c’

Likewise, both versions have trivial applications [a] gegps3.py that creates a ‘live’ kml file(s) for Google Earth.

python[X] /usr/local/share/gps3/examples/[a]gegps3.py (defaults)

Scant documentation is in the respective file.

Un-installation

[sudo -H] pip[2|3] uninstall gps3

For example, sudo -H pip3 uninstall gps3 for P3 installation. Likewise, for Python 2.7 sudo pip2 uninstall gps3

Problems with installation

Un-install using the method above and y to delete the old files, then

sudo -H pip[2|3] install --ignore-installed gps3

This will bypass the cached version and fetch the most recent typo-free version.

Comments are always appreciated.

Release files for gps3 0.33.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for gps3 0.33.3
File Interpreter ABI Platform
gps3-0.33.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / gps3-0.33.3-py2.py3-none-any.whl

Download URL gps3-0.33.3-py2.py3-none-any.whl
Size 29.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9c7ef9fa334ae6d4157fa63abe6df334d4f0878dbb628d10cb4c5f304eb22978
BLAKE2b-256 checksum
How to use checksums
20c19548cb5388a85e31557d1f1f66e2ad0b269d8aeb982f34f72f83d9bdbaeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.33.3 This release

1 release file

0.33.2

1 release file

0.33.1

1 release file

0.33.0

1 release file

0.32.2

1 release file

0.32.0

1 release file

0.30.4

1 release file

0.30.3

1 release file

0.30.2

0.30.1

0.30

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page