Parsing GPS receiver output via regex in Python

后端 未结 7 1307
没有蜡笔的小新
没有蜡笔的小新 2020-12-14 11:01

I have a friend who is finishing up his masters degree in aerospace engineering. For his final project, he is on a small team tasked with writing a program for tracking weat

7条回答
  •  不思量自难忘°
    2020-12-14 11:42

    You could use a library like pynmea2 for parsing the NMEA log.

    >>> import pynmea2
    >>> msg = pynmea2.parse('$GPGGA,142927.829,2831.4705,N,08041.0067,W,1,07,1.0,7.9,M,-31.2,M,0.0,0000*4F')
    >>> msg.timestamp, msg.latitude, msg.longitude, msg.altitude
    (datetime.time(14, 29, 27), 28.524508333333333, -80.683445, 7.9)
    

    Disclaimer: I am the author of pynmea2

提交回复
热议问题