[Qgis-user] Re: Qgis-user Digest, Vol 25, Issue 9

Massimo Di Stefano massimodisasha at gmail.com
Fri Mar 7 07:20:43 PST 2008


hi Martin

i'm doing something about gps signal acquisition,

i wrote a initial script
to produce a gml from the nmea
it read the serial port where is connected the gps-receiver and write  
out to gml format

http://wiki.gfoss.it/index.php/GPS_scrip_:_Parsing_del_segale_NMEA

for now it is in "development" it is in a ugly form
(not well legible, i need to optimize its sintax, like adding
a dictionary to store the variables)

it need an "excepition gestion"
beacouse if the nmea signal is low (or parts of it is empty)
the script exit ... and need to be reload.

i haven't experience using "try"
mybe it could be a solution
... i.e. if the signal is not good do :
    sleep 0.5
    continue
... and so on ,  until the nmea signal is readable

in the loop i've :

while 1:
	line = gps.readline()
	datablock = line.split(',')
         if line[0:6] == '$GPGGA':
         ...

#to manage the exception
#would be ??? :

while 1:
         try:
	    line = gps.readline()
	    datablock = line.split(',')
             if line[0:6] == '$GPGGA':
                 #** except ...
                 sleep(0.5)
                 continue
                 quality = string.atof(datablock[6])
                 ...

             if line[0:6] == '$GPGGA':
                 #** except ...
                 sleep(0.5)
                 continue
                 utctime = string.atof(datablock[1])
                 ...
             ...


i'll try to find how to manage the "try-except" statment
maybe it must controls the case where :

- a specific datablock[] is empty or not a number
- the numbers of the needed params is less than nedded

any suggestion, improvments, corrections are welcome

regards,

Massimo


Il giorno 07/mar/08, alle ore 02:11, qgis-user-request at lists.osgeo.org  
ha scritto:

> On Thu, Mar 6, 2008 at 9:36 PM, victor javier morales
> <vjmorales at gmail.com> wrote:
>>
>> I think the same of you martin, but
>> the real problem is that we don't know How this machines deliver  
>> their data,
>> for example the format for this data or the speed in real time.
>>
>
> The data formats sent by GPS are usually well-documented, moreover
> there is a de facto standard NMEA-0183 which is used by majority of
> GPS producers.
>
> Martin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20080307/b3c1f1db/attachment.html>


More information about the Qgis-user mailing list