Using PyS60 we can retrieve GPS data either from Bluetooth receiver or Internal GPS receiver. There are many examples describing how to receive data from Bluetooth receiver. But there are only little information about using the Internal GPS receiver which in present in some of the Nokia handsets (N95, N82, etc…). I wrote a small PyS60 script to retrieve GPS data using internal receiver.
To receive the GPS data we use the positioning module. The position module has many methods to select the receiver module, request the service, retrieve the GPS data, etc… Here is the script to retrieve the data. Copy this script to a file and upload to Python folder of your phone and use the Python Shell to run the script. Please note that you should have a signed version of the Python Shell with Location capability in order to run this script, otherwise you will receive and error.
import positioning
print "Sample script to display GPS data, by Krishnaraj Varma"
print ""
print "Default Module:"
print positioning.default_module()
print ""
positioning.select_module(positioning.default_module())
print "Detailed Module Info:"
print ""
print positioning.module_info(positioning.default_module())
print "GPS Data:"
print ""
positioning.set_requestors([{"type":"service","format":"application","data":"test_app"}])
print positioning.position(course=1,satellites=1)
print ""
print ""
On my Nokia N82 phone the output is:
Sample script to display GPS data, by Krishnaraj Varma
Default Module:
270526858
Detailed Module Info:
{‘available’: 1, ‘status’: {‘data_quality’: 0, ‘device_status’: 3}, ‘version’: u’1.00(0)’, ‘name’: u’Integrated GPS’, ‘position_quality’: {‘vertical_accuracy’: 10.0, ‘time_to_first_fix’: 1000000L, ‘cost’: 1, ‘time_to_next_fix’: 1000000L, ‘horizontal_accuracy’: 10.0, ‘power_consumption’: 3}, ‘technology’: 1, ‘id’: 270526858, ‘capabilities’: 127, ‘location’: 1}
GPS Data:
{‘satellites’: {‘horizontal_dop’: 4.59999990463257, ‘used_satellites’: 6, ‘vertical_dop’: 5.23999977111816, ‘time’: 1217662454.07, ‘satellites’: 9, ‘time_dop’: 4.28999996185303}, ‘position’: {‘latitude’: 9.761066878452, ‘altitude’: NaN, ‘vertical_accuracy’: NaN, ‘longitude’: 76.326954522858, ‘horizontal_accuracy’: 70.6172790527344}, ‘course’: {‘speed’: 0.5, ‘heading’: 242.5, ‘heading_accuracy’: 359.989990234375, ‘speed_accuracy’: 1.11000001430511}}
For more information about positioning module, visit this discussion about the module. This script is only tested on my Nokia N82 handset
One application I am working on is to display the real time GPS position using Google Map. The idea is to retrieve the data at specified interval and send the longitude and latitude information to this site and display it using Google Map API. I will update when it is finished.