20.1. Complemento GPS

20.1.1. O que é 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.

Nota

QGIS supports also GNSS receivers. But we keep using the term GPS in this documentation.

20.1.2. Carregando dados GPS de um arquivo

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 ► showPluginManager 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 ► :

  • importGPX GPS Tools

  • createGPX 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 Baixando dados de amostra for more information about the sample data.

  1. Select Vector ► GPS Tools or click the importGPX GPS Tools icon in the toolbar and open the Load GPX file tab (see Fig. 20.1).

  2. Browse to the folder qgis_sample_data/gps/, select the GPX file national_monuments.gpx and click Open.

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

Fig. 20.1 The GPS Tools dialog window

Use the Browse… button to select the GPX file, then use the checkboxes to select the feature types you want to load from that GPX file. Each feature type will be loaded in a separate layer when you click OK. The file national_monuments.gpx only includes waypoints.

Nota

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 https://www.topografix.com/GPX/1/1/.

20.1.3. 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 https://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.

20.1.4. Importando dados GPS

Para importar dados de GPS de um arquivo que não é GPX, você irá usar a ferramenta: guilabel: na caixa de diálogo Ferramentas GPS. Aqui, você seleciona o arquivo que deseja importar (e o tipo de arquivo), e onde você deseja armazenar o arquivo GPX convertido e qual o nome da nova camada. Note-se que nem todos os formatos de dados GPS irá suportar todos os três tipos de recurso, portanto, para muitos formatos você só será capaz de escolher entre um ou dois tipos.

20.1.5. Descarregando dados de um receptor GPS

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 Fig. 20.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.

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

Fig. 20.2 Ferramenta de download

O tipo de dispositivo que você selecionar no menu do aparelho GPS determina como GPSBabel tenta se comunicar com o seu dispositivo GPS. Se nenhum dos tipos disponíveis funcionar com o seu dispositivo GPS, você pode criar um novo tipo (ver seção ref: definindo-novo-dispositivo).

A porta pode ser um nome de arquivo ou algum outro nome que o seu sistema operacional utiliza como referência para a porta física em seu computador que o dispositivo GPS está conectado. Também pode ser simplesmente USB, para unidades de GPS habilitados para USB.

  • nix On Linux, this is something like /dev/ttyS0 or /dev/ttyS1.

  • win No Windows, é “COM1” ou “COM2”.

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

20.1.6. Carregando dados no receptor GPS

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.

20.1.7. Definindo novos tipos de dispositivo

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” será substituído por “-w” se você estiver baixando “Locais”, “-r” para “Rotas” e “-t” para “Trilhas”. Estas são as opções de comando que o GPSBabel possui para download.

%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.

Os comandos indicados nas linhas de ‘Carregar’ são aqueles utilizados para carregar os dados no dispositivo. As mesmas palavras-chave são utilizadas, porém %in é substituído pelo nome do arquivo GPS que é utilizado e %out é substituído pelo nome da porta.

You can learn more about GPSBabel and its available command line options at https://www.gpsbabel.org.

Depois de ter criado um novo tipo de dispositivo, ele aparecerá na lista de dispositivos para baixar e atualizar as ferramentas.

20.1.8. Download de pontos/trilhas para GPS

As described in previous sections QGIS uses GPSBabel to download points/tracks directly in the project. QGIS comes out of the box with a pre-defined profile to download from Garmin devices. Unfortunately there is a bug #6318 that does not allow create other profiles, so downloading directly in QGIS using the GPS Tools is at the moment limited to Garmin USB units.

20.1.8.1. Garmin GPSMAP 60cs

MS Windows

Install the Garmin USB drivers from https://www8.garmin.com/support/download_details.jsp?id=591

Ligue o aparelho de GPS, abra e digite “type = serial Garmin” e “port = usb”. Preencha os campos guilabel: ‘Nome da Camada’ e: guilabel: ‘Arquivo de Saída’. Às vezes, parece ter problemas em uma determinada pasta, use algo como “c:temp” que geralmente funciona.

Ubuntu/Mint GNU/Linux

É necessário em primeiro lugar discutir sobre as permissões do dispositivo, conforme descrito no site: https://wiki.openstreetmap.org/wiki/USB_Garmin_on_GNU/Linux. Você pode tentar criar um arquivo: ‘/ etc / udev / rules.d / 51 garmin.rules’ contendo esta regra

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

Depois disso, é necessário ter certeza de que o módulo do kernel “garmin_gps” não está carregando.

rmmod garmin_gps

and then you can use the GPS Tools. Unfortunately there seems to be a bug #7182 and usually QGIS freezes several times before the operation work fine.

20.1.8.2. Registro de dados BTGP-38KM (somente Bluetooth)

MS Windows

O erro já referido não permite fazer o download dos dados a partir do QGIS, por isso é necessário utilizar o GPSBabel a partir do comando ou usando a sua interface.

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

Ubuntu/Mint GNU/Linux

Use o mesmo comando (ou as configurações do GPSBabel GUI) no Windows. No Linux de alguma forma pode obter uma mensagem

skytraq: Too many read errors on serial port

seria a questão de desligar e ligar o registro de dados novamente.

20.1.8.3. Registro de dados BlueMax GPS-4044 (BT e USB).

MS Windows

Nota

Precisa instalar os drivers antes de usá-lo no Windows 7. Veja no site do fabricante qual o download adequado.

Baixando com GPSBabel, ambos com USB e BT retorna sempre um erro.

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 unsuccessfully with code 1

Ubuntu/Mint GNU/Linux

Com USB

Depois de ter ligado o cabo e utilizar o comando “dmesg” para a porta que está sendo usada, digite por exemplo “/dev/ttyACM3”. Então,será usado o GPSBabel para CLI ou GUI.

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

Com Bluetooth

Use Blueman como gerenciador de dispositivos para associar o dispositivo e disponibilizá-lo através de uma porta do sistema executando o GPSBabel.

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