From Navit's Wiki
Revision as of 21:42, 22 January 2011 by Korrosa (talk | contribs) (Create page on csv maps)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Navit includes a map driver which supports csv files. Note that this feature is only available in the latest versions of Navit (i.e. those built from daily updates).

Including in Navit

In order for the points in the csv file to show up in Navit, the map must be added to navit.xml. This can be accomplished by adding the following line into the active mapset.

<map type="csv" enabled="yes" data="poi.csv" item_type="poi_hotel" attr_types="id,position_longitude,position_latitude,label" />

Features to note from the previous example:

  • item_type
    • The type of item in each csv file is defined in the item_type attribute of the above line, and can be anything from item_def.h
    • This of course means that each csv file (or map) can hold only one type of item. For example, a list of hotels (item_type="poi_hotel") or fuel stations (item_type="poi_fuel"). You cannot mix different items within the same csv file.
  • attr_types
    • The corresponding attribute types for the columns of the csv file should be specified by the attr_types attribute inside the map tag. The value of that attribute should be a comma separated list of navit attributes in the order they appear in the csv file.
    • You can define any attribute from attr_def.h
    • The csv map definition should have position_longitude and position_latitude attributes in the attr_types list definition otherwise the csv file will not be loaded.

The csv File

Contents of an example csv file is shown below, and corresponds to the example line for navit.xml shown above.

01,23.657,-46.7678,The Sunny Hotel
02,23.457,-46.7878,Spa Hotel
03,23.437,-46.2378,The Railway Hotel


  • No trailing comma
  • Each item is defined on a new line
  • Each column corresponds to the attr_types attribute in the <map ...> line in the example above.