Difference between revisions of "Textfile"

From Navit's Wiki
Jump to: navigation, search
(TODOs added for converting to/from textfile using maptool)
(Overview: link to "Coordinate format")
 
(11 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=
+
=Creating it out of an OSM map=
The ''osm2navit'' program could create a textfile map from the sample map with the option "-D". This feature was apparently dropped during the transition from ''osm2navit'' to ''maptool''.
+
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:
  
'''TODO:''' Find out if there is still a way to convert from OpenStreetMap XML to navit textfile, and document it.
+
bzcat my_downloaded_map.osm.bz2 | maptool -D > navit_textfile_map.txt
  
 
=Creating a binfile Map out of it=
 
=Creating a binfile Map out of it=
  
 
'''TODO:''' ''osm2navit'' could do this (using -p /path/to/libmap_textfile.so); find out if there's a way using ''maptool'' as well.
 
'''TODO:''' ''osm2navit'' could do this (using -p /path/to/libmap_textfile.so); find out if there's a way using ''maptool'' as well.
 +
 +
[[Category:Maps]]

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.