Configuration (old)

From Navit's Wiki
Revision as of 02:55, 22 January 2008 by Ouellettesr (talk | contribs)
Jump to: navigation, search

The configuration file of Navit is simply a xml file. Edit it with your favorite editor. You will find a good sample in your dist/src/navit.xml

When launched, navit will look for the followings files, in this order :

  • The first argument supplied on the command line. e.g : navit testconfig.xml
  • The navit.xml file in ~/.navit/navit.xml : e.g : /home/myuser/.navit/navit.xml. This is probably to best place to customize your settings.
  • The navit.xml.local file in the current directory. Used mainly for development, but maybe also usefull for you.
  • The navit.xml file in the current directory.

Structure

At the beginning, you will find the <plugins> section. This will be documented later. Leave it alone for now.

Next, you will have your navit instance.

An instance looks like the following :

  • A gui definition :
<navit [options]>
  • One or more vehicles to track (nmea data source, log file, etc)
<vehicle [options] />
  • A mapset, with one or more maps :
<mapset>
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map" />
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp2.smp" />
</mapset>
  • And finally, one or more layouts.

Don't forget the </navit> at the end.

The navit instance

The default navit instance looks like this :

<navit center="5031.51 N 735.83 E" zoom="8192" >
<gui type="gtk" />
<graphics type="gtk_drawing_area" />


This will load the gtk gui, using the gtk_drawing_area graphics driver.

The center / zoom values are explained below also gui and graphics

The gui (gui)

Currently, you have two guis :

  • the gtk one (the default)
  • the sdl one

If you're using the SDL gui, some tweaks are recommended. For the impatient :

  • Change the zoom level to 128 (the SDL renderer is designed to render close-to-ground maps)
  • Add follow="1" update="1" to your vehicle definition (to always center the view on your position, and to show what you should be seeing, instead of facing North)
  • tilt="400" view_mode="3D" to set initial view-mode and 3D-tilt.
  • media_window_title="TEST APP" media_cmd="test" to set action for the Media-button.
  • you can set the skin by using skin="skin name". Currently, navit is provided with 2 skins, the default one (Taharez) and the "Mineque" skin, which is still being worked on.

See below for more explanations.


The SDL gui seems currently not working on some platforms - this is investigated at the moment.

The graphic driver (graphics)

Also, the two most used graphics drivers are the followings : - gtk_drawing_area, used by the gtk gui - opengl, used currently only by the sdl gui. This may change later, for example a GTK gui could use opengl to render its graphics.

This looks like the following in the navit.xml:

<gui type="gtk" />
<graphics type="gtk_drawing_area" />

or for the sdl gui:

<gui type="sdl" tilt="400" view_mode="3D" skin="Mineque" />
<graphics type="opengl" />

For the moment don't mix the gui / graphics types.

optional for sdl a skin could be selected. It must be defined in the gui/sdl/datafiles directory

The default map view center (center)

This defines where the map should be centered at startup. Use WSG-84 coordinates.

The form is

center="[D]DMM.xxx N/S [D][D]DMM.yyy E/W"

or

center="[-][D]D.x[x]... [-][D][D]D.x[x]"

or

center="[-]0xX [-]0xX" 


D are degrees, M are minutes and xxx and yyy are the fractal parts of the minutes. Use N or S for North / South and E or W for East / West.

For example

center="4744.123 N 913.876 E"

The zoom level (zoom)

It's a power of 2 indicating the starting zoom level. 1 is the lower value, closest to the ground. You can use almost whatever power of two you want. Of course, the zoom level can be adjusted at run time :)

You can use almost any value for the gtk gui, but the sdl gui will react better (and the drawings will look nicer) with a lower zoom value. 128 is often a good idea for sdl :

<navit center="5031.51 N 735.83 E" zoom="128" >

The initial view (tilt, view_mode)

This defines the view mode the gui has on startup. "view_mode" can be set to '2D' or '3D'. The tilt value defines default camera tilting, with a value from 0 to 2000.

for example:

<gui type="sdl" tilt="400" view_mode="3D" />

The vehicles definitions

A vehicle definition looks like this :

<vehicle name="Meins" enabled="no" source="gpsd:\/\/localhost" color="#0000ff"/>

You can have as many vehicle as you like! It's for example usefull to track your friends, etc.

Source: If you don't want to use gpsd you can just type (the example is for a serial gps device)

<vehicle name="Meins" enabled="no" source="file://dev/ttyS0" color="#0000ff"/>

Here are the available options :

  • follow : this will force the map to be drawn with the bearing you currently have, instead of having the north at the top
  • update : this will force the map to be recentered at your main cursor's position.

By default, in the gtk gui, the cursor moves onto the map until it reaches a border, then the map will be re-centered. This saves a lot of CPU time, by avoiding to always redraw the map (very useful for small devices like smart phones).

The 3d view of the SDL gui is meant to draw the road as YOU see it when driving, so you need to always recenter the map to your position. So, to get a good tracking, if you're using sdl, you should use this kind of settings :

<vehicle name="Meins" enabled="no" source="gpsd:\/\/localhost" color="#0000ff" update="1" follow="1"/>

To record your trip for Error Reporting: Add a sub-instance "log" to the vehicle

<log type="nmea" data="track_%Y%m%d%i.nmea" flush_size="1048576" flush_time="900" />

This will give a log file named YearMonthDaySequencenumber.nmea which will be kept in memory and flushed to disk when it is 1048576 bytes large or the oldest data is older than 900 seconds

<log type="gpx" data="track_%Y%m%d%i.gpx" flush_size="1048576" flush_time="900" />

Similar to above, but will produce a gpx log which is suitable for using it in josm instead of a nmea log,

<log type="textfile" data="track.txt" flush_size="0" overwrite="1" />

Will give you a tracklog usable as navit map, which is immediately written to disk and overwritten on navit restart

The mapset

Navit can read various map formats, and can even show multiple maps at a time. This is done by defining a mapset. The following example is for the Reiseplaner maps :

<mapset>
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map" />
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp2.smp" />
</mapset>

Using the GTK gui, you can enable or disable a specific map of the mapset at runtime.

Here's some more informations about the maps of Reiseplaner :

  • DE.map is mandatory. This contains the towns and major roads of Europe
  • DE.map/smp2.smp contains the smaller roads for France
  • DE.map/smp3.smp contains the smaller roads for Germany

< (to be filled) >

Valid map types:

  • binfile
  • garmin
  • mg
  • poi_geodownload
  • textfile

The layout

The layout define a specific scheme of colored items, for example "Day" or "Night".

Notice : the items will be drawn on the map in the order they are defined in the layout. So the "Wood" layout will be drawn first, then the towns, then the street, and finally your track. You can change this order if you like, but remember that an item drawn on top of another may hide it.

Defining an item. An item is defined this way :

<item type="water_poly" zoom="0-">
<polygon color="#82c8ea" />
<polyline color="#5096b8" />
</item>

The zoom option tells navit from which scale the item should be drawn. It can be a single value, or a range. 0- will always draw the item (because the zoom can't be < 1 ) 0-5 will draw the item when the zoom value is < 6. Order goes from 0 (globally visible) to 18 (visible only on very close zoom)

The polygon color defines the color with which the polygon will be filled. Of course, it applies only to polygons, such as water, towns, wood, etc.

The polyline color define the color with which the lines will be drawn. If the item is a line, such as a street, it's its color. If the item is a polygon, then it is it's border color.

You can define an item multiple times. Example :

<item type="street_route" zoom="17">
<polyline color="#0000a0" width="268" />
</item>
<item type="street_route" zoom="18">
<polyline color="#0000a0" width="530" />
</item>

Here we define two different widths for the same item, depending on the scale. We could even have changed its color depending on the scale.