OSM Tools
dutch german en francais spanish spanish polish russian

Tricks & Tips: If ... then else end

More Tricks

mkgmap now supports if then statements but you need to be careful!

Example 1

if (access=no) then

else

end

NOT:

if access=no then

Example 2

if (access=no) then

access=no {echotags "access=no"}

else

access=* {echotags "access=*"}

end

NOT:

if (access=no) then

{echotags "access=no"}

else

{echotags "access=*"}

end

Example 3:

Checking if lines have an area tag

if (area=yes) then
# allow for routing but make it invisible (ie 0x0B is a routable line made transparent in TYP file

# Use 'continue' else polygon residential highway will not be parse:remember:

# lines are always parsed before polygons

highway=residential [0x0b road_class=0 road_speed=1 resolution 24 continue]

else

highway=residential [0x07 road_class=0 road_speed=1 resolution 24 ]

end

Example 4

if (highway=* & railway=*) then

# ie railway=abandoned and highway=track

else

 

end

Example 5

The following does not work!

if (highway=track) then

[0x0A resolution 24]

else

[0x0C resolution 24]

end

It needs to be

if (highway=track) then

highway=track [0x0A resolution 24]

else

highway=* [0x0C resolution 24]

end