Go
Switch branches/tags
Nothing to show
Clone or download
Latest commit a32116e Jun 20, 2018
Permalink
Failed to load latest commit information.
.travis.yml Test also on Golang 1.8, 1.9, 1.10 Apr 10, 2018
LICENSE added License Jul 22, 2015
README.md add support for GPHDT message (#34) Jun 6, 2018
VERSION update VERSION file Jun 19, 2018
glgsv.go unexport all sentence constructors Apr 11, 2018
glgsv_test.go run gofmt -s Apr 11, 2018
gngga.go use float64 for Latitude and Longitude Apr 11, 2018
gngga_test.go Rename symbols and eliminate useless method Apr 11, 2018
gnrmc.go use float64 for Latitude and Longitude Apr 11, 2018
gnrmc_test.go Rename symbols and eliminate useless method Apr 11, 2018
go.mod add go.mod file Jun 8, 2018
gpgga.go use float64 for Latitude and Longitude Apr 11, 2018
gpgga_test.go Rename symbols and eliminate useless method Apr 11, 2018
gpgll.go use float64 for Latitude and Longitude Apr 11, 2018
gpgll_test.go Rename symbols and eliminate useless method Apr 11, 2018
gpgsa.go fix satellite spelling Apr 11, 2018
gpgsa_test.go Rename symbols and eliminate useless method Apr 11, 2018
gpgsv.go unexport all sentence constructors Apr 11, 2018
gpgsv_test.go run gofmt -s Apr 11, 2018
gphdt.go add support for GPHDT message (#34) Jun 6, 2018
gphdt_test.go add support for GPHDT message (#34) Jun 6, 2018
gprmc.go use float64 for Latitude and Longitude Apr 11, 2018
gprmc_test.go Rename symbols and eliminate useless method Apr 11, 2018
gpvtg.go unexport all sentence constructors Apr 11, 2018
gpvtg_test.go Rename symbols and eliminate useless method Apr 11, 2018
gpzda.go unexport all sentence constructors Apr 11, 2018
gpzda_test.go Rename symbols and eliminate useless method Apr 11, 2018
must_test.go use float64 for Latitude and Longitude Apr 11, 2018
parser.go use float64 for Latitude and Longitude Apr 11, 2018
parser_test.go Rename symbols and eliminate useless method Apr 11, 2018
pgrme.go unexport all sentence constructors Apr 11, 2018
pgrme_test.go Rename symbols and eliminate useless method Apr 11, 2018
sentence.go add support for GPHDT message (#34) Jun 6, 2018
sentence_test.go remove Validate method Apr 12, 2018
types.go use float64 for Latitude and Longitude Apr 11, 2018
types_test.go use float64 for Latitude and Longitude Apr 11, 2018

README.md

go-nmea Build Status Go Report Card Coverage Status GoDoc

This is a NMEA library for the Go programming language (http://golang.org).

Installing

Using go get

go get github.com/adrianmo/go-nmea

After this command go-nmea is ready to use. Its source will be in:

$GOPATH/src/github.com/adrianmo/go-nmea

Supported sentences

At this moment, this library supports the following sentence types:

  • GPRMC - Recommended Minimum Specific GPS/Transit data
  • GNRMC - Recommended Minimum Specific GNSS data
  • GPGGA - GPS Positioning System Fix Data
  • GNGGA - GNSS Positioning System Fix Data
  • GPGSA - GPS DOP and active satellites
  • GPGSV - GPS Satellites in view
  • GLGSV - GLONASS Satellites in view
  • GPGLL - Geographic Position, Latitude / Longitude and time
  • GPVTG - Track Made Good and Ground Speed
  • GPZDA - Date & time data
  • PGRME - Estimated Position Error (Garmin proprietary sentence)
  • GPHDT - Actual vessel heading in degrees True

Example

package main

import (
	"fmt"
	"log"
	"github.com/adrianmo/go-nmea"
)

func main() {
	sentence := "$GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*70"
	s, err := nmea.Parse(sentence)
	if err != nil {
		log.Fatal(err)
	}
	m := s.(nmea.GPRMC)
	fmt.Printf("Raw sentence: %v\n", m)
	fmt.Printf("Time: %s\n", m.Time)
	fmt.Printf("Validity: %s\n", m.Validity)
	fmt.Printf("Latitude GPS: %s\n", nmea.FormatGPS(m.Latitude))
	fmt.Printf("Latitude DMS: %s\n", nmea.FormatDMS(m.Latitude))
	fmt.Printf("Longitude GPS: %s\n", nmea.FormatGPS(m.Longitude))
	fmt.Printf("Longitude DMS: %s\n", nmea.FormatDMS(m.Longitude))
	fmt.Printf("Speed: %f\n", m.Speed)
	fmt.Printf("Course: %f\n", m.Course)
	fmt.Printf("Date: %s\n", m.Date)
	fmt.Printf("Variation: %f\n", m.Variation)
}

Output:

$ go run main/main.go

Raw sentence: $GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*70
Time: 22:05:16.0000
Validity: A
Latitude GPS: 5133.8200
Latitude DMS: 51° 33' 49.200000"
Longitude GPS: 042.2400
Longitude DMS: 0° 42' 14.400000"
Speed: 173.800000
Course: 231.800000
Date: 13/06/94
Variation: -4.200000

Contributions

Please, feel free to implement support for new sentences, fix bugs, refactor code, etc. and send a pull-request to update the library.