| | 1 | Highlights various greenery related tags — well, currently only `natural=shrubbery`. |
| | 2 | |
| | 3 | [[Image(sample.png)]] |
| | 4 | |
| | 5 | == Settings |
| | 6 | |
| | 7 | This Map Paint Style can be configured to hide the value of the `height` tag (this is enabled by default). |
| | 8 | |
| | 9 | This style probably misses lots of useful functionality. Please let [https://www.openstreetmap.org/user/JeroenHoek me] know if you want to modify this style (if I don't reply within a reasonable span of time, go ahead and edit this style yourself). |
| | 10 | |
| | 11 | {{{ |
| | 12 | #!style type="mapcss" |
| | 13 | |
| | 14 | meta { |
| | 15 | title: "Greenery details"; |
| | 16 | description: "Higlight various cultivated greenery features, like shrubbery."; |
| | 17 | icon: "greenery-icon.svg"; |
| | 18 | author: "Jeroen Hoek"; |
| | 19 | version="1.[[revision]]_[[date]]"; |
| | 20 | min-josm-version: "17428"; |
| | 21 | } |
| | 22 | |
| | 23 | /* |
| | 24 | Settings. |
| | 25 | */ |
| | 26 | |
| | 27 | setting::show_height_label { |
| | 28 | type: boolean; |
| | 29 | label: tr("Show the height as text on the area"); |
| | 30 | default: true; |
| | 31 | } |
| | 32 | |
| | 33 | /* |
| | 34 | Man-made (man-planted, cultivated, maintained) natural features. |
| | 35 | */ |
| | 36 | |
| | 37 | area::Overlay { |
| | 38 | fill-opacity: 1.0; |
| | 39 | object-z-index: 1.0; |
| | 40 | } |
| | 41 | |
| | 42 | /* Parse height into a sensible unit. */ |
| | 43 | area[natural=shrubbery][height=~/[0-9]+ m/] { |
| | 44 | height_m: get(split(" m", tag("height")), 0); |
| | 45 | } |
| | 46 | area[natural=shrubbery][height=~/[0-9]+\'/][!is_prop_set(height_m)] { |
| | 47 | /* This works. Does anyone actually use inches and feet? */ |
| | 48 | imp_parts: split("'", tag(height)); |
| | 49 | feet: eval(max(get(prop(imp_parts), 0), 0)); |
| | 50 | inches: eval(max(get(split("\"", get(prop(imp_parts), 1)), 0), 0)); |
| | 51 | height_m: eval((prop(feet) * 0.3048) + (prop(inches) * 0.0254)); |
| | 52 | } |
| | 53 | area[natural=shrubbery][height=~/[0-9]+\"/][!is_prop_set(height_m)] { |
| | 54 | imp_parts: split("\"", tag(height)); |
| | 55 | inches: eval(max(get(prop(imp_parts), 0), 0)); |
| | 56 | height_m: eval(prop(inches) * 0.0254); |
| | 57 | } |
| | 58 | area[natural=shrubbery][height=~/[0-9]+/][!is_prop_set(height_m)] { |
| | 59 | height_m: tag("height"); |
| | 60 | } |
| | 61 | |
| | 62 | /* Put density in property. */ |
| | 63 | area[natural=shrubbery]["shrubbery:density"=sparse] { |
| | 64 | density: "sparse"; |
| | 65 | } |
| | 66 | area[natural=shrubbery]["shrubbery:density"=medium] { |
| | 67 | density: "medium"; |
| | 68 | } |
| | 69 | area[natural=shrubbery]["shrubbery:density"=dense] { |
| | 70 | density: "dense"; |
| | 71 | } |
| | 72 | |
| | 73 | area[natural=shrubbery][is_prop_set(height_m)][prop(height_m) < 2.4] { |
| | 74 | height_class: "highish"; |
| | 75 | base_colour: #1CCA42; |
| | 76 | } |
| | 77 | area[natural=shrubbery][is_prop_set(height_m)][prop(height_m) < 1.6] { |
| | 78 | height_class: "medium"; |
| | 79 | base_colour: #23A940; |
| | 80 | } |
| | 81 | area[natural=shrubbery][is_prop_set(height_m)][prop(height_m) < 0.8] { |
| | 82 | height_class: "low"; |
| | 83 | base_colour: #278B3D; |
| | 84 | } |
| | 85 | area[natural=shrubbery][is_prop_set(height_m)][prop(height_m) >= 2.4] { |
| | 86 | height_class: "high"; |
| | 87 | base_colour: #12ED42; |
| | 88 | } |
| | 89 | area[natural=shrubbery][!is_prop_set(base_colour)] { |
| | 90 | base_colour: #278B3D; |
| | 91 | } |
| | 92 | |
| | 93 | area[natural=shrubbery] { |
| | 94 | fill-color: prop(base_colour); |
| | 95 | } |
| | 96 | |
| | 97 | area[natural=shrubbery][setting("show_height_label")] { |
| | 98 | text: height; |
| | 99 | font-size: 10; |
| | 100 | text-color: #5BE67A; |
| | 101 | text-position: inside; |
| | 102 | } |
| | 103 | |
| | 104 | area[natural=shrubbery][is_prop_set(density)][is_prop_set(height_class)] { |
| | 105 | fill-color: prop(base_colour); |
| | 106 | } |
| | 107 | area[natural=shrubbery][is_prop_set(density, default)]::Overlay { |
| | 108 | fill-image: concat(prop(density, default), ".png"); |
| | 109 | fill-opacity: 1.0; |
| | 110 | fill-extent: ; |
| | 111 | } |
| | 112 | |
| | 113 | /* |
| | 114 | Warnings. |
| | 115 | */ |
| | 116 | |
| | 117 | node[natural=shrubbery] { |
| | 118 | icon-image: "presets/misc/deprecated.svg"; |
| | 119 | set icon_z17; |
| | 120 | } |
| | 121 | }}} |