Geographic Information Systems Asked on November 12, 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??
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 November 12, 2021
Try saving this script as "save_log.py", and then:
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)
Answered by ndawson on November 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP