1GPSCSV(1) GPSD Documentation GPSCSV(1)
2
3
4
6 gpscsv - dump the JSON output from gpsd as CSV
7
9 gpscsv [-?] [--class MCLASS] [--count COUNT] [--cvt-isotime]
10 [--debug LVL] [--device DEVICE] [--fields FIELDS] [--file FILE]
11 [--header HEADER] [--help] [--host HOST] [--port PORT]
12 [--seconds FIELDS] [--separator SEPARATOR] [--version]
13 [-c MCLASS] [-D LVL] [-f FIELDS] [-h] [-n COUNT] [-V]
14 [-x FIELDS] [host[:port[:device]]]
15
17 gpscsv is a simple Python program for reading a gpsd JSON data streams
18 and outputting them in Comma Separated Values (CSV) format. It takes
19 input from a specified gpsd and reports to standard output. The program
20 runs until the gpsd dies, "-n COUNT" messages are processed, "-x
21 SECONDS" have passed, or it is interrupted by ^C or other means.
22
23 One good use of gpscsv is to create CSV files for use with the gnuplot
24 program.
25
27 The program accepts the following options:
28
29 -?, -h, --help
30 Show help information and exit.
31
32 -c MCLASS, --class MCLASS
33 Select the JSON class messages of type MCLASS. Default is TPV. .
34
35 --cvt-isotime
36 Convert fields named "time" from ISO time to UNIX time.
37
38 -D LVL, --debug LVL
39 Set debug level to LVL. Default 0. Higher arguments than 0 produce
40 more debug output.
41
42 --device DEVICE
43 The DEVICE on the gpsd to connect to. Defaults to all.
44
45 -f FIELDS, -fields FIELDS
46 The FIELDS from the JSON message to dump to the output. Set FIELD
47 to empty ('') for all fields Default varies by CLASS.
48
49 --file FILE
50 Read JSON from FILE instead of from gpsd..
51
52 --header HEADER
53 Set header style to HEADER. 0 for no header, 1 output fields as
54 header, 2 send fields as a comment ('#'). Defaults to 1.
55
56 --host HOST
57 Connect to the gpsd on HOST. Defaults to localhost.
58
59 -n COUNT, --count COUNT
60 Exit after outputting COUNT records. Set COUNT to 0 to disable.
61 Default is 0
62
63 --port PORT
64 Use PORT to connect to gpsd. Defaults to 2947.
65
66 --separator SEPARATOR
67 Use SEPARATOR as the field separator. Default separator is a comma
68 (',').
69
70 -V, --version
71 Show gpscsv version, and exit.
72
73 -x SECONDS, --seconds SECONDS
74 Exit after SECONDS number of seconds have passed. Set SECONDS to 0
75 to disable. Default is 0
76
78 Some basic examples, do them in exact order shown:
79
80 Grab 100 samples of time,lat,lon,altHAE:
81
82 $ gpscsv -n 100 --cvt-isotime > tpv.dat
83
84 Grab 100 samples of time,epx,epy,epv,eph,sep
85
86 $ gpscsv -n 100 --cvt-isotime -f time,epx,epy,epv,eph,sep > ep.dat
87
88 Grab 100 samples of time,xdop,ydop,vdop,tdop,hdop,gdop,pdop
89
90 $ gpscsv -n 100 --cvt-isotime -c SKY > sky.dat
91
92 Grab 100 samples of time,nSat,uSat
93
94 $ gpscsv -n 100 --cvt-isotime -c SKY -f time,nSat,uSat > sat.dat
95
96 start gnuplot in interactive mode:
97
98 $ gnuplot
99
100 Some gnuplot housekeeping:
101
102 # this are csv files
103 gnuplot> set datafile separator ','
104 # use the first line as title
105 gnuplot> set key autotitle columnhead
106 # X axis is UNIT time in seconds.
107 gnuplot> set xdata time
108 gnuplot> set timefmt "%s"
109
110 Now to plot time vs latitude:
111
112 gnuplot> plot 'tpv.dat' using 1:2
113
114 Then to plot longitude and altHAE, in separate plots:
115
116 gnuplot> plot 'tpv.dat' using 1:3
117 gnuplot> plot 'tpv.dat' using 1:4
118
119 Put both latitude and longitude on one plot:
120
121 gnuplot> set y2tics
122 gnuplot> plot 'tpv.dat' using 1:2, '' using 1:3 axes x1y2
123
124 Plot epx, epy, epv, eph, and sep in one plot:
125
126 gnuplot> plot 'ep.dat' using 1:2, '' using 1:3, \
127 '' using 1:4, '' using 1:5, '' using 1:6
128
129 Plot all the DOPs on one plot:
130
131 gnuplot> plot 'sky.dat' using 1:2, '' using 1:3, '' using 1:4, \
132 '' using 1:5, '' using 1:6, '' using 1:7, '' using 1:8
133
134 Plot nSat and uSat together:
135
136 gnuplot> plot 'sat.dat' using 1:2, '' using 1:3
137
138 Lat/lon scatter plot:
139
140 # x is no longer time
141 gnuplot> set xdata
142 gnuplot> plot 'tpv.dat' using 3:2 title 'fix'
143
145 gpsd(8),
146
148 Gary E. Miller <gem@rellim.com>.
149
150
151
152The GPSD Project 7 December 2020 GPSCSV(1)