I want to build me a script, that sends my GPS coordinates to a server. The server receives them and saves it in a database.
For example:
Send (44.3232, 34.4432) to a PHP Script to http://[myserver.com]/gpsscript.php?x=44.3232&y=34.4432
Receive it and save it in a database.
I can use cronjob to run the script. The case is that’s not a problem to save it, but I don’t know how to get the GPS coordinates on Librem 5 by a script.
I once did this with a shellscript.
In the end it wasn’t very difficult, everything was put directly into the format that the google maps api wanted.i think i uploaded it as gpx files and a php script displayed it on the server side.
I can search my hard disk to see if I can find any if you want.
You can read the GNSS information stream directly from /dev/gnss0
?
Of course then your script would have to wait for a GNSS fix i.e. read and parse until you either get valid coordinates or you give up. (Is the assumption that you are outside while this happens? Have you confirmed that you ordinarily do get valid coordinates?)
Do you care about altitude?
Do you care about timestamp? (I understand that the server side can capture some kind of timestamp provided that the data is communicated immediately from the Librem 5 to the server.)
Just out of curiosity, is your script transferring your location info in plain text online?
To take this further: an L5 / linux phone app (GUI) that let’s user send location safely to server(s) or apps (sms) and set the parameters (how often and maybe using some events, like logging in and taking a photo etc.). There is need for something similar, as has been previously discussed. So, if someone does a script, why not take it a bit further…