[Qgis-user] Hello

Pierre Chevalier Géologue pierrechevaliergeol at free.fr
Sat Jan 16 02:41:06 PST 2010


Hello,

paul ferro claviota:
> Hi Pierre or anyone else that has success with connecting to a GPS 
> with QGIS through the GPS plugin.

I Haven't tried this since a long time: gpsbabel works so well that I 
don't really need this extension. But I'll try it right now, and I'll 
tell you about it shortly.

> I am trying to connect a Garmin GPS that has a com to usb converter 
> cable.  

I think I have such a cable somewhere. I don't need it any more, since 
my garmin device has a USB port.

> Other apps. read my GPS from COM3, and work just fine.
> I just installed QGIS 1.4, and GPS babel is installed, and I have set 
> the PATH under environmental variables so that QGIS will see 
> gpsbabel.  But whenever I go to download from my GPS, 

Looks good, so far.

> I either get the message that 'GPS Babel would not start', 
Is gpsbabel in the search path of your system?
<troll>Do you use a modern operating system, with a Unix-type 
architecture, or one of these old-fashioned things which used to be 
sold, especially during the last century?  I think it was called 
Crimosoft windows, or something similar. (sorry, I couldn't help...)
These old, inefficient, etc. systems are really troublesome, as far as 
multiple search paths are concerned. Apparently, this seems to be your 
case, since you have to set PATH variable.</troll> Maybe there is 
another variable required?

> or 'this layer could not be added to the map'

Does this message appear _after_ the data was downloaded?

> What is the code that you are using for your GPS unit under devices in 
> the GPS Device Editor?
> The default for Garmin under the waypoint command is %gpsbabel -w -i 
> garmin -o gpx "%in" "%out"
> I've also tried %babel -w -i garmin -f COM: -o gpx -F gps.gpx  but 
> have not had luck.

This is the command line I use:

    gpsbabel -t -w -i garmin -o gpx -f /dev/ttyUSB0 -F tmp.gpx

It is included in a complete script that I use regularly.
Here is the script I use to dump my gps: it creates some backups, does 
some stuff, and eventually adds data to my main gps log file 
(gps_log.gpx). It is a bash script. I'm afraid the comments are in 
French, but it is quite understandable, I believe. There is still a bit 
of paranoid backups, you may notice; I'll remove them, one day:


    echo "Dompage de la montre garmin forerunner dans ~/gps/gps_log.gpx"
    cd ~/gps #_domps_montre_garmin_forerunner

    echo "Sauvegarde du gps/gps_log.gpx précédent dans .okz"
    cd .okz

    #tiré de mkdiraujourdhui
    i=`date +%Y_%m_%d`
    mkdir $i  &&  ls -trlh | tail -1

    cd ..
    cp gps_log.gpx .okz/$(ls .okz/ -trp | grep \/ | tail -1)

    #allons chercher les données du gps
    echo "Dompage des données du gps, préalablement convenablement raccordé"
    echo "..."
    gpsbabel -t -w -i garmin -o gpx -f /dev/ttyUSB0 -F tmp.gpx

    #pour enlever les:
    #  <cmt>^D#</cmt>
    #  <desc>^D#</desc>
    # disgrâcieux qui embêtent qgis:
    echo "nettoyage..."
    grep -v \# < tmp.gpx > tmp2.gpx

    #filtrons la sortie, manière de nettoyer un peu:
    #d'abord, on assemble les traces en une trace
    echo "rassemblage des traces en une seule..."
    gpsbabel -t -i gpx -f tmp2.gpx -x track,merge -o gpx -F tmp3.gpx
    #puis on redivise tout ça, en fonction du temps. On sépare les
    tracés quand il y a plus d'une demi-heure entre chaque point (GPS
    éteint ou sans couverture sat: ça évite les longs tronçons droits
    disgrâcieux quand on paume les satellites), et on met un titre
    explicite au tracé, généré à partir de la date&heure
    echo "puis redivision de la trace en fonction des arrêts de plus de
    30 minutes..."
    gpsbabel -t -i gpx -f tmp3.gpx -x
    track,pack,split=30m,title="%Y_%m_%d %r" -o gpx -F tmp4.gpx

    #gpsbabel -t -w -i garmin -o gpx -f domp_gps_forerunner_log.gpx -i
    gpx -f tmp2.gpx -F tmp3.gpx
    #marche plus, le 19/10/2008


    #puis on rassemble avec le fichier principal où on logge tout, en
    excluant les duplicates:
    echo "puis on rassemble avec le fichier principal où on logge tout,
    en excluant les duplicates..."
    gpsbabel -t -w -i gpx -f gps_log.gpx -i gpx -f tmp4.gpx -x
    duplicate,location -o gpx -F tmp5.gpx

    #on renomme le dernier fichier temporaire avec la date courante:
    echo "on renomme le dernier fichier temporaire avec la date courante..."
    i=domp_gps_`date +"%F-%Hh%M"`.gpx
    mv tmp4.gpx $i

    #quelques sauvegardes, un peu parano, mais tout ça est en cours
    d'écriture; on supprimera quand on sera sûr de soi:
    echo "quelques sauvegardes de plus..."
    cp gps_log_dernier.gpx gps_log_avant_dernier.gpx
    cp gps_log.gpx gps_log_dernier.gpx
    #Et finalement, on renomme le dernier vers LE fichier contenant tous
    les tracés:
    echo "Finalement, on renomme le dernier vers LE fichier contenant
    tous les tracés"
    mv tmp5.gpx gps_log.gpx

    #ménage
    echo "ménage"
    rm tmp.gpx
    rm tmp2.gpx
    rm tmp3.gpx

    #mv domp_gps_forerunner_log_dernier.gpx
    domp_gps_forerunner_log_avdernier.gpx
    #mv domp_gps_forerunner_log.gpx domp_gps_forerunner_log_dernier.gpx
    #mv tmp3.gpx domp_gps_forerunner_log.gpx


    #rm dernier_domp_gps_forerunner.gpx
    #ln -s tmp_domp_gps_forerunner_`date +"%F-%Hh%M"`_pt_trk.gpx
    dernier_domp_gps_forerunner.gpx

    #regardons un peu le résultat: on lance viking
    echo "regardons un peu le résultat: on lance viking"
    viking gps_log.gpx $i

    #puis on revient où on était au départ
    cd -




For some reason, strange characters appear in the .gpx from gpsbabel. 
And qgis or viking don't like them. This is the reason why I do the 
grep, to remove the troublesome lines:

    grep -v \# < tmp.gpx > tmp2.gpx

I should have issued a bug report, on this one, I think...

A+
Pierre

-- 
____________________________________________________________________________
Pierre Chevalier Géologue EI
    Mesté Duran
    32100 Condom
  Tél+fax  :    09 75 27 45 62
                05 62 28 06 83
		06 37 80 33 64
  Émail  :   pierrechevaliergeolCHEZfree.fr
  icq#   :   10432285
  skype  :   pierre.chevalier1967        
  http://pierremariechevalier.free.fr/pierre_chevalier_geologue     
____________________________________________________________________________






More information about the Qgis-user mailing list