<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
   [
    <!ENTITY appname          "Viking">
    <!ENTITY dhpackage        "viking">
   ]
>
<section id="commandline">
<title>Command Line</title>
<section>
<title>Overview</title>
<para>
&appname; being a Graphical User Interface program only has a few command line options.
</para>

<!-- keep this cmdsynopsis aligned with the man page version -->
<refentry>
  <refnamediv>
    <refname>&dhpackage;</refname>
    <refpurpose>program to manage GPS data</refpurpose>
  </refnamediv>
  <refsynopsisdiv>
    <cmdsynopsis>
      <command>&dhpackage;</command>
      <group choice="opt">
        <arg choice="plain"><option>-d</option></arg>
        <arg choice="plain"><option>--debug</option></arg>
      </group>
      <group choice="opt">
        <arg choice="plain"><option>-V</option></arg>
        <arg choice="plain"><option>--verbose</option></arg>
      </group>
      <sbr/>
      <group choice="opt">
        <arg choice="plain"><option>--latitude</option> <replaceable>degrees</replaceable></arg>
      </group>
      <group choice="opt">
        <arg choice="plain"><option>--longitude</option> <replaceable>degrees</replaceable></arg>
      </group>
      <sbr/>
      <group choice="opt">
        <arg choice="plain"><option>-z</option></arg>
        <arg choice="plain"><option>--zoom</option> <replaceable>ZoomLevelOSM</replaceable></arg>
      </group>
      <group choice="opt">
        <arg choice="plain"><option>-m</option></arg>
        <arg choice="plain"><option>--map</option> <replaceable>MapId</replaceable></arg>
      </group>
      <group choice="opt">
        <arg choice="plain"><option>-e</option></arg>
        <arg choice="plain"><option>--external</option></arg>
      </group>
      <sbr/>
      <arg rep="repeat"><replaceable>file</replaceable></arg>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>&dhpackage;</command>
      <group choice="opt">
        <arg choice="plain"><option>-h</option></arg>
        <arg choice="plain"><option>--help</option></arg>
      </group>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>&dhpackage;</command>
      <group choice="opt">
        <arg choice="plain"><option>-v</option></arg>
        <arg choice="plain"><option>--version</option></arg>
      </group>
    </cmdsynopsis>
  </refsynopsisdiv>
  <!-- Blank to keep xmllint parsing happy -->
  <refsection>
    <title></title><para></para>
  </refsection>
</refentry>
</section>

<section><title>Details</title>
<para>
Note that the ordering of files can be important depending on their file type.
Subsequent non Viking project files are loaded into the previous Viking project, with the files being processed left to right.
Some examples:
</para>
<itemizedlist>
<listitem><para><literal>viking file1.gpx file2.gpx file3.gpx</literal></para><para> Here all GPX files are loaded into a new &appname; project in one window.</para></listitem>
<listitem><para><literal>viking file1.vik file2.vik</literal></para><para> Each &appname; project file is opened in a new window.</para></listitem>
<listitem><para><literal>viking file1.vik file2.gpx file3.gpx</literal></para><para> The GPX files are loaded into the &appname; project in one window.</para></listitem>
<listitem><para><literal>viking file2.gpx file3.gpx file1.vik</literal></para><para> The GPX files are loaded into a new &appname; project in a one window and the &appname; project is loaded seperately in a seperate window.</para></listitem>
</itemizedlist>

<table frame='all'><title>Command Line Reference</title>
<tgroup cols='3' align='left' colsep='1' rowsep='1'>
<thead>
<row>
  <entry>Short Option</entry>
  <entry>Long Option</entry>
  <entry>Description</entry>
</row>
</thead>
<tbody>
<row>
  <entry>-h</entry>
  <entry>--help</entry>
  <entry>Show the command line options and then exit.</entry>
</row>
<row>
  <entry>-V</entry>
  <entry>--verbose</entry>
  <entry>Run in verbose mode. Some information about what &appname; is doing is shown in stdout.</entry>
</row>
<row>
  <entry>-d</entry>
  <entry>--debug</entry>
  <entry>Run in debug mode. Even more information about what &appname; is doing is shown in stdout.
This also enables some extra information features in the GUI itself, primarily of interest to developers.
  </entry>
</row>
<row>
  <entry>-v</entry>
  <entry>--version</entry>
  <entry>Show the version and then exit.</entry>
</row>
<row>
  <entry>N/A</entry>
  <entry>--latitude</entry>
  <entry>Set the initial position to the specified latitude in decimal degrees.</entry>
</row>
<row>
  <entry>N/A</entry>
  <entry>--longitude</entry>
  <entry>Set the initial position to the specified longitude in decimal degrees.</entry>
</row>
<row>
  <entry>-z</entry>
  <entry>--zoom</entry>
  <entry>Set the initial zoom level. The value is the OSM zoom level (0 - 22).</entry>
</row>
<row>
  <entry>-m</entry>
  <entry>--map</entry>
  <entry>Add a map layer by specifying the map id. The value needs to match one of the internal ids or an id from the <xref linkend="map_source"/>.
   Specifying a value of 0 will use the map layer default.</entry>
</row>
<row>
  <entry>-e</entry>
  <entry>--external</entry>
  <entry>The GPX files specified on the command line will be loaded in as <emphasis>external files</emphasis> as per the <xref linkend="open_gpx_external"/> method.</entry>
</row>
</tbody>
</tgroup>
</table>

<variablelist>
  <varlistentry><term></term><listitem><para>Internal Map Ids:</para></listitem></varlistentry>
  <varlistentry><term></term><listitem><para>OSM Mapnik = 13</para></listitem></varlistentry>
  <varlistentry><term></term><listitem><para>OSM Cycle = 17</para></listitem></varlistentry>
  <varlistentry><term></term><listitem><para>OSM Transport = 20</para></listitem></varlistentry>
  <varlistentry><term></term><listitem><para>OSM Humanitarian = 22</para></listitem></varlistentry>
</variablelist>

<para>
An example to open at a specified location with an OSM Mapnik map layer:
<screen>viking --latitude 51.4 --longitude -1.3 --zoom 12 --map 13</screen>
If a file is also specified on the command line, the command line location and zoom parameters will take precendence.
</para>

<para>
  Viking supports <ulink url="https://tools.ietf.org/html/rfc5870">RFC5870</ulink>, the 'geo' URI scheme.
  Every 'file' on the command line is checked to see if in fact it is a geo URI.
  Thus the above example in geo URI format is:
<screen>viking geo:51.4,-1.3?z=12 --map 13</screen>
</para>

<note>
<para>
As a special combination when both <emphasis>-V and -d</emphasis> are both enabled at the same time, &appname; will not delete some of the temporary files created during the program run.
This is especially useful to monitor results of download requests (which need to be interpreted) if they suddenly start failing, as the file will have often more detailed information about the failure mode.
</para>
</note>

<para>
&appname; being a GTK+ program means some options are processed by GTK+ itself such as --display. Use the following to find out what they are for your system:
<screen>viking --help-gtk</screen>
</para>

</section>
</section>
