From Navit's Wiki
Revision as of 10:22, 11 October 2009 by SlowRider (talk | contribs) (Processing yourself a small area)
Jump to: navigation, search

OpenStreetMap is a free editable map of the whole world. It is made by people like you. OpenStreetMap allows you to view, edit and use geographical data in a collaborative way from anywhere on Earth. And you can use their maps in Navit!


  • To enable a map you have downloaded refer adding OSM map to navit.xml
  • If you don't see any map data in Navit (assuming your map is properly specified in navit.xml) using the Internal GUI click anywhere on the screen to bring up the menu. Click on "Actions" and then "Town". Type in the name of a town that should be within your map data. Select your town from the list that appears. This will bring up a sub-menu where you can click "View On Map". Note that if you have a GPS receiver you can also just wait till you get a satellite lock.
  • To increase performance of Navit use maps for only the country or state you are interested in.
  • To avoid changing navit.xml if you update your maps and the maps have different file names use the wildcard (*.bin) in your navit.xml file. For example:
<map type="binfile" enabled="yes" data="/media/mmc2/maps/*.bin"/>
  • If you want to learn more about the format used in conversion, for example to write a tool to extract a specific area, please have a look at Navit's binary map driver.

Pre-processed OSM Navit Maps

There are many ways and locations to obtain OSM maps. Below are some useful links to help you obtain the map data important to you.

  • Navit Planet Extractor: Use this tool to download just sections of the planet you are interested in. This is the simplest method to get started with.
  • Entire Planet (~2.2GiB): A complete world map. This map should be updated every Saturday. Size is currently around 1.8GB
  • Cloudmade Pre-processed OSM maps in Navit's binary format. Updated once a week and are available for all countries of the world.

Processing yourself a small area

First you need to get some OSM data. There are several possibilities:

  • hosts the complete data set (the whole world). You can use Osmosis to cut it into smaller chunks.
  • Geofabrik provides preprocessed files for various regions.
  • OpenStreetMap allows to export a bouding box via its web interface.
  • The API allows to get the data of a specific bounding box, so download managers can be used:
wget -O map.osm,48.7,11.6,48.9

In the abovementioned examples, adjust the bounding box parameters to your likings. However, to reduce server load, the size of the area is limited, so use a small area only. To determine coordinates you can use The Information Freeway. After you get the coordinates of the area you want to download, put them in the wget command line. The syntax is: ?bbox=<bllon,bllat,trlon,trlat>, that is lon,lat order which is the inverse of what shown by Information Freeway (lat,lon).

Once you have some OSM file, parse it. There is a command for that in the navit/ folder after you have built the svn version.

cat map.osm | ./osm2navit mymap.bin

You can also process more than one map at once, but then you need the option --dedupe-ways for osm2navit to avoid duplication of way data if a way occurs multiple times.

cat map1.osm map2.osm map3.osm | navit/src/osm2navit --dedupe-ways mymap.bin

Processing yourself the whole world, planet.osm

In case you want the whole planet.osm, and you can't or don't want to fetch it from the previous link, it is even possible to process planet.osm. It will take about 30 minutes, requires > 1GB of main memory and about 3 GB disk space for result and temp files:

bzcat planet.osm.bz2 | navit/src/osm2navit mymap.bin

The OpenStreetMap wiki Planet.osm page lists mirrors where Planet.osm can be downloaded. There are also downloads of smaller areas such as the UK and parts of Europe. These smaller excepts are a lot quicker to download and process.

Adding an OSM map to your mapset

Once you have your map from one of the 3 methods;

Now add a map source to your navit.xml:

<map type="binfile" enabled="yes" data="/path/to/mymap.bin" />

And navit will now be able to read your OSM maps.

(Note that since September 2007, NavIt is provided with a demo map of Munich.)

See also

Problems with OSM and navit or navigation in general

Search doesn't work in most countries

This is because osm2navit only knows about a few is_in tags. To fix this, look for a reliable is_in tag in the towns in your country. If there is none, contact us, we have some scripts which can help adding one in this case. Then add the tag (at most 3 per country) to this page. Unfortunately using the country border for detecting the membership of a town also isn't an option, because the boundaries are usually not closed or wrong.

Search is totally b0rkz0r3d! Or, behaves very strangely vs other navigation software.

OK, so the country you're searching is listed in the table below. Search probably will work. But be aware there are some quirks.

First, there is no "Search" button--searches will begin automatically as you fill in the gtk dialogue. Note there are minimum string length requirements. For instance the Town search only "activates" after 3 characters are typed, to prevent a huge number of results (which would take a lot of CPU time to find and display). If you really need to search for two character towns, you'll have to modify the navit source code.

Also, Navit's search process is hierarchical. Meaning you must search for and select a valid Country, then select a Town, then select a Street. Right now, zipcode, district, and street number (?) searches are unimplemented; only Country, Town, and Street actually work (as of svn r1175). Furthermore, there is no US State or County information; when searching for a US town, you may get hits from all over the US with planet.bin, and unfortunately, the states that each hit is in are not displayed. You basically have to use the Map button to examine them one-by-one, until you find the one you want (or, only travel to towns with unique names).

The dialogue sometimes moves the cursor between text boxes automatically. This can be pretty annoying.

Finally, there are a couple ways to crash (segfault) navit inside the search dialogue.

The developers are aware of these issues and plan to improve behaviour (this will happen faster if you send a patch!)

Routes go through a city instead around of it

This is because OSM doesn't provide any information whether a street is rural (can be driven with higher speeds) or not. Currently all roads are considered as in a city, which leads to using shorter routes through a city.

Search for my town works, but I can't find my street

This is because OSM doesn't provide reliable information which town a street belongs to. We are currently estimating the area of a town (depending on the town type) and are using all streets which fall in this area. This works well most of the time, but of course is no 100% match. But the official OSM approach "A street belongs to its nearest town/village etc." doesn't provide always correct results also and is harder to code.

There are strange purple objects on the navit map

These are objects in OSM which have no representation in navit. This includes ways which have no tag and therefore are not visible in osmarender/mapnik maps. If you want to have tagged objects included in navit add an entry to the discussion what tags are used for this object and what item from Item_def.h should be used (suggest a new one together with how it should be rendered if no appropriate one exists).

Known countries by osm2navit

Preferred is_in is the official english ISO 3166-1 country name. Local country name is also an option if it is unambiugous. Avoid abbreviations like ISO 3166-1 Alpha-2/-3 or the car country code, because they might be a ambiguous (for example FL might mean florida as well as Liechtenstein)

ISO 3166-1 numeric country id is_in matches
40 Austria,Österreich,AT
124 Canada
152 Chile
203 Czech Republic,Česká Republika,CZ
208 Denmark,Danmark,DK
246 Finland,Suomi
250 France,République française
276 Germany,Deutschland,Bundesrepublik Deutschland
380 Italy,Italia
528 Nederland,The Netherlands,Niederlande,NL
578 Norway,Norge,Noreg,NO
724 Spain,Espana,Espana,Reino de Espana
752 Sweden,Sverige,Konungariket Sverige,SE
756 Schweiz,Suisse,Svizzera,CH
807 Macedonia
826 United Kingdom,UK
840 USA