#
# Sets the road speed based on the maxspeed tag.
# In case mkgmap:road-speed-class is set the element 
# road_speed is overriden.
#
# road_speed classification:
# road_speed | highest speed
#  7         | No speed limit
#  6         | 70 mph / 110 km/h
#  5         | 60 mph /  90 km/h
#  4         | 50 mph /  80 km/h
#  3         | 35 mph /  60 km/h
#  2         | 25 mph /  40 km/h
#  1         | 15 mph /  20 km/h
#  0         |  3 mph /   5 km/h
#

maxspeed=* & mkgmap:road-speed-class!=* & maxspeedkmh() > 110 { set mkgmap:road-speed-class = 7 }
maxspeed=* & mkgmap:road-speed-class!=* & maxspeedkmh() >  90 { set mkgmap:road-speed-class = 6 }
maxspeed=* & mkgmap:road-speed-class!=* & maxspeedkmh() >  80 { set mkgmap:road-speed-class = 5 }
maxspeed=* & mkgmap:road-speed-class!=* & maxspeedkmh() >  60 { set mkgmap:road-speed-class = 4 }
maxspeed=* & mkgmap:road-speed-class!=* & maxspeedkmh() >  40 { set mkgmap:road-speed-class = 3 }
maxspeed=* & mkgmap:road-speed-class!=* & maxspeedkmh() >  20 { set mkgmap:road-speed-class = 2 }
# change class 1 to 10 km/h which is not correct but better handles living_streets with maxspeed=7
maxspeed=* & mkgmap:road-speed-class!=* & maxspeedkmh() >  10 { set mkgmap:road-speed-class = 1 }
maxspeed=* & mkgmap:road-speed-class!=* & maxspeedkmh()=*     { set mkgmap:road-speed-class = 0 }
