Python and GPSD

John McKenzie davros at bellaliant.net
Sat May 21 13:13:29 EDT 2016


 Good day, all.

 I need help using the Python bindings for GPSD. Specifically, I would 
like to take a latitude reading, put it in a variable and use it later. 
The problem is that every example I see involves constantly taking 
changing readings. That part I have working for myself by following 
existing examples.

 If I put any code in any kind of loop my latitude variable will keep 
changing. If I do not put in a loop, it will appear to be zero. (I do  
not live on the equator.)

 The Python GPS module is installed, cgps works fine, other aspects of 
the script involving GPS work fine.

 I want to be able to turn on a single board computing device, have it  
get a latitude reading, put that coordinate into a variable, then go 
along its merry way using that variable for the rest of the script. 
(Running my script upon boot, running the GPSD service, etc, is all fine 
and working.)

My script:
http://hastebin.com/zuwamuqoxe.coffee

 On line 37 I try to define an initial latitude variable, intLatitude. It 
comes up as zero right now. I need it to be whatever the GPS says for 
latitude when the script starts and stay that way.

 Help is appreciated.

 Apologies to those who read my script for the poor code quality. Learned 
a little Python last year, then only started again with it recently. 
Still a Python newbie, and am rushed for this particular project.

 Thanks.




More information about the Python-list mailing list