OpenMarine
Is there command line utility for scripting to show current GPS location? - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: General discussion (https://forum.openmarine.net/forumdisplay.php?fid=2)
+--- Thread: Is there command line utility for scripting to show current GPS location? (/showthread.php?tid=2260)



Is there command line utility for scripting to show current GPS location? - mgrouch - 2020-01-25

Is there command line utility for scripting to show current GPS location in openplotter?

I'd like to investigate how I can script automatic weather fax receiving and decoding
with a script.

Something that can attempt gpsd and other openplotter NMEA services?

Or can openplotter just store location in some file?
Does it sync computer time with GPS time?
If it does can it in same piece of code store location and its timestamp?


Thanks,
--MG


RE: Is there command line utility for scripting to show current GPS location? - ddelorme - 2020-01-25

signalK is probable the best way to accessing gps and other data..
You should do some reading on nmea sentences gps theory.
most of your questions can be found in the old documents. several app exists to receive and process weather data.


RE: Is there command line utility for scripting to show current GPS location? - mgrouch - 2020-01-25

Does it store current position in memory which I can query?
I don't thing so.
Querying GPS position should be just as easy as querying CPU temperature
Just cat some file on /dev or /sys filesystem. What is is fundamentally different?

I think openplotter should provide that functionality. It just needs timestamp of the fix too (to know it is expired or not).

Thanks,
--MG


RE: Is there command line utility for scripting to show current GPS location? - MatsA - 2020-01-25

(2020-01-25, 03:53 AM)mgrouch Wrote: Does it store current position in memory which I can query?...........

There are several ways ....

One could be picking NMEA, RMC with

nc localhost 10110 | grep -i RMC

another could be using curl and the URL

http://Your_Host:3000/signalk/v1/api/vessels/self/navigation/position/


RE: Is there command line utility for scripting to show current GPS location? - PaddyB - 2020-01-25

(2020-01-25, 03:53 AM)mgrouch Wrote: Does it store current position in memory which I can query?
I don't thing so.
Querying GPS position should be just as easy as querying CPU temperature
Just cat some file on /dev or /sys filesystem. What is is fundamentally different?

I think openplotter should provide that functionality. It just needs timestamp of the fix too (to know it is expired or not).

Thanks,
--MG

What is it you want to do with the GPS data? It will be broadcast as NMEA0183 & signalk data as each message comes in, timestamp included.


RE: Is there command line utility for scripting to show current GPS location? - mgrouch - 2020-01-27

(2020-01-25, 11:02 AM)MatsA Wrote:
(2020-01-25, 03:53 AM)mgrouch Wrote: Does it store current position in memory which I can query?...........

There are several ways ....

One could be picking NMEA, RMC with

nc localhost 10110 | grep -i RMC

another could be using curl and the URL

http://Your_Host:3000/signalk/v1/api/vessels/self/navigation/position/

Thanks! It worked with URL query.


Code:
curl -s http://localhost:3000/signalk/v1/api/vessels/self/navigation/position/ | jq -M -jr '.value.latitude," ",.value.longitude'



RE: Is there command line utility for scripting to show current GPS location? - seandepagnier - 2020-01-28

You could also possibly invoke cgps if you are using gpsd.

Also consider the weatherfax plugin for opencpn. It already can automatically schedule and decode transmissions. If nothing else you might use schedules xml for your own script