Difference between revisions of "Textfile"

From Navit's Wiki
Jump to: navigation, search
(Creating it out of an osm map: osm2navit -> maptool)
(Overview: link to "Coordinate format")
 
(13 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Apart from the various maps format it can read, NavIt also supports its own map format.
+
Apart from the various map formats it can read, Navit also supports its own textual map format.
This is useful for converting some datas sources (gpx, OSM) into something NavIt can read without too much work.
+
This is useful for converting some datas sources (gpx, OSM) into something Navit can read without too much work.
A Example is given there [[Other maps]]
+
An example is given in [[Other maps]]
  
 
=Overview=
 
=Overview=
Line 13: Line 13:
 
  coordinate3
 
  coordinate3
  
coordinate might be in the following formats:
+
"coordinate" can use various formats. The simplest is longitude / latitude (note order) as decimal fractions, for example:
DDMM.MMMM N/S DDMM.MMMM E/W
+
  -33.3553 6.334
0xXXX 0xXXX (for M&G mercator projection)
+
For the full list of formats see [[Coordinate format]].
  [-]dd.dddd [-]dd.dddd
 
  
Others may be implemented by expanding coord_parse in coord.c
 
 
If you want to have points after polylines/polygons, you have to add an empty line after the polys
 
If you want to have points after polylines/polygons, you have to add an empty line after the polys
 
Then:
 
Then:
Line 40: Line 38:
 
  4821.194591 N 1056.596736 E
 
  4821.194591 N 1056.596736 E
 
  4821.173691 N 1056.880243 E
 
  4821.173691 N 1056.880243 E
 +
 +
The above sample defines two segments used for a railway. You will notice that the second coordinates of the first item and the first coordinate of the second items are the same, to ensure a good overlapping. This is not necessary, but ensures a consistent drawing.
  
 
Or here an example with decimal coordinates :
 
Or here an example with decimal coordinates :
 +
 
  type=image label=/image/raster001.jpg debug="raster001"
 
  type=image label=/image/raster001.jpg debug="raster001"
 
  0.02527076695 47.22659264
 
  0.02527076695 47.22659264
Line 47: Line 48:
 
  0.02527076695 47.27285604   
 
  0.02527076695 47.27285604   
  
The following sample define two segments used for a railway. You will notice that the second coordinates of the first item and the first coordinate of the second items are the same, to ensure a good overlapping. This is not necessary, but that way it ensures a consistent drawing.
+
And here is one to display a point of interest:
 +
 
 +
type=poi_custom1 icon_src=car_sharing label="Some car sharing place"
 +
0.02527076695 47.22659264
 +
 
 +
For a list of usable types see [[Item_def.h]].
  
For a list of usable types see [[Item_def.h]]
+
=Creating it out of an OSM map=
 +
You can convert OSM xml files to Navit textfiles using maptool. This is only recommended for small OSM areas, as rendering a large textfile will slow Navit down. To convert, execute something similar to the following:
  
=Creating it out of an osm map=
+
  bzcat my_downloaded_map.osm.bz2 | maptool -D > navit_textfile_map.txt
You can create a textfile map from the sample map with the following command:
 
  bzcat maps/osm_bbox_11.3,47.9,11.7,48.2.osm.bz2 | maptool -D >maps/munich.txt
 
Be warned that it will be quite slow.
 
  
 
=Creating a binfile Map out of it=
 
=Creating a binfile Map out of it=
  
A textfile will get slow soon, because of the unstructured data and the big parsing overhead.
+
'''TODO:''' ''osm2navit'' could do this (using -p /path/to/libmap_textfile.so); find out if there's a way using ''maptool'' as well.
But one could create a binfile map out of it:
+
 
osm2navit -p /path/to/libmap_textfile.so -m textfile.txt binfile.bin
+
[[Category:Maps]]
Creates a binfile map (binfile.bin) out of a textfile map (textfile.txt). You have to specify the correct path to libmap_textfile.so with -p of course.
 

Latest revision as of 22:50, 11 October 2014

Apart from the various map formats it can read, Navit also supports its own textual map format. This is useful for converting some datas sources (gpx, OSM) into something Navit can read without too much work. An example is given in Other maps

Overview[edit]

You can define polygons/polylines and points.

Polygons/Polylines are specified as follows:

type=<any type from item_def.h> attr1=xxx attr2="ab cd"
coordinate1
coordinate2
coordinate3

"coordinate" can use various formats. The simplest is longitude / latitude (note order) as decimal fractions, for example:

-33.3553 6.334

For the full list of formats see Coordinate format.

If you want to have points after polylines/polygons, you have to add an empty line after the polys Then:

coordinate type=<any type from item_def.h> attr1=xxx attr2="ab cd"

and so on, every line a point

You can also mix polys and points:

type=<any type from item_def.h> attr1=xxx attr2="ab cd"
coordinate1 type=<any type from item_def.h> attr1=xxx attr2="ab cd"
coordinate2 type=<any type from item_def.h> attr1=xxx attr2="ab cd"
coordinate3 type=<any type from item_def.h> attr1=xxx attr2="ab cd"


Confusing? Here's a sample :)

type=rail debug="way_id=2953991 railway='rail' "
4821.199248 N 1056.437366 E
4821.194591 N 1056.596736 E
type=rail debug="way_id=2953991 railway='rail' "
4821.194591 N 1056.596736 E
4821.173691 N 1056.880243 E

The above sample defines two segments used for a railway. You will notice that the second coordinates of the first item and the first coordinate of the second items are the same, to ensure a good overlapping. This is not necessary, but ensures a consistent drawing.

Or here an example with decimal coordinates :

type=image label=/image/raster001.jpg debug="raster001"
0.02527076695 47.22659264
0.09127025553 47.22659264 
0.02527076695 47.27285604  

And here is one to display a point of interest:

type=poi_custom1 icon_src=car_sharing label="Some car sharing place"
0.02527076695 47.22659264

For a list of usable types see Item_def.h.

Creating it out of an OSM map[edit]

You can convert OSM xml files to Navit textfiles using maptool. This is only recommended for small OSM areas, as rendering a large textfile will slow Navit down. To convert, execute something similar to the following:

bzcat my_downloaded_map.osm.bz2 | maptool -D > navit_textfile_map.txt

Creating a binfile Map out of it[edit]

TODO: osm2navit could do this (using -p /path/to/libmap_textfile.so); find out if there's a way using maptool as well.