
Hi programmers, the evaluation of boolean options in mkgmap is a bit confusing. It is possible to specify e.g. --drive-on-left or --drive-on-left=true or --drive-on-left=false or --drive-on-left=any-value In the current code both all have the same effect, because the evaluation is done like this: driveOnLeft = props.getProperty("drive-on-left") != null; On the other hand, --keep-going and --keep-going=false do not have the same effect, and that is true for most boolean options, because typically we use this kind of evaluation: linkPOIsToWays = props.getProperty("link-pois-to-ways", false); I think we should always use the latter method. Do you agree? Gerd

Gerd Petermann schrieb (26/11/14 -- 11:17):
[...] driveOnLeft = props.getProperty("drive-on-left") != null; [vs.] linkPOIsToWays = props.getProperty("link-pois-to-ways", false);
I think we should always use the latter method. Do you agree?
Hi Gerd, definitly. The first solution only makes sense if the parameter doesn't accept a value at all (i.e. if it is a switch with an implied value of /true/ only). Viele Grüße, Axel.

Hi Gerd
the evaluation of boolean options in mkgmap is a bit confusing. It is possible to specify e.g. --drive-on-left
This is the only documented form for this option.
--drive-on-left=true or --drive-on-left=false or --drive-on-left=any-value
These are all incorrect, I guess you could error out if it is causing confusion. The correct way to reverse a boolean is to prefix with "no-" eg: --no-tdbfile. But in this particular case it isn't even meaningful - what should you do with --drive-on-right=false or --no-drive-on-right; use the default? Which is drive-on-right ;) I suppose --drive-on=left|right would have been easier in this case.
In the current code both all have the same effect, because the evaluation is done like this: driveOnLeft = props.getProperty("drive-on-left") != null;
On the other hand, --keep-going and --keep-going=false do not have the same effect, and that is true for most boolean options, because typically we use this kind of evaluation: linkPOIsToWays = props.getProperty("link-pois-to-ways", false);
Oh well, perhaps everyone disagrees with me then :) I guess all those options were added before the "no-" prefix was available however. ..Steve

Hi Steve,
the evaluation of boolean options in mkgmap is a bit confusing. It is possible to specify e.g. --drive-on-left
This is the only documented form for this option.
Yes, that's true. I fear it was me who introduced the format var=true|false with the documentation of --remove-ovm-work-files I also used that with splitter, e.g. keep-complete=true|false I think I used it because it is common for tags.
do not have the same effect, and that is true for most boolean options, because typically we use this kind of evaluation: linkPOIsToWays = props.getProperty("link-pois-to-ways", false);
Oh well, perhaps everyone disagrees with me then :) I guess all those options were added before the "no-" prefix was available however.
My understanding is that the "no-" prefix is similar to removing the option, and with --check-roundabouts in combination with drive-on-right or drive-on-left it doesn't have the wanted effect, as it triggers the automatic detection. I agree that drive-on=right|left would be much better. Gerd
participants (3)
-
Axel Herold
-
Gerd Petermann
-
Steve Ratcliffe