| Crates.io | nema-parser |
| lib.rs | nema-parser |
| version | 0.1.4 |
| created_at | 2025-08-10 05:30:13.232898+00 |
| updated_at | 2025-08-11 02:21:02.894631+00 |
| description | A parser for NEMA sentences |
| homepage | |
| repository | https://github.com/BolivarTech/nema-parser |
| max_upload_size | |
| id | 1788547 |
| size | 65,787 |
This crate provides fast and efficient parsing of NMEA sentences from multiple GNSS systems (GPS, GLONASS, GALILEO, BEIDOU). It extracts satellite information, position, DOP values, and can fuse positions from different systems for improved accuracy.
Add the following to your Cargo.toml:
[dependencies]
nema-parser = "0.1"
Basic usage example:
use nema_parser::{parse_nmea_sentence, NmeaSentence};
fn main() {
let sentence = "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47";
match parse_nmea_sentence(sentence) {
Ok(parsed) => {
println!("Parsed sentence: {:?}", parsed);
if let NmeaSentence::GGA(gga) = parsed {
println!("Latitude: {}", gga.latitude);
println!("Longitude: {}", gga.longitude);
}
}
Err(e) => println!("Error parsing sentence: {}", e),
}
}
use nema_parser::{parse_nmea_sentence, NmeaSentence};
fn main() {
let gga_sentence = "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47";
match parse_nmea_sentence(gga_sentence) {
Ok(NmeaSentence::GGA(gga)) => {
println!("Latitude: {}", gga.latitude);
println!("Longitude: {}", gga.longitude);
}
Ok(other) => println!("Parsed other sentence: {:?}", other),
Err(e) => println!("Error: {}", e),
}
}
use nema_parser::parse_nmea_sentence;
fn main() {
let invalid_sentence = "$INVALID,NMEA,SENTENCE";
match parse_nmea_sentence(invalid_sentence) {
Ok(parsed) => println!("Parsed: {:?}", parsed),
Err(e) => println!("Error: {}", e),
}
}
cargo build
cargo test
Generate and view the documentation locally:
cargo doc --open
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Distributed under the MIT License. See LICENSE for more information.