{
    "type": "overpass",
    "name": {
        "en": "Maxspeed"
    },
    "query": {
        "11": "way[highway~\"^(motorway|trunk)$\"];",
        "15": "way[highway~\"^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|residential|unclassified)$\"];",
        "13": "way[highway~\"^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|tertiary)$\"];",
        "17": "way[highway~\"^(motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|residential|unclassified|service|living_street|pedestrian|track|road)$\"];"
    },
    "feature": {
        "pre": [
            "{% if tags.maxspeed is not defined %}",
            "{% set maxspeedKmh = null %}",
            "{% set maxspeed = null %}",
            "{% set unit = null %}",
            "{% else %}",
            "",
            "{% if tags.maxspeed|matches(\"^[0-9]+$\") %}",
            "{% set maxspeedKmh = tags.maxspeed %}",
            "{% set maxspeed = tags.maxspeed %}",
            "{% set unit = \"km/h\" %}",
            "{% endif %}",
            "",
            "",
            "{% set m = tags.maxspeed|matches(\"(^[0-9]+) mph$\") %}",
            "{% if m %}",
            "{% set maxspeedKmh = m[1] * 1.60934 %}",
            "{% set maxspeed = m[1] %}",
            "{% set unit = \"mph\" %}",
            "{% endif %}",
            "",
            "{% endif %}",
            "",
            "{% if not maxspeedKmh %}",
            "{% set color = \"#404040\" %}",
            "{% else %}",
            "{% set color = colorInterpolate([ 'green', 'orange', 'red' ], maxspeedKmh / 150) %}",
            "{% endif %}"
        ],
        "description": [
            "{% if maxspeed %}",
            "<span style='color: {{ color }}'>{{ maxspeed }} {{ unit }}</span>",
            "{% else %}",
            "{{ trans('unknown') }}",
            "{% endif %}"
        ],
        "markerSign": null,
        "style": {
            "color": "{{ color }}"
        }
    }
}