logo separator

[mkgmap-dev] if-then-else in style and style options

From Gerd Petermann GPetermann_muenchen at hotmail.com on Wed Mar 1 14:54:02 GMT 2017

Hi all,

I've applied the style-option_v3.patch to the branch, for details see  log message:
http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&rev=3827

I've also tried to fix the known problems with the interpretation of if then statements,
so I hope it works now:
http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&path=%2F&

Just to make this clear: The if statements are translated to "normal" rules, so you cannot do anything
with if-then which would not work without, you should also not (yet) exprect run time improvements.
The advantage is that you don't have to repeat phrases.

A complex sample that shows a possible usage.
# Roundabouts
if (junction=roundabout) then
	if (mkgmap:option:single-roundabout=true) then
		(highway=trunk | highway=trunk_link) [0x0c road_class=4 road_speed=2 resolution 18]
		(highway=primary | highway=primary_link) [0x0c road_class=3 road_speed=2 resolution 19]
		(highway=secondary | highway=secondary_link) [0x0c road_class=2 road_speed=2 resolution 20]
		(highway=tertiary | highway=tertiary_link) [0x0c road_class=1 road_speed=1 resolution 21]
	else
		(highway=trunk | highway=trunk_link) [0x0c road_class=4 road_speed=2 resolution 24 continue]
		(highway=trunk | highway=trunk_link) [0x10801 resolution 18]
		
		(highway=primary | highway=primary_link) [0x0c road_class=3 road_speed=2 resolution 24 continue]
		(highway=primary | highway=primary_link) [0x10802 resolution 19]
		
		(highway=secondary | highway=secondary_link) [0x0c road_class=2 road_speed=2 resolution 24 continue]
		(highway=secondary | highway=secondary_link) [0x10803 resolution 20]
		
		(highway=tertiary | highway=tertiary_link) [0x0c road_class=1 road_speed=1 resolution 24 continue]
		(highway=tertiary | highway=tertiary_link) [0x10804 resolution 21]
	end
	# minor roundabouts need no overlay 	
	(highway=unclassified | highway=minor ) [0x0c road_class=1 road_speed=1 resolution 21]
	highway=* [0x0c road_class=0 road_speed=1 resolution 22]
end
 
If the corresponding block in the default style lines file is replaced with these rules, you can
use option --style-option=single-roundabout to enable the rules which don't add 0x180x lines as overlays for roundabouts.

It might be possible to completely remove rules which would never be triggered but that is quite complex, so I leave that for later.

Gerd


More information about the mkgmap-dev mailing list