From Navit's Wiki
Revision as of 13:31, 2 February 2011 by Korrosa (talk | contribs) (set_attr)
Jump to: navigation, search

OSM Layout

Mapnik-style rendering

OSD: Speed Camera

Currently a patch at #702.

  • Provides visual and audible warnings of approaching speed cameras.
  • Uses speed camera data from an external file in IGO8 format: files available from Example IGO8 format shown below:
  • Plans to also use speed camera data in OSM


To use the speed_cam OSD type, the following OSD item must be added to navit.xml. This of course assumes that you have patched navit with the patch at #702:

    <osd enabled="yes" type="speed_cam" w="500" h="40"  x="30" y="350" font_size="450" text_color="#FF0000" announce_on="0" label=" ${distance} | ${camera_type} | ${camera_dir} | ${direction} | ${speed_limit}" path="speed_cam_data.txt" />


Most parts are self explanatory:

  • announce_on is set by default to 1 (i.e. this osd item will announce upcoming cameras with a "Look out! Camera!" warning) if this attribute is not set.
  • label can display the following variables. The values in ${STRING} are replaced with the appropriate number or word when running Navit:
    • distance to the camera - ${distance}
    • type of camera - ${camera_type}. See User:Korrosa#Camera Types for possible types:
    • direction in which the camera operates - ${camera_dir}
      • all
      • single direction
      • both directions
    • direction which the camera is facing, in degrees (0-360, i.e. north, east, south, west etc) - ${direction}
    • the active speed limit which the camera may be enforcing - ${speed_limit}

Data Sources

Currently, the speed_cam OSD looks in the following locations for speed camera data, in the following order. Note that the speed_cam OSD will only use the first data source:

  • IGO8 file defined by the path= attribute in the <osd /> tag
  • speedcam.txt IGO8 file in your default navit directory (usually ~/.navit)
  • Speed camera bin mapfile (see User:Korrosa#Creating camera bin mapfiles) defined in the currently active mapset.

Note that if you use one of the first two options, the cameras will not actually appear on the map, but will still be announced. Only by using a binfile will the cameras appear on the map.

Creating camera bin mapfiles

The following steps will enable you to convert an IGO8 speed camera textfile into a Navit bin mapfile. The advantage is reduced resource usage when using a binfile, and that the cameras will appear on the map.

  • Using, convert the IGO8 file into a standard navit textfile. The script reads its input on standard input and outputs navit textfile on stdout. Use in the following manner:
    perl  < speedcam.txt  > speedcam_navit.txt
  • Copy the resulting speedcam_navit.txt to the /navit/maps folder in the source tree.
  • Issue the following command in the maps folder:
    make speedcam_navit.bin
  • Add the just-created speedcam_navit.bin to your active mapset in navit.xml. For example, having moved the binfile to ~/navit/maps:
    <map type="binfile" enabled="yes" data="~/.navit/maps/speedcam_navit.bin"/>

Next time you start Navit the cameras should appear on the map. If they don't try changing the zoom settings of the tec_common item type in your map layout in navit.xml.

Camera Types

  • None
  • Fix
    • Type: Fixed speed enforcement camera
    • Enforces: Speed
    • Description: Probably the most common type of traffic enforcement camera. Usually located on the side of the road, and uses radar to detect vehicle speed. Can take photos from either the front or the rear. Front facing cameras tend to use IR flash guns, instead of traditional bulb flashes, to ensure that the driver does not get blinded.
    • Suggested English name: Fixed.
  • Traffic lamp
    • Type: Traffic light enforcement camera
    • Enforces: Speed and/or red light (unsure)
    • Description: These cameras seem to be located inside (?) traffic lights. It is unknown whether these are for speed, red light or both.
    • Suggested English name: Traffic light.
  • Red detect
    • Type: Red light enforcement camera
    • Enforces: Red light
    • Description: Located close to traffic light controlled junctions, these cameras will detect if a car has run a red light. Usually, these cameras will face down the flow of traffic, thus take a picture from the rear.
    • Suggested English name: Red light.
  • Section
    • Type: Average speed check camera
    • Enforces: Speed
    • Description: In the UK at least, these cameras are used a lot on motorway roadwork sections. CCTV ANPR cameras are located at strategic locations along the works, and take average speed readings of vehicles by reading their number plates. Nightime use is facilitated through the use of IR lamps.
    • Suggested English name: Avg speed
  • Mobile
    • Type: Mobile speed enforcement camera
    • Enforces: Speed
    • Description: There are many types of mobile cameras: common ones are hand-held cameras, either held by an officer from the police car window, or mounted on a tripod. Other types include those mounted on the police car dashboard or rear parcel shelf, or those which point through windows of special speed camera vans (common in the UK)
    • Suggested English name: Mobile
  • Rail
    • Type: Railway level crossing enforcement camera
    • Enforces: barriers/access
    • Description: Used at railway level crossings, to enforce any barriers or warning lights. It's usually an offence to enter the level crossing once you've been warned not to (however far away the train is), hence the cameras.
    • Suggested English name: Level crossing
  • Traffipax(non persistent)
    • Type: Mobile speed enforcement camera
    • Enforces: Speed (?)
    • Description: Note: this is conjecture at the moment. This seems to be a specific type of mobile speed camera.
    • Suggested English name: Mobile


  • Tags shown in order of appearance in the navit.xml shipped with Navit.
  • Bold values denote default values if attributes are not explicitly specified.
  • Value types:
    • int = integer
    • bool = boolean 1 or 0
    • dbl = double


Drafting complete re-write of the OpenStreetMap page


Wiki Index

Attempting to create a sorted/obvious wiki index, or wiki map



The dbus wiki page is crap. First, a crappy table of available commands... Examples are shown for each command, and when using on the command line must be prefixed by:

dbus-send  --print-reply --session --dest=org.navit_project.navit /org/navit_project/default_navit


Path: .navit
Arguments: none
Return: none
Description: Forces a redraw of the current view of the map


Path: .navit
Arguments: string: "message"
Return: none
Description: FIXME Adds a message to the messages label
org.navit_project.navit.navit.add_message string:"My Message"


Path: .navit
Arguments: string: coordinates
Return: none
Description: Centres the map over the specified position.
org.navit_project.navit.navit.set_center_by_string string:"geo: 24.0 65.0"


Path: .navit
Arguments: integer: projection string: coordinates

integer: projection integer: longitude integer: latitude

Return: none
Description: Centres the map over the specified position.
org.navit_project.navit.navit.set_center int32:1 string:"geo: 24.0 65.0"
org.navit_project.navit.navit.set_center int32:1 int32:0x138a4a int32:0x5d773f


Path: .navit
Arguments: integer: pixel_x integer: pixel_y
Return: none
Description: Centers the map to a specific position on the screen.
org.navit_project.navit.navit.set_center_screen int32:200 int32:400


Path: .navit
Arguments: integer: factor (integer: pixel_x integer: pixel_y)
Return: none
Description: Zooms into the map (positive factor) or out of the map (negative factor) by the factor specified. The factor must be between 1 and -1. Optionally, a screen position can be specified in pixel_x and pixel_y and the function will zoom into that particular position.
org.navit_project.navit.navit.zoom int32:6 int32:200 int32:400


Path: .navit
Arguments: integer: mode
Return: none
Description: FIXME
org.navit_project.navit.navit.block int32:1


Path: .navit
Arguments: string: coordinates
integer: projection string: coordinates

integer: projection integer: longitude integer: latitude

Return: none
Description: Sets the current position (useful if no gps position is available).
org.navit_project.navit.navit.set_position string:"geo: 24.0 65.0"
org.navit_project.navit.navit.set_position int32:1 string:"geo: 24.0 65.0"
org.navit_project.navit.navit.set_position int32:1 int32:0x138a4a int32:0x5d773f


Path: .navit
Arguments: string: coordinates string:"comment"
integer: projection string: coordinates string:"comment"
integer: projection integer: longitude integer: latitude string:"comment"
Return: none
Description: Sets the destination for routing.
org.navit_project.navit.navit.set_destination string:"geo: 24.0 65.0"
org.navit_project.navit.navit.set_destination int32:1 string:"geo: 24.0 65.0"
org.navit_project.navit.navit.set_destination int32:1 int32:0x138a4a int32:0x5d773f


Path: .navit
Arguments: none
Return: none
Description: Removes the destination and stops routing.


Path: .navit
Arguments: string:attribute
Return: string:attribute variant:value
Description: Gets the specified attribute value. The attribute can be anything from attr_def.h.
org.navit_project.navit.navit.get_attr string:"zoom"


   string "zoom"
   variant       int32 10

org.navit_project.navit.navit.get_attr string:"orientation"


   string "orientation"
   variant       int32 1


Path: .navit
Arguments: string:attribute variant:value
Return: none
Description: Sets the specified attribute value. The attribute can be anything from attr_def.h. As shown in the example below, this can be useful to zoom to a specific zoom level, insted of just zooming by a factor as with the zoom method.
org.navit_project.navit.navit.set_attr string:"zoom" variant:int32:500
	{".navit",  "resize",              "ii",      "upperleft,lowerright",                    "",   "",      request_navit_resize},
	{".navit",  "attr_iter",           "",        "",                                        "o",  "attr_iter",  request_navit_attr_iter},
	{".navit",  "attr_iter_destroy",   "o",       "attr_iter",                               "",   "",      request_navit_attr_iter_destroy},
	{".navit",  "get_attr_wi",         "so",      "attribute,attr_iter",                     "sv",  "attrname,value", request_navit_get_attr},
	{".navit",  "add_attr",            "sv",      "attribute,value",                         "",   "",      request_navit_add_attr},
	{".navit",  "remove_attr",         "sv",      "attribute,value",                         "",   "",      request_navit_remove_attr},
	{".navit",  "evaluate", 	   "s",	      "command",				 "s",  "",      request_navit_evaluate},