logo separator

[mkgmap-dev] bug or feature?

From Steve Ratcliffe steve at parabola.me.uk on Fri Aug 21 16:38:34 BST 2009

Hi

> I guess I found out that
> --description
> does not work when using a "-c template-file". Is this a bug or a
> feature, i.e. does the source need to be patched or should I patch the
> documentation? (I'm willing to do the latter, but not if a fix in the
> source is really easy).

It works as intended, so I guess it must be a documentation bug ;)

What I expected to happen is that people would copy the template-file 
and edit it to include all the options, set the descriptions, mapname 
etc. as desired and then use that file with -c, rather than putting all 
the options on the command line.

The best way to think about the template-file is that is just another 
way of specifying a lot of options in a more convenient way. For example 
if you have a file with the following contents:

-=-
mapname: 63240001
description: OSM Map 1
input-file: 63240001.osm.gz

mapname: 63240002
description: OSM Map 2
input-file: 63240002.osm.gz
-=-

Then the command: java -jar mkgmap.jar -c file

is *exactly* the same as saying:

   java -jar mkgmap.jar --mapname=63240001 --description="OSM Map 1" 
63240001.osm.gz --mapname=63240002 --description="OSM Map 2" 63240002.osm.gz

Options are read from left to right, and the options in force when
a file is read are the ones that apply. So in this case
63240001.osm.gz will be compiled with a mapname of 63240001 and a
description of "OSM Map 1", and 63240002.osm.gz will have the
mapname of 63240002 and a description of 'OSM Map 2'.

You can mix command line options and options in a file, there is
nothing wrong with that.  If you do so then still work as though you
were reading from left to right and inserting the content of the file
at the point it is read.

So the command: java -jar mkgmap.jar --description="My Map" -c file 
--description="Third map" 63240003.osm.gz

is exactly the same as:
   java -jar mkgmap.jar --description="My Map" --mapname=63240001 
--description="OSM Map 1" 63240001.osm.gz --mapname=63240002 
--description="OSM Map 2" 63240002.osm.gz --description="Third map" 
63240003.osm.gz

Now you can see that the first --description (My Map) is not used 
because it is the second one (which has the value 'OSM Map 1') that is 
the one that gets used to build the first map.

If the file did not contain either of the 'description' lines, then
the first and second maps would have the name 'My Map' and the third
one would still have the description of 'Third map'

Hope that makes it all clear.

..Steve



More information about the mkgmap-dev mailing list