From Navit's Wiki
Revision as of 15:47, 7 February 2009 by Carcinoma (talk | contribs) (only gui.menu with "()" is a function)
Jump to: navigation, search

The On Screen Display (OSD) provides status information and controls blended directly onto the map.

Current OSD types:

  • "compass"
  • "navigation_next_turn"
  • "text"
  • "speed_warner"
  • "toogle_announcer"
  • "gps_status"
  • "volume"
  • "button" - with possible commands to use:
    • gui.fullscreen()
    • gui.menu()
    • gui.get_data()
    • zoom_in()
    • zoom_out()
    • speech.active

The button type can be used to provide zoom in/zoom out functionality with gui_internal (which does not itself draw any controls onto the map view). Example navit.xml contents:

   <osd type="button" x="48"  y="48"  command="gui.fullscreen()" src="toggle_fullscreen.xpm" />
   <osd type="button" x="-96" y="48"  command="gui.menu()"       src="menu.xpm" />
   <osd type="button" x="-96" y="-96" command="zoom_in()"        src="zoom_in.xpm" />
   <osd type="button" x="48"  y="-96" command="zoom_out()"       src="zoom_out.xpm" />

The x and y coordinates depend on your screen resolution and the size of your bitmaps. The origin is at the upper lefthand corner of the screen. Use negative values to position the buttons relative to the right resp. bottom edge of the screen. Besides zoom, the commands include gui_internal_menu and gui_internal_fullscreen.

You can determine the supported xml options for each OSD type by reading navit/osd/core/osd_core.c, searching for "attr_xxx" inside the osd_xxx_new() functions. Most types have at least an "x" and "y" option that determine the location of their OSD.


It is possible to set item alignment. Align attribute accept several values:

  • "1": Align to the top
  • "2": Align to the bottom
  • "0" or "3": Align to the center (vertical)
  • "4": Align to the left
  • "8": Align to the right
  • "0" or "12": Align to the center (horizontal)

To get combination of alignment you have to sum vertical and horizontal alignment, so align="5" would give top left alignment

The OSD layer is still under development.


  1. Simple
  2. Not finished yet but quite clean
    Mineque OSD Layout wip.jpg Mineque OSD Layout 01.jpg
      <osd enabled="yes" type="text" label="Currently On ${navigation.item.street_name} ${navigation.item[1].street_name_systematic}" x="0" y="0" w="735" h="30" align="0" background_color="#a60c0fee" font_size="300" />
      <osd enabled="yes" type="gps_status" x="735" y="0" w="65" h="30" align="0" background_color="#a60c0fee" font_size="300" />
      <osd enabled="yes" type="text" label="ETA:${navigation.item.destination_time[arrival]}" x="0" y="-25" w="160" h="25" align="4" background_color="#a60c0fee" font_size="350" />
      <osd enabled="yes" type="text" label="TL:${navigation.item.destination_time[remaining]}" x="160" y="-25" w="160" h="25"align="4" background_color="#a60c0fee" font_size="350" />
      <osd enabled="yes" type="text" label="Dist:${navigation.item.destination_length[named]}" x="320" y="-25" w="170" h="25" align="4" background_color="#a60c0fee" font_size="350" />
      <osd enabled="yes" type="text" label="${vehicle.position_speed} / ${tracking.item.route_speed}" x="490" y="-25" w="150" h="25" align="4" background_color="#a60c0fee" font_size="280"/>
      <osd enabled="yes" type="text" label="${navigation.item[1].length[named]}" x="640" y="-30" w="160" h="30" background_color="#a60c0fee" font_size="500"/>
      <osd enabled="yes" type="navigation_next_turn" x="640" y="-80"  w="160" h="50" background_color="#a60c0fee" /> 
      <osd enabled="yes"  type="button" x="5" y="30" command="gui.fullscreen()" src="gui_fullscreen.svg"/> 
      <osd enabled="no"  type="button" x="300" y="100" command="gui.menu()" src="menu.xpm"/>
      <osd enabled="yes"  type="button" x="5" y="475" command="zoom_in()" src="gui_zoom_in.svg"/>
      <osd enabled="yes"  type="button" x="590" y="475" command="zoom_out()" src="gui_zoom_out.svg"/>