Looking to convert a .gp file to .csv. This data is an extract from the gps device continuously tracking its position over time.
Further, I would like to find time and velocity throughout.
Here is an example of the output.
$GNRMC,020555.90,A,4828.05510,N,12318.87567,W,0.059,,170322,,,A*7E
$GNRMC,020556.00,A,4828.05509,N,12318.87569,W,0.030,,170322,,,A*7D
$GNRMC,020556.10,A,4828.05509,N,12318.87570,W,0.040,,170322,,,A*73
$GNRMC,020556.20,A,4828.05508,N,12318.87571,W,0.018,,170322,,,A*7D
$GNRMC,020556.30,A,4828.05508,N,12318.87572,W,0.043,,170322,,,A*71
$GNRMC,020556.40,A,4828.05508,N,12318.87573,W,0.058,,170322,,,A*7D
$GNRMC,020556.50,A,4828.05508,N,12318.87573,W,0.017,,170322,,,A*77
$GNRMC,020556.60,A,4828.05509,N,12318.87573,W,0.047,,170322,,,A*70
$GNRMC,020556.70,A,4828.05510,N,12318.87572,W,0.041,,170322,,,A*7E
$GNRMC,020556.80,A,4828.05510,N,12318.87573,W,0.075,,170322,,,A*77
$GNRMC,020556.90,A,4828.05511,N,12318.87572,W,0.066,,170322,,,A*74
CodePudding user response:
dat <- read.csv(text=txt, head=FALSE)
dat
#--------------
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
1 $GNRMC 20555.9 A 4828.055 N 12318.88 W 0.059 NA 170322 NA NA A*7E
2 $GNRMC 20556.0 A 4828.055 N 12318.88 W 0.030 NA 170322 NA NA A*7D
3 $GNRMC 20556.1 A 4828.055 N 12318.88 W 0.040 NA 170322 NA NA A*73
4 $GNRMC 20556.2 A 4828.055 N 12318.88 W 0.018 NA 170322 NA NA A*7D
5 $GNRMC 20556.3 A 4828.055 N 12318.88 W 0.043 NA 170322 NA NA A*71
6 $GNRMC 20556.4 A 4828.055 N 12318.88 W 0.058 NA 170322 NA NA A*7D
7 $GNRMC 20556.5 A 4828.055 N 12318.88 W 0.017 NA 170322 NA NA A*77
8 $GNRMC 20556.6 A 4828.055 N 12318.88 W 0.047 NA 170322 NA NA A*70
9 $GNRMC 20556.7 A 4828.055 N 12318.88 W 0.041 NA 170322 NA NA A*7E
10 $GNRMC 20556.8 A 4828.055 N 12318.88 W 0.075 NA 170322 NA NA A*77
11 $GNRMC 20556.9 A 4828.055 N 12318.88 W 0.066 NA 170322 NA NA A*74
I found a description of the file format at https://docs.novatel.com/OEM7/Content/Logs/GPRMC.htm
So time is V2 and the velocity in knots is V8:
dat$V8
# [1] 0.059 0.030 0.040 0.018 0.043 0.058 0.017 0.047 0.041 0.075 0.066
Adendum: Although I answered the specific questions about time and velocity I remained puzzled about the lat and long encoding. I think that it might be encoded as
Dec Mins 3857.5634N09515.92890W ddmm.mmmm dddmm.mmmm
So the latitude would be 48 deg, 28.055 minutes North and the longitude 123 degrees 18.88 minutes West so this would have been near Centennial Stadium in Victoria BC, Canada. See: https://www.earthpoint.us/convert.aspx for examples of other lat long format options.