TransWikia.com

NMEA Data Feed into QGIS

Geographic Information Systems Asked by tarnis on August 23, 2021

We have a maritime simulator in our office we occasionally use for engineering studies…I was trying to figure out how to get a shape file of the path taken by the ship being driven into QGIS. Data is being sent to a PC with a charting software called Rosepoint on it in NMEA format over a TCP stream via a network cable. According to Rosepoint it is doing this via NMEA over TCP.

Initially hooking up QGIS I didn’t think it was seeing anything, I tried Global Mapper which really saw nothing as it wouldn’t even connect. It did however occur to me that with QGIS my lat/long were both 0 so it must at least be connecting with autoconnect. If I set the com port to something else it fails to connect all together.

So I’m assuming maybe this is working and it’s just not able to understand the sentences coming through…is there a way to define the format on my own, or something I’m not doing correctly??

2 Answers

Try saving this script as "save_log.py", and then:

  1. Connect to your device via the QGIS GPS Information Panel
  2. Drag and drop the script over the qgis window
  3. Pick a destination file for the GPS log
  4. Leave it to record some points, and then disconnect the GPS from the QGIS GPS Information Panel

Attach some of the lines from the saved log file. It's possible that the device is reporting non-standard NMEA codes, so the log will help determine if that's the case.

from qgis.PyQt.QtWidgets import QFileDialog, QMessageBox
from qgis.core import QgsApplication

gps_list = QgsApplication.gpsConnectionRegistry().connectionList()
if not gps_list:
    QMessageBox.critical(None,'GPS Connection','Please connect to the GPS first')
else:
    gps = gps_list[0]
    assert gps

    dest, _ = QFileDialog.getSaveFileName(None, "Save GPS messages to", "gps.log", "Log files (*.log)")
    f = None
    if dest:
        f = open(dest,'wt')
            
    def printSentence(sentence):
        f.write(sentence + 'n')
        
    def closeLog():
        f.close()

    if dest:
        gps.nmeaSentenceReceived.connect(printSentence)
        gps.destroyed.connect(closeLog)

Correct answer by ndawson on August 23, 2021

Seems like QGIS doesn't support GPS over TCP directly, and the more layers of software on top of QGIS introduced reduce the likely hood it'll ever be allowed to be used on the system

Answered by tarnis on August 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP