A repository for testing purposes.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.2 KiB

  1. query: |
  2. (
  3. way[highway=cycleway];
  4. way["cycleway:width"];
  5. )
  6. feature:
  7. style:
  8. width: 4
  9. color: |
  10. {% set width = attribute(tags, 'cycleway:width') %}
  11. {% if width matches "/'$/" %}
  12. {% set width = (width|slice(0, -1)) * 0.3048 %}
  13. {% endif %}
  14. {% set minWidth = tags.oneway in ['yes', 1, -1] ? const.minWidthOneway : const.minWidthBoth %}
  15. {% set optWidth = tags.oneway in ['yes', 1, -1] ? const.optWidthOneway : const.optWidthBoth %}
  16. {% if width %}
  17. {{ colorInterpolate(const.colorScheme, (width - minWidth) / (optWidth - minWidth)) }}
  18. {% else %}black
  19. {% endif %}
  20. markerSymbol: false
  21. listMarkerSymbol: line
  22. description: |
  23. {{ tagTrans('highway', tags.highway) }}
  24. details: |
  25. {% if not attribute(tags, 'cycleway:width') %}
  26. {% elseif attribute(tags, 'cycleway:width') matches "/'$/" %}
  27. {{ attribute(tags, 'cycleway:width') }}
  28. {% else %}
  29. {{ attribute(tags, 'cycleway:width') }}m
  30. {% endif %}
  31. body: |
  32. <ul>
  33. <li>
  34. {{ keyTrans('cycleway:width') }}:
  35. {% if not attribute(tags, 'cycleway:width') %}
  36. {% elseif attribute(tags, 'cycleway:width') matches "/(m|')$/" %}
  37. {{ attribute(tags, 'cycleway:width') }}
  38. {% else %}
  39. {{ attribute(tags, 'cycleway:width') }}m
  40. {% endif %}
  41. </ul>
  42. info: |
  43. <table>
  44. <tr>
  45. <th>Symbol</th>
  46. <th>{{ keyTrans('oneway') }}={{ tagTrans('oneway', 'yes') }}</th>
  47. <th>{{ keyTrans('oneway') }}={{ tagTrans('oneway', 'no') }}</th>
  48. </tr>
  49. {% for v in range(0, 1, 0.25) %}
  50. <tr>
  51. <td>
  52. {{ markerLine({ width: 4, color: colorInterpolate(const.colorScheme, v) }) }}
  53. </td>
  54. <td>
  55. {% if v == 0 %}<={% elseif v == 1 %}>={% endif %}
  56. {{ (const.minWidthOneway + (v * (const.optWidthOneway - const.minWidthOneway)))|number_format(2) }}m
  57. </td>
  58. <td>
  59. {% if v == 0 %}<={% elseif v == 1 %}>={% endif %}
  60. {{ (const.minWidthBoth + (v * (const.optWidthBoth - const.minWidthBoth)))|number_format(2) }}m
  61. </td>
  62. </tr>
  63. {% endfor %}
  64. </table>
  65. const:
  66. minWidthBoth: 1.5
  67. optWidthBoth: 5
  68. minWidthOneway: 0.75
  69. optWidthOneway: 3
  70. colorScheme: ['#ff0000', '#7f7fff', '#0000ff']