View Single Post
Posts: 1,341 | Thanked: 708 times | Joined on Feb 2010
#37
Originally Posted by synthaxx View Post
Code:
...
def on_changed(device, data):
    if not device:
        return
    if device.fix:
        if (device.fix[1] & location.GPS_DEVICE_LATLONG_SET) and (device.fix[1] & location.GPS_DEVICE_TIME_SET) and not (device.status & location.GPS_DEVICE_STATUS_NO_FIX):
            print "lat = %f, long = %f" % device.fix[4:6]
            data.stop()
...

loop.run()
Now save and run it with

Code:
python2.5 gps.py
If everything goes well you'll get a LAT LONG you can plug into google maps.
If it's out of GPS range, you'll have to kill it with CTRL+C.
How to change that Python script to get altitude also?
(Sowwy for being lazy and not look it up from specs myself.)

Last edited by zimon; 2010-04-02 at 17:48.