Changes between Version 38 and Version 39 of Styles/Lane_and_Road_Attributes
- Timestamp:
- 2014-04-03T11:37:15+02:00 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Styles/Lane_and_Road_Attributes
v38 v39 19 19 * [[osmwiki:Key:traffic_sign|traffic_sign]]: Traffic signs for speed limits and overtaking are displayed if tagged with traffic_sign=maxspeed/overtaking and maxspeed=<limit> resp. overtaking=yes/no. The value implicit for maxspeed is interpreted as the end of the speed limit. Combinations like traffic_sign=maxspeed;overtaking are also supported. 20 20 * [[osmwiki:Key:hov|hov:lanes]]: Dedicated HOV lanes. The minimum requirement can be specified by hov:minimum (supported values: 2 and 3) 21 * [[osmwiki:Relation:destination_sign|Relation destination_sign]]: Experimental and very limited support! 22 * [[osmwiki:Key:driving_side|driving_side]]: Used to specify the driving side of the traffic. This is only supported on ways. 21 23 22 24 Furthermore: 23 25 * Common suffixes like :forward, :backward, :left, :right: and :both as well as the proposed :both_ways (for lanes in both directions) are supported where appropriate. 24 26 * Some common tagging errors are detected and displayed, e.g. inconsistent number of lane-dependent values and typos in the keys turn and change. 25 * The style also supports '''left-hand traffic''' if the parameter style_right_hand_traffic is set to no. 26 * Visualization of turning lanes can be improved by setting the parameter style_use_svg to true, but this might lead to memory problems (see below) 27 * The style also supports '''left-hand traffic'''; see section Settings. 27 28 28 29 Use the [[Help/Dialog/MapPaint|Map Style Dialog]] to download and activate the style. A good starting point to see it in action is the [osmwww:#map=14/47.0705/15.4353 area around Graz in Austria]. … … 42 43 * Left-hand traffic is nearly untested. Please provide feedback. 43 44 * Roads with oneway=-1 may lead to incorrect results. Please provide feedback. 44 * change:lanes without suffix is currently only supported on one-ways. It is planned to support this in the future, but limited to the values yes and no. 45 * If both destination:forward and destination:backward are given they will be written side-by-side but due to a limitation of JOSM it is purely random if destination:forward is rendered above the forward or backward lanes and vice versa. 45 * change:lanes without suffix is currently only supported on one-ways and for the special case of change:lanes=no|no. 46 46 * In forward and backward direction a maximum of eight lanes and for lanes in both directions a maximum of four lanes is displayed. 47 47 … … 59 59 {{{ 60 60 #!style type="mapcss" 61 62 61 63 62 … … 67 66 link: "http://josm.openstreetmap.de/wiki/Styles/Lane_and_Road_Attributes"; 68 67 author: "Martin Vonwald"; 69 version: "2. 2-[[revision]]_[[date]]";68 version: "2.4-[[revision]]_[[date]]"; 70 69 license: "CC-BY-SA"; 71 min-josm-version: "6 766";70 min-josm-version: "6950"; 72 71 } 73 72 … … 94 93 style_show_errors: yes; /* Will be overriden by ugly hack below */ 95 94 style_show_disputed: no; /* Will be overriden by ugly hack below */ 96 style_use_svg : yes;/* Will be overriden by ugly hack below */95 style_use_svg_turn: yes; /* Will be overriden by ugly hack below */ 97 96 98 97 /* Ugly hack to make opacity configurable */ … … 113 112 ugly_show_disputed: Boolean_show_disputed#000000; 114 113 style_show_disputed: eval(red(prop(ugly_show_disputed)))=1; 115 ugly_use_svg: Boolean_use_svg#FFFFFF; 116 style_use_svg: eval(red(prop(ugly_use_svg)))=1; 114 ugly_use_svg_turn: Boolean_use_svg_for_turning_markings#FFFFFF; 115 style_use_svg_turn: eval(red(prop(ugly_use_svg_turn)))=1; 116 ugly_use_svg_destination: Boolean_use_svg_for_destination#FFFFFF; 117 style_use_svg_destination: eval(red(prop(ugly_use_svg_destination)))=1; 117 118 118 119 /* Color of the sidewalk: none (ignored), sidewalk only, cycletrack only, sidewalk and cycletrack */ … … 413 414 } 414 415 416 415 417 /***************************************************************************************************************************************************/ 416 418 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 417 419 /* Determine turning lanes */ 418 /* TODO: rendering of "reverse"is missing*/420 /* Note: rendering of "reverse" only when using svg */ 419 421 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 420 422 /***************************************************************************************************************************************************/ … … 432 434 /* Forward lanes (standard images) */ 433 435 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 434 way|z17-[is_prop_set(ok)][!prop(style_use_svg)]["turn:lanes:forward"], 435 way|z17-[is_prop_set(ok)][!prop(style_use_svg)]["turn:forward"], 436 way|z17-[is_prop_set(ok)][!prop(style_use_svg)]["turn:lanes"][prop(oneway_type)=1], 437 way|z17-[is_prop_set(ok)][!prop(style_use_svg)]["turn"][prop(oneway_type)=1] 436 way|z17-[is_prop_set(ok)][!prop(style_use_svg_turn)]["turn:lanes:forward"], 437 way|z17-[is_prop_set(ok)][!prop(style_use_svg_turn)]["turn:forward"], 438 way|z17-[is_prop_set(ok)][!prop(style_use_svg_turn)]["turn:lanes"][prop(oneway_type)=1], 439 way|z17-[is_prop_set(ok)][!prop(style_use_svg_turn)]["turn"][prop(oneway_type)=1] 438 440 { 439 441 temp: eval(cond(has_tag_key("turn:lanes"),tag("turn:lanes"), … … 545 547 /* Backward lanes (standard images) */ 546 548 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 547 way|z17-[is_prop_set(ok)][!prop(style_use_svg)]["turn:lanes:backward"], 548 way|z17-[is_prop_set(ok)][!prop(style_use_svg)]["turn:backward"], 549 way|z17-[is_prop_set(ok)][!prop(style_use_svg)]["turn:lanes"][prop(oneway_type)=(-1)], 550 way|z17-[is_prop_set(ok)][!prop(style_use_svg)]["turn"][prop(oneway_type)=(-1)] 549 way|z17-[is_prop_set(ok)][!prop(style_use_svg_turn)]["turn:lanes:backward"], 550 way|z17-[is_prop_set(ok)][!prop(style_use_svg_turn)]["turn:backward"], 551 way|z17-[is_prop_set(ok)][!prop(style_use_svg_turn)]["turn:lanes"][prop(oneway_type)=(-1)], 552 way|z17-[is_prop_set(ok)][!prop(style_use_svg_turn)]["turn"][prop(oneway_type)=(-1)] 551 553 { 552 554 temp: eval(cond(has_tag_key("turn:lanes"),tag("turn:lanes"), … … 655 657 /* SVG for turn images */ 656 658 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 657 way|z17-[is_prop_set(ok)][prop(style_use_svg)] 659 way|z17-[is_prop_set(ok)][prop(style_use_svg_turn)] 658 660 { 659 661 turn_svg_through_forward: eval("<path fill='#FFF' d='m0,17.5,0,15,67.5-5,0,7.5,32.5-10-32.5-10,0,7.5z'/>"); … … 676 678 /* Forward lanes (SVG) */ 677 679 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 678 way|z17-[is_prop_set(ok)][prop(style_use_svg)]["turn:lanes:forward"], 679 way|z17-[is_prop_set(ok)][prop(style_use_svg)]["turn:forward"], 680 way|z17-[is_prop_set(ok)][prop(style_use_svg)]["turn:lanes"][prop(oneway_type)=1], 681 way|z17-[is_prop_set(ok)][prop(style_use_svg)]["turn"][prop(oneway_type)=1] 680 way|z17-[is_prop_set(ok)][prop(style_use_svg_turn)]["turn:lanes:forward"], 681 way|z17-[is_prop_set(ok)][prop(style_use_svg_turn)]["turn:forward"], 682 way|z17-[is_prop_set(ok)][prop(style_use_svg_turn)]["turn:lanes"][prop(oneway_type)=1], 683 way|z17-[is_prop_set(ok)][prop(style_use_svg_turn)]["turn"][prop(oneway_type)=1] 682 684 { 683 685 temp: eval(cond(has_tag_key("turn:lanes"),tag("turn:lanes"), … … 836 838 /* Backward lanes (SVG) */ 837 839 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 838 way|z17-[is_prop_set(ok)][prop(style_use_svg)]["turn:lanes:backward"], 839 way|z17-[is_prop_set(ok)][prop(style_use_svg)]["turn:backward"], 840 way|z17-[is_prop_set(ok)][prop(style_use_svg)]["turn:lanes"][prop(oneway_type)=(-1)], 841 way|z17-[is_prop_set(ok)][prop(style_use_svg)]["turn"][prop(oneway_type)=(-1)] 840 way|z17-[is_prop_set(ok)][prop(style_use_svg_turn)]["turn:lanes:backward"], 841 way|z17-[is_prop_set(ok)][prop(style_use_svg_turn)]["turn:backward"], 842 way|z17-[is_prop_set(ok)][prop(style_use_svg_turn)]["turn:lanes"][prop(oneway_type)=(-1)], 843 way|z17-[is_prop_set(ok)][prop(style_use_svg_turn)]["turn"][prop(oneway_type)=(-1)] 842 844 { 843 845 temp: eval(cond(has_tag_key("turn:lanes"),tag("turn:lanes"), … … 3193 3195 /* Destination */ 3194 3196 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 3195 way[destination]::Destination 3197 way|z17-[is_prop_set(ok)][destination][!prop(style_use_svg_destination)]::Destination 3196 3198 { 3197 3199 text-offset: eval(prop("placement_offset","default")); … … 3202 3204 text-halo-radius: 2; text-halo-color: blue; text-halo-opacity: 0.3; 3203 3205 } 3204 way["destination:forward"]::Destination_Forward 3206 way|z17-[is_prop_set(ok)]["destination:forward"][!prop(style_use_svg_destination)]::Destination_Forward 3205 3207 { 3206 3208 text-offset: eval(prop("placement_offset","default")+(eval(prop(lane_width_all,"default"))/4)); … … 3211 3213 text-halo-radius: 2; text-halo-color: blue; text-halo-opacity: 0.3; 3212 3214 } 3213 way["destination:backward"]::Destination_Backward 3215 way|z17-[is_prop_set(ok)]["destination:backward"][!prop(style_use_svg_destination)]::Destination_Backward 3214 3216 { 3215 3217 text-offset: eval(prop("placement_offset","default")-(eval(prop(lane_width_all,"default"))/4)); … … 3221 3223 } 3222 3224 3225 /* TODO: make opacity configurable */ 3226 way{} /* If this is removed the following won't be interpreted */ 3227 way|z17-[is_prop_set(ok)][destination][prop(style_use_svg_destination)]::Destination 3228 { 3229 complete_destination: eval(get(split(";",tag(destination)),0)); 3230 complete_destination: eval(has_tag_key("destination:ref")?concat(prop(complete_destination)," (",get(split(";",tag("destination:ref")),0),")"):prop(complete_destination)); 3231 complete_destination: eval(has_tag_key("destination:int_ref")?concat(prop(complete_destination)," <",get(split(";",tag("destination:int_ref")),0),">"):prop(complete_destination)); 3232 complete_destination: eval(has_tag_key("destination:country")?concat(prop(complete_destination)," [",get(split(";",tag("destination:country")),0),"]"):prop(complete_destination)); 3233 /* complete_destination: eval(replace(replace(replace(replace(replace(prop(complete_destination),"&","&"),"[","["),"]","]"),"<","<"),">",">")); */ 3234 complete_destination: eval(XML_encode(replace(prop(complete_destination),"%","prc"))); /* CDATA blocks are not working, XML_encode is not sufficient, currently no idea how to escape % */ 3235 3236 repeat-image: eval(concat("data:image/svg+xml,<svg height='70px'><g fill-opacity='0.3' stroke-opacity='0.3'><text x='0' y='50' font-size='50' fill='white' stroke='blue'>",prop(complete_destination),"</text></g></svg>")); 3237 repeat-image-height: eval(prop(lane_default_width,"default")*prop(lanes_fwd,"default")); 3238 repeat-image-offset: eval(prop("placement_offset","default")); 3239 repeat-image-spacing: eval(prop(repeat-image-height)); 3240 repeat-image-phase: eval(prop(repeat-image-height)); 3241 } 3242 way{} /* If this is removed the following won't be interpreted */ 3243 way|z17-[is_prop_set(ok)]["destination:forward"][prop(style_use_svg_destination)]::Destination_Forward 3244 { 3245 complete_destination: eval(get(split(";",tag("destination:forward")),0)); 3246 complete_destination: eval(has_tag_key("destination:ref:forward")?concat(prop(complete_destination)," (",get(split(";",tag("destination:ref:forward")),0),")"):prop(complete_destination)); 3247 complete_destination: eval(has_tag_key("destination:int_ref:forward")?concat(prop(complete_destination)," <",get(split(";",tag("destination:int_ref:forward")),0),">"):prop(complete_destination)); 3248 complete_destination: eval(has_tag_key("destination:country:forward")?concat(prop(complete_destination)," [",get(split(";",tag("destination:country:forward")),0),"]"):prop(complete_destination)); 3249 complete_destination: eval(XML_encode(replace(prop(complete_destination),"%","prc"))); /* CDATA blocks are not working, XML_encode is not sufficient, currently no idea how to escape % */ 3250 3251 repeat-image: eval(concat("data:image/svg+xml,<svg height='70px'><g fill-opacity='0.3' stroke-opacity='0.3'><text x='0' y='50' font-size='50' fill='white' stroke='blue'>",prop(complete_destination),"</text></g></svg>")); 3252 repeat-image-height: eval(prop(lane_default_width,"default")*prop(lanes_fwd,"default")); 3253 repeat-image-offset: eval(prop("left_forward_border","default")-(prop("lane_width_all_forward","default")/2)); 3254 repeat-image-spacing: eval(prop(repeat-image-height)); 3255 repeat-image-phase: eval(prop(repeat-image-height)); 3256 } 3257 way{} /* If this is removed the following won't be interpreted */ 3258 way|z17-[is_prop_set(ok)]["destination:backward"][prop(style_use_svg_destination)]::Destination_Backward 3259 { 3260 complete_destination: eval(get(split(";",tag("destination:backward")),0)); 3261 complete_destination: eval(has_tag_key("destination:ref:backward")?concat(prop(complete_destination)," (",get(split(";",tag("destination:ref:backward")),0),")"):prop(complete_destination)); 3262 complete_destination: eval(has_tag_key("destination:int_ref:backward")?concat(prop(complete_destination)," <",get(split(";",tag("destination:int_ref:backward")),0),">"):prop(complete_destination)); 3263 complete_destination: eval(has_tag_key("destination:country:backward")?concat(prop(complete_destination)," [",get(split(";",tag("destination:country:backward")),0),"]"):prop(complete_destination)); 3264 complete_destination: eval(XML_encode(replace(prop(complete_destination),"%","prc"))); /* CDATA blocks are not working, XML_encode is not sufficient, currently no idea how to escape % */ 3265 3266 repeat-image: eval(concat("data:image/svg+xml,<svg height='70px'><g fill-opacity='0.3' stroke-opacity='0.3'><text x='0' y='50' font-size='50' fill='white' stroke='blue'>",prop(complete_destination),"</text></g></svg>")); 3267 repeat-image-height: eval(prop(lane_default_width,"default")*prop(lanes_bwd,"default")); 3268 repeat-image-offset: eval(prop("right_backward_border","default")+(prop("lane_width_all_backward","default")/2)); 3269 repeat-image-spacing: eval(prop(repeat-image-height)); 3270 repeat-image-phase: eval(prop(repeat-image-height)); 3271 } 3272 3273 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 3274 /* destination_sign relation (experimental support - only one sign per way is supported) */ 3275 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 3276 relation[is_prop_set(ok)][type="destination_sign"] >[role="to"] way|z17-::Destination_Sign 3277 { 3278 sign_font_size: 50; 3279 sign_border: 5; 3280 sign_height: 70; 3281 sign_opacity: 0.5; 3282 sign_text: eval(parent_tag(destination)); 3283 sign_temp: eval(parent_tag("distance")); 3284 sign_text: eval(is_prop_set(sign_temp)?concat(prop(sign_text)," ",replace(replace(prop(sign_temp)," km","")," mi","")):prop(sign_text)); 3285 sign_ref: eval(parent_tag("destination:ref")); 3286 sign_int_ref: eval(parent_tag("destination:int_ref")); 3287 3288 sign_text_width: eval(length(prop(sign_text))*prop(sign_font_size)); /* As font-family=monospace is not working, this value is just a guess*/ 3289 sign_text_x: eval((prop(sign_text_width)/2)+(2*prop(sign_border))); 3290 sign_text_y: eval(prop(sign_font_size)); 3291 3292 sign_ref_width: eval(is_prop_set(sign_ref)?(length(prop(sign_ref))*prop(sign_font_size)*1.2):0); 3293 sign_ref_x: eval(prop(sign_text_width)+(3*prop(sign_border))); 3294 sign_ref_y: eval(prop(sign_border)); 3295 sign_ref_height: eval(prop(sign_height)-(2*prop(sign_border))); 3296 sign_ref_text_x: eval(prop(sign_ref_x)+(prop(sign_ref_width)/2)); 3297 sign_ref_text_y: eval(prop(sign_font_size)); 3298 3299 sign_int_ref_width: eval(is_prop_set(sign_int_ref)?(length(prop(sign_int_ref))*prop(sign_font_size)*1.2):0); 3300 sign_int_ref_x: eval(prop(sign_ref_x)+prop(sign_ref_width)); 3301 sign_int_ref_y: eval(prop(sign_border)); 3302 sign_int_ref_height: eval(prop(sign_height)-(2*prop(sign_border))); 3303 sign_int_ref_text_x: eval(prop(sign_int_ref_x)+(prop(sign_int_ref_width)/2)); 3304 sign_int_ref_text_y: eval(prop(sign_font_size)); 3305 3306 sign_width: eval(((prop(sign_text_width)+(4*prop(sign_border)))+prop(sign_ref_width))+prop(sign_int_ref_width)); 3307 sign_border_width: eval(prop(sign_width)-(prop(sign_border)*2)); 3308 sign_border_height: eval(prop(sign_height)-(prop(sign_border)*2)); 3309 3310 sign_colour_back: eval(parent_tag("colour:back")); 3311 sign_colour_back: eval(is_prop_set(sign_colour_back)?prop(sign_colour_back):"white"); 3312 3313 sign_colour_text: eval(parent_tag("colour:text")); 3314 sign_colour_text: eval(is_prop_set(sign_colour_text)?prop(sign_colour_text):"blue"); 3315 3316 sign_colour_arrow: eval(parent_tag("colour:arrow")); 3317 sign_colour_arrow: eval(is_prop_set(sign_colour_arrow)?prop(sign_colour_arrow):"blue"); 3318 3319 sign_colour_ref_text: eval(parent_tag("colour:text:ref")); 3320 sign_colour_ref_text: eval(is_prop_set(sign_colour_ref)?prop(sign_colour_ref):"white"); 3321 3322 sign_colour_ref_back: eval(parent_tag("colour:back:ref")); 3323 sign_colour_ref_back: eval(is_prop_set(sign_colour_ref)?prop(sign_colour_ref):"blue"); 3324 3325 sign_colour_int_ref_text: eval(parent_tag("colour:text:int_ref")); 3326 sign_colour_int_ref_text: eval(is_prop_set(sign_colour_int_ref)?prop(sign_colour_int_ref):"white"); 3327 3328 sign_colour_int_ref_back: eval(parent_tag("colour:back:int_ref")); 3329 sign_colour_int_ref_back: eval(is_prop_set(sign_colour_int_ref)?prop(sign_colour_int_ref):"green"); 3330 3331 3332 repeat-image: eval(concat("data:image/svg+xml,<svg height='",prop(sign_height),"px'><rect fill-opacity='",prop(sign_opacity),"' fill='",prop(sign_colour_back),"' stroke-opacity='",prop(sign_opacity),"' stroke='",prop(sign_colour_arrow),"' stroke-width='",prop(sign_border),"' x='",prop(sign_border),"' y='",prop(sign_border),"' width='",prop(sign_border_width),"' height='",prop(sign_border_height),"'/>", 3333 "<g fill-opacity='",prop(sign_opacity),"'><text text-anchor='middle' x='",prop(sign_text_x),"' y='",prop(sign_text_y),"' font-size='",prop(sign_font_size),"' fill='",prop(sign_colour_text),"'>",prop(sign_text),"</text></g>", 3334 "<rect fill-opacity='",prop(sign_opacity),"' fill='",prop(sign_colour_ref_back),"' x='",prop(sign_ref_x),"' y='",prop(sign_ref_y),"' width='",prop(sign_ref_width),"' height='",prop(sign_ref_height),"' />", 3335 "<g fill-opacity='",prop(sign_opacity),"'><text text-anchor='middle' x='",prop(sign_ref_text_x),"' y='",prop(sign_ref_text_y),"' font-size='",prop(sign_font_size),"' fill='",prop(sign_colour_ref_text),"'>",prop(sign_ref),"</text></g>", 3336 "<rect fill-opacity='",prop(sign_opacity),"' fill='",prop(sign_colour_int_ref_back),"' x='",prop(sign_int_ref_x),"' y='",prop(sign_int_ref_y),"' width='",prop(sign_int_ref_width),"' height='",prop(sign_int_ref_height),"' />", 3337 "<g fill-opacity='",prop(sign_opacity),"'><text text-anchor='middle' x='",prop(sign_int_ref_text_x),"' y='",prop(sign_int_ref_text_y),"' font-size='",prop(sign_font_size),"' fill='",prop(sign_colour_int_ref_text),"'>",prop(sign_int_ref),"</text></g>", 3338 "</svg>")); 3339 repeat-image-spacing: 100000; /* It means: do not repeat! */ 3340 repeat-image-offset: eval((is_prop_set(left_carriageway_border,"default")?(prop(left_carriageway_border,"default")):0)+(prop(pixel_per_metre,"default")*3)); 3341 repeat-image-height: eval(prop(pixel_per_metre,"default")*3); 3342 } 3223 3343 3224 3344 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ … … 3344 3464 /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ 3345 3465 /* maxspeed should be numerical (yes, this is disputed, I know, that's why this is disabled by default) */ 3346 way[prop(style_show_disputed)][maxspeed] { data_error: eval(regexp_test("^[0-9]+$",tag(maxspeed))?prop(data_error):"maxspeed not numerical"); } 3347 way[prop(style_show_disputed)]["maxspeed:forward"] { data_error: eval(regexp_test("^[0-9]+$",tag("maxspeed:forward"))?prop(data_error):"maxspeed:forward not numerical"); } 3348 way[prop(style_show_disputed)]["maxspeed:backward"] { data_error: eval(regexp_test("^[0-9]+$",tag("maxspeed:backward"))?prop(data_error):"maxspeed:backward not numerical"); } 3466 way[prop(style_show_disputed)][maxspeed] { data_error: eval(regexp_test("^[0-9]+(| mph| km/h)$",tag(maxspeed))?prop(data_error):"maxspeed not numerical"); } 3467 way[prop(style_show_disputed)]["maxspeed:forward"] { data_error: eval(regexp_test("^[0-9]+(| mph| km/h)$",tag("maxspeed:forward"))?prop(data_error):"maxspeed:forward not numerical"); } 3468 way[prop(style_show_disputed)]["maxspeed:backward"] { data_error: eval(regexp_test("^[0-9]+(| mph| km/h)$",tag("maxspeed:backward"))?prop(data_error):"maxspeed:backward not numerical"); } 3349 3469 /* A source should be given for maxspeed */ 3350 3470 way[prop(style_show_disputed)][maxspeed][!"source:maxspeed"] { data_warning: "source:maxspeed missing"; }
