Python library for parsing and generating NMEA 0183 protocol messages used in GPS and marine navigation systems
77
A utility that reads GPS position data from NMEA sentences and formats the coordinates in multiple representations.
Parse NMEA sentences containing GPS position data to extract coordinate information.
Convert and format coordinates into different notations commonly used in GPS applications.
Properly handle and display coordinate direction indicators (N/S for latitude, E/W for longitude).
@generates
def parse_position_sentence(nmea_sentence: str) -> dict:
"""
Parse an NMEA sentence containing position data and return coordinate information.
Args:
nmea_sentence: A valid NMEA sentence string (GGA, RMC, or GLL)
Returns:
A dictionary containing:
- 'latitude': float value in decimal degrees (negative for South)
- 'longitude': float value in decimal degrees (negative for West)
- 'sentence_type': the type of sentence parsed (e.g., 'GGA', 'RMC', 'GLL')
Raises:
ValueError: If the sentence cannot be parsed or doesn't contain position data
"""
pass
def format_decimal_degrees(latitude: float, longitude: float) -> str:
"""
Format coordinates as decimal degrees with direction indicators.
Args:
latitude: Latitude in decimal degrees
longitude: Longitude in decimal degrees
Returns:
Formatted string in format: "DD.DDDD° N/S, DD.DDDD° E/W"
Example: "37.7749° N, 122.4194° W"
"""
pass
def format_degrees_minutes(latitude: float, longitude: float) -> str:
"""
Format coordinates as degrees and decimal minutes with direction indicators.
Args:
latitude: Latitude in decimal degrees
longitude: Longitude in decimal degrees
Returns:
Formatted string in format: "DD° MM.MMM' N/S, DD° MM.MMM' E/W"
Example: "37° 46.494' N, 122° 25.164' W"
"""
pass
def format_degrees_minutes_seconds(latitude: float, longitude: float) -> str:
"""
Format coordinates as degrees, minutes, and seconds with direction indicators.
Args:
latitude: Latitude in decimal degrees
longitude: Longitude in decimal degrees
Returns:
Formatted string in format: 'DD° MM\' SS" N/S, DD° MM\' SS" E/W'
Example: "37° 46' 29.64\" N, 122° 25' 9.84\" W"
"""
passProvides NMEA sentence parsing and coordinate conversion support.
Install with Tessl CLI
npx tessl i tessl/pypi-pynmea2docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10