This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python client to query SignalK server for GPS position
#1
I'm looking for a simple python script to read GPS data from the SignalK server. A simple script asking for a lat/long
string to get the current position, returning and then exit.

I have another RPi serving the SSB radio. This would benefit from having an automated position update with automatic 
conversion to ham radio grid syntax. 
The PAT software has (not fully implemented yet) an entry for gpsd, but my OpenPlotter does not run gpsd, hence the
wish for requesting it from SignalK.
Reply
#2
Code:
import ujson, requests
resp = requests.get('http://localhost:3000/signalk/v1/api/vessels/self/navigation/position/value', verify=False)
data = ujson.loads(resp.content)
print(data)
print(data['longitude'])
print(data['latitude'])

this should print:

Code:
{"longitude":24.7344517,"latitude":59.7205103}
24.7344517
59.7205103
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)