.

Extension GPS

Qu’est ce que le GPS ?

GPS, the Global Positioning System, is a satellite-based system that allows anyone with a GPS receiver to find their exact position anywhere in the world. GPS is used as an aid in navigation, for example in airplanes, in boats and by hikers. The GPS receiver uses the signals from the satellites to calculate its latitude, longitude and (sometimes) elevation. Most receivers also have the capability to store locations (known as waypoints), sequences of locations that make up a planned route and a tracklog or track of the receiver’s movement over time. Waypoints, routes and tracks are the three basic feature types in GPS data. QGIS displays waypoints in point layers, while routes and tracks are displayed in linestring layers.

Charger des données GPS à partir d’un fichier

There are dozens of different file formats for storing GPS data. The format that QGIS uses is called GPX (GPS eXchange format), which is a standard interchange format that can contain any number of waypoints, routes and tracks in the same file.

To load a GPX file, you first need to load the plugin. Plugins ‣ mActionShowPluginManager Plugin Manager... opens the Plugin Manager Dialog. Activate the checkbox GPS Tools checkbox. When this plugin is loaded, a button with a small handheld GPS device will show up in the toolbar and in Layer ‣ Create Layer ‣ :

  • import_gpx GPS Tools
  • create_gpx Create new GPX Layer

For working with GPS data, we provide an example GPX file available in the QGIS sample dataset: qgis_sample_data/gps/national_monuments.gpx. See section Échantillon de données for more information about the sample data.

  1. Select Vector ‣ GPS ‣ GPS Tools or click the import_gpx GPS Tools icon in the toolbar and open the Load GPX file tab (see figure_GPS_1).
  2. Naviguez vers le répertoire qgis_sample_data/gps/, sélectionnez le fichier national_monuments.gpx et cliquez sur le bouton [Ouvrir].

Figure GPS 1:

../../../_images/loadgpx.png

The GPS Tools dialog window nix

Utilisez le bouton [Parcourir] pour sélectionner le fichier GPX, puis utilisez la case à cocher pour sélectionner les types de géométrie que vous voulez charger à partir de ce fichier GPX. Chaque type d’objet sera chargé dans une couche séparée lors du clic sur le bouton [OK]. Le fichier national_monuments.gpx ne contient que des waypoints.

Note

GPS units allow you to store data in different coordinate systems. When downloading a GPX file (from your GPS unit or a web site) and then loading it in QGIS, be sure that the data stored in the GPX file uses WGS 84 (latitude/longitude). QGIS expects this, and it is the official GPX specification. See http://www.topografix.com/GPX/1/1/.

GPSBabel

Since QGIS uses GPX files, you need a way to convert other GPS file formats to GPX. This can be done for many formats using the free program GPSBabel, which is available at http://www.gpsbabel.org. This program can also transfer GPS data between your computer and a GPS device. QGIS uses GPSBabel to do these things, so it is recommended that you install it. However, if you just want to load GPS data from GPX files you will not need it. Version 1.2.3 of GPSBabel is known to work with QGIS, but you should be able to use later versions without any problems.

Importer des données GPS

Pour importer des données d’un fichier qui n’est pas un fichier GPX, vous devez utiliser l’outil Importer un autre fichier dans la fenêtre des outils GPS. Vous sélectionnez le fichier que vous voulez importer, le type de géométrie, l’emplacement où stocker le fichier GPX converti et sous quel nom l’enregistrer. Tous les formats de données GPS ne supportent pas les trois types d’entités, ne vous laissant le choix qu’entre un ou deux types.

Télécharger des données GPS à partir d’un périphérique

QGIS can use GPSBabel to download data from a GPS device directly as new vector layers. For this we use the Download from GPS tab of the GPS Tools dialog (see Figure_GPS_2). Here, we select the type of GPS device, the port that it is connected to (or USB if your GPS supports this), the feature type that you want to download, the GPX file where the data should be stored, and the name of the new layer.

Figure GPS 2:

../../../_images/download.png

L’outil de téléchargement

Le type de périphérique que vous sélectionnez dans le menu périphérique GPS détermine comment GPSBabel tente de communiquer avec votre périphérique GPS. Si aucun des types ne fonctionne avec votre périphérique GPS, vous pouvez créer un nouveau type adapté (voir la section Définir de nouveaux types de périphériques).

Le port peut être un nom de fichier ou n’importe quel autre nom que votre système d’exploitation utilise comme référence vers le port physique de votre ordinateur sur lequel est connecté le périphérique GPS. Cela peut aussi être de l’USB, si votre périphérique GPS fonctionne dans ce mode.

  • nix Sous Linux, il s’agit de quelque chose qui ressemble à /dev/ttyS0 ou /dev/ttyS1.

  • win Sous Windows, il s’agit de COM1 ou COM2.

When you click [OK], the data will be downloaded from the device and appear as a layer in QGIS.

Envoyer des données GPS vers un appareil

You can also upload data directly from a vector layer in QGIS to a GPS device using the Upload to GPS tab of the GPS Tools dialog. To do this, you simply select the layer that you want to upload (which must be a GPX layer), your GPS device type, and the port (or USB) that it is connected to. Just as with the download tool, you can specify new device types if your device isn’t in the list.

This tool is very useful in combination with the vector-editing capabilities of QGIS. It allows you to load a map, create waypoints and routes, and then upload them and use them on your GPS device.

Définir de nouveaux types de périphériques

There are lots of different types of GPS devices. The QGIS developers can’t test all of them, so if you have one that does not work with any of the device types listed in the Download from GPS and Upload to GPS tools, you can define your own device type for it. You do this by using the GPS device editor, which you start by clicking the [Edit devices] button in the download or the upload tab.

To define a new device, you simply click the [New device] button, enter a name, enter download and upload commands for your device, and click the [Update device] button. The name will be listed in the device menus in the upload and download windows – it can be any string. The download command is the command that is used to download data from the device to a GPX file. This will probably be a GPSBabel command, but you can use any other command line program that can create a GPX file. QGIS will replace the keywords %type, %in, and %out when it runs the command.

%type sera remplacé par -w si vous téléchargez des waypoints, -r pour des routes et -t pour des tracks. Ce sont des options de la ligne de commande qui précisent à GPSBabel quel type d’objet télécharger.

%in will be replaced by the port name that you choose in the download window and %out will be replaced by the name you choose for the GPX file that the downloaded data should be stored in. So, if you create a device type with the download command gpsbabel %type -i garmin -o gpx %in %out (this is actually the download command for the predefined device type ‘Garmin serial’) and then use it to download waypoints from port /dev/ttyS0 to the file output.gpx, QGIS will replace the keywords and run the command gpsbabel -w -i garmin -o gpx /dev/ttyS0 output.gpx.

La commande de téléchargement est la commande qui est utilisée pour télécharger des données vers le périphérique. Les même mots-clés sont utilisés mais %in est maintenant remplacé par le nom du fichier GPX pour la couche qui est à uploader et %out est remplacé par le nom du port.

Pour en savoir plus sur GPSBabel et les options de ligne de commande disponibles, référez-vous à http://www.gpsbabel.org.

Une fois le nouveau type de périphérique créé, celui-ci apparaîtra dans les listes de périphériques des outils de téléchargement et d’upload.

Chargement de points/traces depuis un périphérique GPS

Comme précisé dans les sections précédentes, QGIS utilise GPSBabel pour télécharger les points et traces directement dans le projet. QGIS est fourni avec un profil pré-défini pour charger depuis des périphériques GPS Garmin. Malheureusement il existe un bug #6318 qui ne permet pas de créer d’autres profils, aussi le téléchargement direct dans QGIS depuis les Outils GPS est pour le moment limité aux périphériques Garmin.

Garmin GPSMAP 60cs

MS Windows

Installez les drivers USB Garmin depuis http://www8.garmin.com/support/download_details.jsp?id=591

Connectez le périphérique. Ouvrez les Outils GPS et utilisez Périphérique GPS=Garmin serial et Port=usb: Remplissez les champs Nom de la couche and Fichier en sortie. Quelquefois il semble y avoir des problèmes avec certains répertoire, cela fonctionne en général en utilisant un répertoire du style c:\temp.

Ubuntu/Mint GNU/Linux

Il est d’abord nécessaire de régler un problème concernant les permissions du périphérique, comme cela est expliqué à cette adresse : https://wiki.openstreetmap.org/wiki/USB_Garmin_on_GNU/Linux. Vous pouvez essayer de créer un fichier /etc/udev/rules.d/51-garmin.rules contenant cette règle

ATTRS{idVendor}=="091e", ATTRS{idProduct}=="0003", MODE="666"

Après cela il est nécessaire de s’assurer que le module du noyau garmin_gps n’est pas chargé

rmmod garmin_gps

vous pouvez alors utiliser les Outils GPS. Malheureusement il semble y avoir un bug #7182 et généralement QGIS se bloque plusieurs fois avant que l’opération ne réussisse.

BTGP-38KM datalogger (seulement Bluetooth)

MS Windows

Un bug connu ne permet pas de télécharger les données depuis QGIS, aussi il est nécessaire d’utiliser GPSBabel depuis la ligne de commande ou à travers son interface dédiée. La commande qui fonctionne est

gpsbabel -t -i skytraq,baud=9600,initbaud=9600 -f COM9 -o gpx -F C:/GPX/aaa.gpx

Ubuntu/Mint GNU/Linux

Avec Windows, utilisez la même commande (ou les mêmes paramètres si vous utilisez l’interface de GPSBabel). Sous Linux il est possible que vous obteniez un message du genre

skytraq: Too many read errors on serial port

vous pouvez tenter d’allumer et d’éteindre le datalogger avant de réessayer.

BlueMax GPS-4044 datalogger (BT et USB)

MS Windows

Note

Il est nécessaire d’installer ses drivers avant l’utilisation dans Windows 7. Voir le site du fabricant pour le téléchargement des drivers.

Télécharger avec GPSBabel, aussi bien en USB ou BT retourne toujours une erreur du genre

gpsbabel -t -i mtk -f COM12 -o gpx -F C:/temp/test.gpx
mtk_logger: Can't create temporary file data.bin
Error running gpsbabel: Process exited unsucessfully with code 1

Ubuntu/Mint GNU/Linux

Avec USB

Après avoir connecté le cable, utilisez la commande dmesg pour afficher le port qui est utilisé, par exemple /dev/ttyACM3. Ensuite utilisez GPSBabel comme d’habitude depuis la ligne de commande ou son interface dédiée.

gpsbabel -t -i mtk -f /dev/ttyACM3 -o gpx -F /home/user/bluemax.gpx

Avec Bluetooth

Utilisez le gestionnaire de périphériques Blueman (Blueman Device Manager) pour associer le périphérique et le rendre accessible à travers un port du système, puis lancez GPSBabel

gpsbabel -t -i mtk -f /dev/rfcomm0 -o gpx -F /home/user/bluemax_bt.gpx