github.com/simpleiot/simpleiot@v0.18.3/data/gps.go (about) 1 package data 2 3 import ( 4 nmea "github.com/adrianmo/go-nmea" 5 ) 6 7 // GpsPos describes location and fix information from a GPS 8 type GpsPos struct { 9 Lat float64 `json:"lat"` 10 Long float64 `json:"long"` 11 Fix string `json:"fix"` 12 NumSat int64 `json:"numSat"` 13 } 14 15 // FromGPGGA converts a GPGGA string to a position/fix 16 func (p *GpsPos) FromGPGGA(gpgga nmea.GPGGA) { 17 p.Lat = gpgga.Latitude 18 p.Long = gpgga.Longitude 19 p.Fix = gpgga.FixQuality 20 p.NumSat = gpgga.NumSatellites 21 }