mkgmap -c problem (relative paths)

Hello, I use config files with mkgmap and define input-files using relative paths. Example from my config file "osm-options": mapname: 80100003 input-file: data/80100003.osm.pbf This works well when the config file is in the same directory where mkgmap is started. When invoked with "-c osm-options" mkgmap finds my input file just fine. To tidy up my environment I moved all my config files into a config subdirectory. Now when I invoke mkgmap with "-c config/osm-options" I get the following error: SEVERE (Main): .\config\data\80100003.osm.pbf: file .\config\data\80100003.osm.pbf doesn't exist It appears that mkgmap interprets my relative paths relative to the config file location, and not (as I expected) the mkgmap cwd! This seems to be a bug since the description for -c states: "The options are included as arguments of the executed command as if they had been specified on the command line." I tested using the latest r4282 on Windows. Regards, Ranko

Hi Ranko, yes, this behavious is a bit confusing, but I think we cannot change it without breaking compability. A typical scenario is this: splitter is executed and creates a template.args file contining something like mapname: 63240001 input-file: 63240001.o5m mapname: 63240002 input-file: 63240002.o5m ... When mkgmap processes the file it also presumes that file 63240001.o5m is in the same directory as template.args. So, I'll change documentation but not the code. OK? Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ranko Jaksic <ranko.jaksic@zgi.hr> Gesendet: Mittwoch, 6. März 2019 22:22 An: mkgmap-dev Betreff: [mkgmap-dev] mkgmap -c problem (relative paths) Hello, I use config files with mkgmap and define input-files using relative paths. Example from my config file "osm-options": mapname: 80100003 input-file: data/80100003.osm.pbf This works well when the config file is in the same directory where mkgmap is started. When invoked with "-c osm-options" mkgmap finds my input file just fine. To tidy up my environment I moved all my config files into a config subdirectory. Now when I invoke mkgmap with "-c config/osm-options" I get the following error: SEVERE (Main): .\config\data\80100003.osm.pbf: file .\config\data\80100003.osm.pbf doesn't exist It appears that mkgmap interprets my relative paths relative to the config file location, and not (as I expected) the mkgmap cwd! This seems to be a bug since the description for -c states: "The options are included as arguments of the executed command as if they had been specified on the command line." I tested using the latest r4282 on Windows. Regards, Ranko _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi all, attached is a patch for the documentation. It adds the text Note that relative paths given in the file are assumed to be relative to the location of the file. here: -c filename --read-config=filename Each line of the named file contains a command option in the form option=value or option:value. The options are included as arguments of the executed command as if they had been specified on the command line. Note that relative paths given in the file are assumed to be relative to the location of the file. Lines beginning with a # character are ignored and can be used as comments. Any command line option can be specified, however the leading '--' must be omitted. The short option names with a single '-' cannot be used, simply use the long name instead. I hope this is not too confusing? I nobody suggest an inprovement I'll commit it on sunday. Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ranko Jaksic <ranko.jaksic@zgi.hr> Gesendet: Mittwoch, 6. März 2019 22:22 An: mkgmap-dev Betreff: [mkgmap-dev] mkgmap -c problem (relative paths) Hello, I use config files with mkgmap and define input-files using relative paths. Example from my config file "osm-options": mapname: 80100003 input-file: data/80100003.osm.pbf This works well when the config file is in the same directory where mkgmap is started. When invoked with "-c osm-options" mkgmap finds my input file just fine. To tidy up my environment I moved all my config files into a config subdirectory. Now when I invoke mkgmap with "-c config/osm-options" I get the following error: SEVERE (Main): .\config\data\80100003.osm.pbf: file .\config\data\80100003.osm.pbf doesn't exist It appears that mkgmap interprets my relative paths relative to the config file location, and not (as I expected) the mkgmap cwd! This seems to be a bug since the description for -c states: "The options are included as arguments of the executed command as if they had been specified on the command line." I tested using the latest r4282 on Windows. Regards, Ranko _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Are you sure? I think this disagrees with my set-up, which works. In a subdirectory for a particular country, I have script with like: java -jar ../splitter/splitter.jar --geonames-file=../cities15000.zip - -mapid=74320001 netherlands-latest.osm.pbf java -jar ../mkgmap/mkgmap.jar -c ../mkgmap.opts --country -name=Netherlands --country-abbr=NLD --family-id=7432 -c template.args ../mytyp.txt In the parent directory, my mkgmap.opts file has likes: bounds=../bounds.zip precomp-sea=../sea.zip style-file=../styles/mystyle #road-name-config=../roadNameConfig.txt where these files are all in the same parent directory. Ticker On Thu, 2019-03-07 at 10:22 +0000, Gerd Petermann wrote:
Hi all,
attached is a patch for the documentation. It adds the text Note that relative paths given in the file are assumed to be relative to the location of the file. here: -c filename --read-config=filename Each line of the named file contains a command option in the form option=value or option:value. The options are included as arguments of the executed command as if they had been specified on the command line. Note that relative paths given in the file are assumed to be relative to the location of the file. Lines beginning with a # character are ignored and can be used as comments. Any command line option can be specified, however the leading '--' must be omitted. The short option names with a single '-' cannot be used, simply use the long name instead.
I hope this is not too confusing? I nobody suggest an inprovement I'll commit it on sunday.
Gerd
________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ranko Jaksic <ranko.jaksic@zgi.hr> Gesendet: Mittwoch, 6. März 2019 22:22 An: mkgmap-dev Betreff: [mkgmap-dev] mkgmap -c problem (relative paths)
Hello,
I use config files with mkgmap and define input-files using relative paths. Example from my config file "osm-options":
mapname: 80100003 input-file: data/80100003.osm.pbf
This works well when the config file is in the same directory where mkgmap is started. When invoked with "-c osm-options" mkgmap finds my input file just fine.
To tidy up my environment I moved all my config files into a config subdirectory. Now when I invoke mkgmap with "-c config/osm-options" I get the following error:
SEVERE (Main): .\config\data\80100003.osm.pbf: file .\config\data\80100003.osm.pbf doesn't exist
It appears that mkgmap interprets my relative paths relative to the config file location, and not (as I expected) the mkgmap cwd!
This seems to be a bug since the description for -c states: "The options are included as arguments of the executed command as if they had been specified on the command line."
I tested using the latest r4282 on Windows.
Regards, Ranko
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Ticker, seems I was wrong. Only for option input-file there is this special handling: // Relative file names in the file are taken relative to the // location of the argument file. if (key.equals("input-file") && !new File(val).isAbsolute()) val = new File(parent, val).getPath(); Besides that the existing documentation seems to be correct. Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ticker Berkin <rwb-mkgmap@jagit.co.uk> Gesendet: Donnerstag, 7. März 2019 13:05 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] mkgmap -c problem (relative paths) Hi Are you sure? I think this disagrees with my set-up, which works. In a subdirectory for a particular country, I have script with like: java -jar ../splitter/splitter.jar --geonames-file=../cities15000.zip --mapid=74320001 netherlands-latest.osm.pbf java -jar ../mkgmap/mkgmap.jar -c ../mkgmap.opts --country-name=Netherlands --country-abbr=NLD --family-id=7432 -c template.args ../mytyp.txt In the parent directory, my mkgmap.opts file has likes: bounds=../bounds.zip precomp-sea=../sea.zip style-file=../styles/mystyle #road-name-config=../roadNameConfig.txt where these files are all in the same parent directory. Ticker On Thu, 2019-03-07 at 10:22 +0000, Gerd Petermann wrote: Hi all, attached is a patch for the documentation. It adds the text Note that relative paths given in the file are assumed to be relative to the location of the file. here: -c filename --read-config=filename Each line of the named file contains a command option in the form option=value or option:value. The options are included as arguments of the executed command as if they had been specified on the command line. Note that relative paths given in the file are assumed to be relative to the location of the file. Lines beginning with a # character are ignored and can be used as comments. Any command line option can be specified, however the leading '--' must be omitted. The short option names with a single '-' cannot be used, simply use the long name instead. I hope this is not too confusing? I nobody suggest an inprovement I'll commit it on sunday. Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces@lists.mkgmap.org.uk>> im Auftrag von Ranko Jaksic <ranko.jaksic@zgi.hr<mailto:ranko.jaksic@zgi.hr>> Gesendet: Mittwoch, 6. März 2019 22:22 An: mkgmap-dev Betreff: [mkgmap-dev] mkgmap -c problem (relative paths) Hello, I use config files with mkgmap and define input-files using relative paths. Example from my config file "osm-options": mapname: 80100003 input-file: data/80100003.osm.pbf This works well when the config file is in the same directory where mkgmap is started. When invoked with "-c osm-options" mkgmap finds my input file just fine. To tidy up my environment I moved all my config files into a config subdirectory. Now when I invoke mkgmap with "-c config/osm-options" I get the following error: SEVERE (Main): .\config\data\80100003.osm.pbf: file .\config\data\80100003.osm.pbf doesn't exist It appears that mkgmap interprets my relative paths relative to the config file location, and not (as I expected) the mkgmap cwd! This seems to be a bug since the description for -c states: "The options are included as arguments of the executed command as if they had been specified on the command line." I tested using the latest r4282 on Windows. Regards, Ranko _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk<mailto:mkgmap-dev@lists.mkgmap.org.uk> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk<mailto:mkgmap-dev@lists.mkgmap.org.uk> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Gerd, thanks for clearing it up! I used relative paths not only for "input-file", but also for other options (like bounds, precomp-sea and style-file) in the same options file and it confused me because paths were handled differently. The reason for the input-file exception is a good one so once this behaviour is documented I have no problem with that. :) However, you should probably change your documentation patch to make it clear that relative paths are relative to cwd for all options *except* for input-file where they are relative to the options file location. Ranko On 07.03.2019. 15:01, Gerd Petermann wrote:
Hi Ticker,
seems I was wrong. Only for option input-file there is this special handling: // Relative file names in the file are taken relative to the // location of the argument file. if (key.equals("input-file") && !new File(val).isAbsolute()) val = new File(parent, val).getPath();
Besides that the existing documentation seems to be correct.
Gerd
________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ticker Berkin <rwb-mkgmap@jagit.co.uk> Gesendet: Donnerstag, 7. März 2019 13:05 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] mkgmap -c problem (relative paths)
Hi
Are you sure? I think this disagrees with my set-up, which works.
In a subdirectory for a particular country, I have script with like:
java -jar ../splitter/splitter.jar --geonames-file=../cities15000.zip --mapid=74320001 netherlands-latest.osm.pbf
java -jar ../mkgmap/mkgmap.jar -c ../mkgmap.opts --country-name=Netherlands --country-abbr=NLD --family-id=7432 -c template.args ../mytyp.txt
In the parent directory, my mkgmap.opts file has likes:
bounds=../bounds.zip precomp-sea=../sea.zip style-file=../styles/mystyle #road-name-config=../roadNameConfig.txt
where these files are all in the same parent directory.
Ticker
On Thu, 2019-03-07 at 10:22 +0000, Gerd Petermann wrote: Hi all,
attached is a patch for the documentation. It adds the text Note that relative paths given in the file are assumed to be relative to the location of the file. here: -c filename --read-config=filename Each line of the named file contains a command option in the form option=value or option:value. The options are included as arguments of the executed command as if they had been specified on the command line. Note that relative paths given in the file are assumed to be relative to the location of the file. Lines beginning with a # character are ignored and can be used as comments. Any command line option can be specified, however the leading '--' must be omitted. The short option names with a single '-' cannot be used, simply use the long name instead.
I hope this is not too confusing? I nobody suggest an inprovement I'll commit it on sunday.
Gerd
________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces@lists.mkgmap.org.uk>> im Auftrag von Ranko Jaksic <ranko.jaksic@zgi.hr<mailto:ranko.jaksic@zgi.hr>> Gesendet: Mittwoch, 6. März 2019 22:22 An: mkgmap-dev Betreff: [mkgmap-dev] mkgmap -c problem (relative paths)
Hello,
I use config files with mkgmap and define input-files using relative paths. Example from my config file "osm-options":
mapname: 80100003 input-file: data/80100003.osm.pbf
This works well when the config file is in the same directory where mkgmap is started. When invoked with "-c osm-options" mkgmap finds my input file just fine.
To tidy up my environment I moved all my config files into a config subdirectory. Now when I invoke mkgmap with "-c config/osm-options" I get the following error:
SEVERE (Main): .\config\data\80100003.osm.pbf: file .\config\data\80100003.osm.pbf doesn't exist
It appears that mkgmap interprets my relative paths relative to the config file location, and not (as I expected) the mkgmap cwd!
This seems to be a bug since the description for -c states: "The options are included as arguments of the executed command as if they had been specified on the command line."
I tested using the latest r4282 on Windows.
Regards, Ranko
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk<mailto:mkgmap-dev@lists.mkgmap.org.uk> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk<mailto:mkgmap-dev@lists.mkgmap.org.uk> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
participants (3)
-
Gerd Petermann
-
Ranko Jaksic
-
Ticker Berkin