CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-pynmea2

tessl install tessl/pypi-pynmea2@1.19.0

Python library for parsing and generating NMEA 0183 protocol messages used in GPS and marine navigation systems

Agent Success

Agent success rate when using this tile

77%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.12x

Baseline

Agent success rate without this tile

69%

task.mdevals/scenario-4/

GPS Coordinate Formatter

A utility that reads GPS position data from NMEA sentences and formats the coordinates in multiple representations.

Capabilities

Parse NMEA Position Sentences

Parse NMEA sentences containing GPS position data to extract coordinate information.

  • Given "$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47", extract latitude as 48.1173 and longitude as 11.5167 @test
  • Given "$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A", extract latitude as 48.1173 and longitude as 11.5167 @test
  • Given "$GPGLL,4807.038,N,01131.000,E,123519,A,*1E", extract latitude as 48.1173 and longitude as 11.5167 @test

Format Coordinates in Multiple Representations

Convert and format coordinates into different notations commonly used in GPS applications.

  • Given latitude 48.1173 and longitude 11.5167, format as "48.1173° N, 11.5167° E" @test
  • Given latitude 48.1173 and longitude 11.5167, format as "48° 7.038' N, 11° 31.002' E" @test
  • Given latitude -33.8688 and longitude 151.2093, format as "33° 52' 7.68" S, 151° 12' 33.48" E" @test

Handle Coordinate Directions

Properly handle and display coordinate direction indicators (N/S for latitude, E/W for longitude).

  • When formatting latitude 37.7749, display as "37.7749° N" (positive is North) @test
  • When formatting longitude -122.4194, display as "122.4194° W" (negative is West) @test

Implementation

@generates

API

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"
    """
    pass

Dependencies { .dependencies }

pynmea2 { .dependency }

Provides NMEA sentence parsing and coordinate conversion support.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/pynmea2@1.19.x
tile.json