Configuration (old)

From Navit's Wiki
Revision as of 08:47, 21 October 2007 by KaZeR (talk | contribs)
Jump to: navigation, search

This should be pretty easy :)

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.

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

Quick overview

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 :
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/" />
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/" />
  • And finally, one or more layouts.

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

Let's get into the details :)

The navit instance

The default navit instance looks like this :

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

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

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)

See below for more explanations.

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 y the sdl gui. This may change later, for example a GTK gui could use opengl to render its graphics.

The default map view center (center)

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

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 gui="sdl" graphics="opengl" center="5031.51 N 735.83 E" zoom="128" >

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.

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 move onto the map until it reachs a border, then the map will be recentered. This saves a lot of cpu time, by avoiding to always redraw the map (very usefull for small devices like smartphones).

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"/>

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 :

<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/" />
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/" />

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 :

  • is mandatory. This contains the towns and major roads of Europe
  • contains the smaller roads for France
  • contains the smaller roads for Germany

< (to be filled) >

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" />

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 type="street_route" zoom="18">
<polyline color="#0000a0" width="530" />

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