GPSCSV(1) | GPSD Documentation | GPSCSV(1) |
gpscsv - dump the JSON output from gpsd as CSV
gpscsv [-?] [--class MCLASS] [--count COUNT] [--cvt-isotime] [--debug LVL] [--device DEVICE] [--fields FIELDS] [--file FILE] [--header HEADER] [--help] [--host HOST] [--port PORT] [--seconds FIELDS] [--separator SEPARATOR] [--version] [-c MCLASS] [-D LVL] [-f FIELDS] [-h] [-n COUNT] [-V] [-x FIELDS] [host[:port[:device]]]
gpscsv is a simple Python program for reading a gpsd JSON data streams and outputting them in Comma Separated Values (CSV) format. It takes input from a specified gpsd and reports to standard output. The program runs until the gpsd dies, "-n COUNT" messages are processed, "-x SECONDS" have passed, or it is interrupted by ^C or other means.
One good use of gpscsv is to create CSV files for use with the gnuplot program.
The program accepts the following options:
-?, -h, --help
-c MCLASS, --class MCLASS
--cvt-isotime
-D LVL, --debug LVL
--device DEVICE
-f FIELDS, -fields FIELDS
--file FILE
--header HEADER
--host HOST
-n COUNT, --count COUNT
--port PORT
--separator SEPARATOR
-V, --version
-x SECONDS, --seconds SECONDS
Some basic examples, do them in exact order shown:
Grab 100 samples of time,lat,lon,altHAE:
$ gpscsv -n 100 --cvt-isotime > tpv.dat
Grab 100 samples of time,epx,epy,epv,eph,sep
$ gpscsv -n 100 --cvt-isotime -f time,epx,epy,epv,eph,sep > ep.dat
Grab 100 samples of time,xdop,ydop,vdop,tdop,hdop,gdop,pdop
$ gpscsv -n 100 --cvt-isotime -c SKY > sky.dat
Grab 100 samples of time,nSat,uSat
$ gpscsv -n 100 --cvt-isotime -c SKY -f time,nSat,uSat > sat.dat
start gnuplot in interactive mode:
$ gnuplot
Some gnuplot housekeeping:
# this are csv files
gnuplot> set datafile separator ','
# use the first line as title
gnuplot> set key autotitle columnhead
# X axis is UNIT time in seconds.
gnuplot> set xdata time
gnuplot> set timefmt "%s"
Now to plot time vs latitude:
gnuplot> plot 'tpv.dat' using 1:2
Then to plot longitude and altHAE, in separate plots:
gnuplot> plot 'tpv.dat' using 1:3
gnuplot> plot 'tpv.dat' using 1:4
Put both latitude and longitude on one plot:
gnuplot> set y2tics
gnuplot> plot 'tpv.dat' using 1:2, '' using 1:3 axes x1y2
Plot epx, epy, epv, eph, and sep in one plot:
gnuplot> plot 'ep.dat' using 1:2, '' using 1:3, \
'' using 1:4, '' using 1:5, '' using 1:6
Plot all the DOPs on one plot:
gnuplot> plot 'sky.dat' using 1:2, '' using 1:3, '' using 1:4, \
'' using 1:5, '' using 1:6, '' using 1:7, '' using 1:8
Plot nSat and uSat together:
gnuplot> plot 'sat.dat' using 1:2, '' using 1:3
Lat/lon scatter plot:
# x is no longer time
gnuplot> set xdata
gnuplot> plot 'tpv.dat' using 3:2 title 'fix'
Gary E. Miller <gem@rellim.com>.
7 December 2020 | The GPSD Project |