nmea

package module
v0.0.0-...-cd70e59 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 0 Imported by: 0

README

mab-go/nmea

Build Status Code Coverage Go Report Card Go Reference Ask DeepWiki

A Go library for parsing NMEA 0183 sentences. Verify checksums, extract typed fields, and decode sentence types like GPGGA and GPGLL into structured Go values.


Quick Start

import (
    "fmt"
    "log"

    "github.com/mab-go/nmea/sentence/gpgga"
)

fix, err := gpgga.Parse("$GPGGA,174800.864,4002.741,N,07618.550,W,1,12,1.0,0.0,M,0.0,M,,*70")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Lat: %f %s, Lon: %f %s\n", fix.Latitude, fix.NorthSouth, fix.Longitude, fix.EastWest)

Installation

go get github.com/mab-go/nmea

Requires Go 1.26 or later.


Supported Sentences

Package Sentence Description
sentence/gpgga GPGGA GPS fix data: time, lat/lon, fix quality, satellite count, HDOP, altitude
sentence/gpgll GPGLL Geographic position: lat/lon, fix time, data status, mode
sentence/gpgsa GPGSA GPS DOP and active satellites: selection mode, fix mode, PRN list, PDOP/HDOP/VDOP

The sentence package provides lower-level building blocks usable with any NMEA 0183 sentence:

  • VerifyChecksum — validates the *XX checksum on a raw sentence string
  • SegmentParser — splits a sentence into typed fields (AsFloat64, AsInt16, AsString, AsNMEATime, and more)
  • NMEATime — UTC fix time as hour/minute/second/millisecond (no float precision loss)

Development

First-time setup (installs golangci-lint, goimports, gocyclo into ./bin):

make setup

Then:

make test        # Run all tests (with -race by default)
make test:cover  # Tests + HTML coverage report
make lint        # golangci-lint
make fmt         # goimports

Run make help for the full list of targets.


License

MIT. See LICENSE.

Documentation

Overview

Package nmea contains "sub-packages" that comprise a toolkit for interacting with NMEA data streams and NMEA data.

Directories

Path Synopsis
Package sentence provides a set of interfaces and functions used to describe and work with NMEA sentences.
Package sentence provides a set of interfaces and functions used to describe and work with NMEA sentences.
gpgga
Package gpgga contains data structures and functions related to NMEA sentences of type "GPGGA".
Package gpgga contains data structures and functions related to NMEA sentences of type "GPGGA".
gpgll
Package gpgll contains data structures and functions related to NMEA sentences of type "GPGLL".
Package gpgll contains data structures and functions related to NMEA sentences of type "GPGLL".
gpgsa
Package gpgsa contains data structures and functions related to NMEA sentences of type "GPGSA".
Package gpgsa contains data structures and functions related to NMEA sentences of type "GPGSA".
testhelp
Package testhelp contains helper functions and data structures used by unit tests within the github.com/mab-go/nmea/sentence package.
Package testhelp contains helper functions and data structures used by unit tests within the github.com/mab-go/nmea/sentence package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL