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

Martin Dobias wonder.sk at gmail.com
Fri Mar 7 17:42:28 PST 2008


Hi,

the code on the wiki page doesn't look bad... keep on improving it :-)
Regarding the problems with empty sentences - there are two possibilities:
- check first whether the operation you're going to do is valid - thus
you'll avoid exceptions
- don't do the checks and catch exceptions in try-except blocks
It's up to you which one you'll choose...

Martin

On Fri, Mar 7, 2008 at 4:20 PM, Massimo Di Stefano
<massimodisasha at gmail.com> wrote:
> 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
>
> _______________________________________________
>  Qgis-user mailing list
>  Qgis-user at lists.osgeo.org
>  http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>



More information about the Qgis-user mailing list