1

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??

1

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)
2
  • Thankyou for your response...Maybe what I thought was happening wasn't really. The log is empty after running a couple of minutes. It does say it's connected though which it didn't do when I tried manually selecting a com port or other method. – tarnis Jul 22 '20 at 14:44
  • The log is written only after you click disconnect in the GPS panel -- did you try that? – ndawson Jul 22 '20 at 19:08
-1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.