| Reply | « Previous Thread | Next Thread » |
|
How to store GPS data from built-in GPS into text file by logging method, with a simple python script? any help will be appreciated
![]() |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
You have to do 2 things: read the GPS data and then write it to a file, by either appending or replacing the existing data from the file.
|
|
thanks for info, i have tried on Read the GPS data but it show me the increasing value like 100.0000, 200.0000 and so on. What is wrong at here? sorry i am dumb newbie..
|
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Offline
Forum Nokia Champion
|
|
|
Quote:
the code is working very fine in my case are you sure you are getting the GPS readings like 100.000 and 200.000 because the code will actually give you three things. Regards Gaba88 Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60 |
|
thanks for reply, i mistaken. It show 1 0.0 0.0 0.0, then 2 0.0...so on, is that mean it still acquiring for GPS data? I also have a tried to replace the variables_1&2 with pos_lat and pos_long, but it dint show in the output file..
|
|
Hey, I had a similar problem with the values being printed just being 1 0.0, 0.0, 0.0, 2 0.0, 0.0, 0.0 etc. I switched to using LocationRequestor (https://www.iyouit.eu/portal/software.aspx) and by doing the following you can log to a file.
----------------------------------- import locationrequestor BATTERY_FILE = "e:\\Python\\GPS DATA.csv" def log(data): fi = file(BATTERY_FILE, "a") print >> fi, data, fi.close(); lr = locationrequestor.LocationRequestor(); lr.SetUpdateOptions(updateInterval, updateTimeout, maxAge, allowPartial); lr.Open(lr.GetDefaultModuleId()); while(True): pos = lr.NotifyPositionUpdate(); log(pos + "\n"); lr.Close(); ----------------------------------- This should print the position information to a csv file for you to review later! |
| Spud_Gun31 |
| View Public Profile |
| Find all posts by Spud_Gun31 |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Offline
Forum Nokia Champion
|
|
|
Quote:
let me tell you that the code will only get the correct GPS co-ordinates after fixing the GPS inside your device. So prior to run this code please fix the GPS inside your device. Enjoy Pythoning Gaba88 Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60 |
|
hi, i'm still having a problem by replacing either read the GPS data & write it to a file. Is it a way to read NMEA data from built-in gps? Because i know that in NMEA data like GGA, GMC it can string up most useful info.
![]() ![]() |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Offline
Forum Nokia Champion
|
|
|
Quote:
i am not clear whar problem you are facing in the code. ![]() It will be graet if you show the dibo a bit of code you are using and ofcourse whats the device you are using. Regards Gaba88 Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60 |
|
Sorry for my dumb newbie, I am using the read the GPS data script,
Quote:
|
|
Quote:
2. Replace that line which prints on the screen with a line which writes the data to the file you opened in the beginning. 3. Close the file when you are ready to finish, you probably don't want to read gps in infinite "while True" loop. -- Aapo Rista http://code.google.com/p/pys60gps/ http://opennetmap.org/ |
|
I am try like this:
HTML Code:
import e32, appuifw, positioning, codecs, thread
class Logger(object):
def gps_init(self):
global gps_data
gps_data = {
'satellites': {'horizontal_dop': 0.0, 'used_satellites': 0, 'vertical_dop': 0.0, 'time': 0.0,'satellites': 0, 'time_dop':0.0},
'position': {'latitude': 0.0, 'altitude': 0.0, 'vertical_accuracy': 0.0, 'longitude': 0.0, 'horizontal_accuracy': 0.0}
}
try:
positioning.select_module(positioning.default_module())
positioning.set_requestors([{"type":"service","format":"application","data":"gps_app"}])
positioning.position(satellites=1,callback=self.gps, interval=100000,partial=0)
appuifw.note(u"GPS Connected",'info')
e32.ao_sleep(1)
self.gps_init = True
except:
appuifw.note(u'Problem with GPS','error')
self.update_debug_info()
def gps_stop(self):
try:
positioning.stop_position()
appuifw.note(u"GPS Turn Off",'info')
except:
appuifw.note(u'Problem with GPS','error')
self.update_debug_info()
def gps(self,event):
global gps_data
self.gps_data = event
def start_logging(self):
if not self.is_running:
if self.GPS_ON:
self.is_running = True
else:
self.gps_on()
self.is_running = True
if not self.SENSORS_ON:
self.connect_sensors()
self.printf('logging...')
app_lock.signal()
self.update_debug_info()
thread.start_new_thread(self.log_thread, ())
def stop_logging(self):
if self.is_running:
self.is_running = False
self.printf('stoped logging.')
app_lock.signal()
else:
self.printf('nothing to stop...')
self.update_debug_info()
def log_thread(self):
lockTHR = thread.allocate_lock()
while logger.is_running:
lockTHR.acquire()
e32.ao_sleep(1)
self.printf(str(time.ctime(time.time())))
self.write_log('')
lockTHR.release()
def write_log(self,pt):
gpsTime = self.gps_data['satellites']['time']
pos_lat = self.gps_data['position']['latitude']
pos_long = self.gps_data['position']['longitude']
if self.GPS_ON:
log += str(pos_lat) + ';' + str(pos_long) + ';' + str(speed) + ';'
else:
log += '0;0;0;'
if self.showLog:
self.printf(log)
if self.is_running:
try:
f = open(u'c:\\Python\\log\\' + self.log_file + '.txt','a')
f.writelines(log)
f.close()
except:
self.printf(str(time.ctime(logTime)) + u"\nCannot save logto file: " + self.log_file)
global mainLoop, logging
mainLoop = True
logger = Logger()
e32.ao_sleep(1)
while mainLoop:
app_lock = e32.Ao_lock()
logger.setMenu()
app_lock.wait()
|
|
Quote:
Why does this line result in KErrNotFound? lr.Open(lr.GetDefaultModuleId()) I also tried "positioning" module and positioning.select_module(positioning.default_module()), but in this case I get a KErrAccessDenied. How can I access location data on my n82?!? ![]() |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Offline
Forum Nokia Champion
|
|
hello cassioli
sorry for the stupid question but do you have a signed scriptshell with Location capability at least if you are using a script. ![]() Regards, Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60
Last edited by gaba88 : 2009-09-20 at 19:16.
|
|
the point is that I'm really confusef about WHAT to sign and HOW, as signin process and python itself changed a lot during the yars, and I read threads which spans from 2005 to 2009, and each one say a different thing...
I'd like to know the excat steps needed TODAY to enable python 1.4.5 to access location API... any location API (built-in, or locationrequestor, or gps_location, or whatelse). |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| 6212 - how to store data from midlet into internal mifare | craig_mobiqa | Near Field Communication | 2 | 2009-11-12 10:48 |
| LBS API - GPS raw data | pz1974 | General Symbian C++ | 1 | 2009-02-07 17:01 |
| How to receive GPS Data from GPS chipset using bluetooth and serial port | RB_Sahu | Symbian Networking & Messaging | 1 | 2008-01-24 11:58 |
| 6600 gprs 发送大量rtp延时问题 | dicson_hu | Symbian | 9 | 2005-11-04 03:12 |
| Problem writing Unicode data with RFile Write method | rushj | General Symbian C++ | 3 | 2005-08-01 14:39 |