Defining new device types

提供: OSGeo.JP Wiki
2009年8月18日 (火) 16:17時点におけるKayama (トーク | 投稿記録)による版

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

Defining new device types

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 tabs. <P> To define a new device you simply click the New device button, enter a name, a download command and an upload command for your device, and click the Update device button. The name will be listed in the device menus in the upload and download windows, and 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 will be replaced by ``-w if you are downloading waypoints, ``-r if you are downloading routes and ``-t if you are downloading tracks. These are command line options that tell GPSBabel which feature type to 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 GPS device: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.
The upload command is the command that is used to upload data to the device. The same keywords are used, but %in is now replaced by the name of the GPX file for the layer that is being uploaded, and %out is replaced by the port name.
You can learn more about GPSBabel and it's available command line options at http://www.gpsbabel.org
Once you have created a new device type it will appear in the device lists for the download and upload tools.