User:Polderrunner/Maperitive rules/Lanes rules
Jump to navigation
Jump to search
// // Lanes overlay // // version 1.3 // // added: // Support for lanes:forward and lanes:backward // // Show approximate highway width from z=14 based on lanes tag // Show lane divisions from z=16.5 // Highway offset according to placement=* tag // turn:lanes presence shown as dark gray (no actual rendering of values) // // Limitations: // At 6 lanes or more only limited support for placement and lanes rendering // Limited support for lanes:forward or lanes:backward (median line shown as solid). Right-hand traffic is assumed! // // Usage: // Download area from Overpass.api (only objects having lanes=* necessary) // Use webmap as background // ======================================================================================= features lines lanes : (highway NOT (highway=cycleway OR highway=footway OR highway=path OR highway=steps)) AND lanes lanes_major : (highway NOT (highway=cycleway OR highway=footway OR highway=path OR highway=steps OR highway=service OR highway=residential OR highway=living_street OR highway=unclassified)) AND lanes median_line : ((lanes=2 OR lanes=4 OR lanes=6 OR lanes=8 OR lanes=10 OR lanes:forward OR lanes:backward) NOT oneway=yes) properties map-background-color : #F1EEE8 map-background-opacity : 1 rules target : lanes_major define max-zoom : 14 min-zoom : 8 line-color : gray line-opacity : 1 line-width : 2 draw : line // draw median lines on non-divided highways target : median_line // no support for placement offsets at this moment for : placement stop define line-color : white line-width : 1 line-opacity : 1 line-offset : 0 line-style : solid min-zoom : 16.5 for : lanes=2 AND (lanes:forward=1 OR lanes:backward=1) define line-offset : 0 draw : line for : lanes=3 AND (lanes:forward=1 OR lanes:backward=2) define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : right draw : line for : lanes=3 AND (lanes:forward=2 OR lanes:backward=1) define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : left draw : line for : lanes=4 AND (lanes:forward=1 OR lanes:backward=3) define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : right draw : line for : lanes=4 AND (lanes:forward=2 OR lanes:backward=2) define line-offset : 0 draw : line for : lanes=4 AND (lanes:forward=3 OR lanes:backward=1) define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : left draw : line for : lanes=5 AND (lanes:forward=1 OR lanes:backward=4) define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : right draw : line for : lanes=5 AND (lanes:forward=2 OR lanes:backward=3) define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : right draw : line for : lanes=5 AND (lanes:forward=3 OR lanes:backward=2) define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : left draw : line for : lanes=5 AND (lanes:forward=4 OR lanes:backward=1) define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : left draw : line for : lanes=6 AND (lanes:forward=2 OR lanes:backward=4) define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : right draw : line for : lanes=6 AND (lanes:forward=3 OR lanes:backward=3) define line-offset : 0 draw : line for : lanes=6 AND (lanes:forward=4 OR lanes:backward=2) define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : left draw : line for : lanes=7 AND (lanes:forward=2 OR lanes:backward=5) define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : right draw : line for : lanes=7 AND (lanes:forward=3 OR lanes:backward=4) define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : right draw : line for : lanes=7 AND (lanes:forward=4 OR lanes:backward=3) define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : left draw : line for : lanes=7 AND (lanes:forward=5 OR lanes:backward=2) define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : left draw : line for : lanes=8 AND (lanes:forward=3 OR lanes:backward=5) define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : right draw : line for : lanes=8 AND (lanes:forward=4 OR lanes:backward=4) define line-offset : 0 draw : line for : lanes=8 AND (lanes:forward=5 OR lanes:backward=3) define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : left draw : line for : (lanes=2 OR lanes=4 OR lanes=6 OR lanes=8 or lanes=10) NOT (lanes:forward OR lanes:backward) // assume middle for highways with even number of lanes and no forward or backward lanes tags draw : line target : lanes // at z>=14 draw highway at correct width including any placement offset define min-zoom : 14 max-zoom : 21 line-color : black line-opacity : 0.7 line-offset-miter-limit : 1 for : turn:lanes OR turn:lanes:forward OR turn:lanes:backward define line-color : #000 line-opacity : 0.9 for : lanes=1 define line-width : 15:1.2;16:2.4;17:4.8;18:9.6;19:19.2 draw : line elsefor : lanes=2 define line-width : 15:2.4;16:4.8;17:9.6;18:19.2;19:38.4 for : placement=middle_of:1 define line-offset : 15:0.6;16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : right elsefor : placement=middle_of:2 define line-offset : 15:0.6;16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : left draw : line elsefor : lanes=3 define line-width : 15:3.6;16:7.2;17:14.4;18:28.8;19:57.6 for : placement=middle_of:1 define line-offset : 15:1.2;16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : right elsefor : placement=middle_of:3 define line-offset : 15:1.2;16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : left elsefor : placement=right_of:1 OR left_of:2 define line-offset : 15:0.6;16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : right elsefor : placement=right_of:2 OR left_of:3 define line-offset : 15:0.6;16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : left draw : line elsefor : lanes=4 define line-width : 15:4.8;16:9.6;17:19.2;18:38.4;19:76.8 for : placement=middle_of:1 define line-offset : 15:1.5;16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : right elsefor : placement=middle_of:2 define line-offset : 15:0.6;16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : right elsefor : placement=middle_of:3 define line-offset : 15:0.6;16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : left elsefor : placement=middle_of:4 define line-offset : 15:1.5;16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : left elsefor : placement=right_of:1 OR left_of:2 define line-offset : 15:1.2;16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : right elsefor : placement=right_of:3 OR left_of:4 define line-offset : 15:1.2;16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : left draw : line elsefor : lanes=5 define line-width : 15:6;16:12;17:24;18:48;19:96 for : placement=middle_of:1 define line-offset : 15:2.4;16:4.8;17:9.6;18:19.2;19:38.4 line-offset-sides : right elsefor : placement=middle_of:2 define line-offset : 15:1.2;16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : right elsefor : placement=middle_of:4 define line-offset : 15:1.2;16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : left elsefor : placement=middle_of:5 define line-offset : 15:2.4;16:4.8;17:9.6;18:19.2;19:38.4 line-offset-sides : left elsefor : placement=right_of:1 OR left_of:2 define line-offset : 15:1.5;16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : right elsefor : placement=right_of:2 OR left_of:3 define line-offset : 15:0.6;16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : right elsefor : placement=right_of:3 OR left_of:4 define line-offset : 15:0.6;16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : left elsefor : placement=right_of:4 OR left_of:5 define line-offset : 15:1.5;16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : left draw : line elsefor : lanes=6 define line-width : 15:7.2;16:14.4;17:28.8;18:57.6;19:115.2 for : placement=middle_of:3 define line-offset : 15:0.6;16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : right elsefor : placement=middle_of:4 define line-offset : 15:0.6;16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : left draw : line elsefor : lanes=7 define line-width : 15:8.4;16:16.8;17:33.6;18:67.2;19:134.4 draw : line elsefor : lanes>7 define line-width : 15:9.6;16:19.2;17:38.4;18:76.8;19:153.6 draw : line else // non-numerical or non-integer value of lanes, paint as red define line-color : #a00 line-width : 15:2.4;16:4.8;17:9.6;18:19.2;19:38.4 draw : line // draw lanes define line-color : white line-width : 1 line-opacity : 1 line-offset : 0 line-style : dashlong min-zoom : 16.5 for : lanes=2 for : placement=middle_of:1 define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : right draw : line elsefor : placement=middle_of:2 define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : left draw : line else draw : line elsefor : lanes=3 for : placement=middle_of:1 define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : right draw : line define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : right draw : line elsefor : placement=middle_of:3 define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : left draw : line define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : left draw : line elsefor : placement=right_of:1 OR left_of:2 draw : line define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : right draw : line elsefor : placement=right_of:2 OR left_of:3 draw : line define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : left draw : line else define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : both draw : line elsefor : lanes=4 for : placement=middle_of:2 define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : both draw : line define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : right draw : line elsefor : placement=middle_of:3 define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : both draw : line define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : left draw : line elsefor : placement=right_of:1 OR left_of:2 draw : line define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : right draw : line define line-offset : 16:4.8;17:9.6;18:19.2;19:38.4 line-offset-sides : right draw : line elsefor : placement=right_of:3 OR left_of:4 draw : line define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : left draw : line define line-offset : 16:4.8;17:9.6;18:19.2;19:38.4 line-offset-sides : left draw : line else draw : line define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : both draw : line elsefor : lanes=5 for : placement=right_of:2 OR left_of:3 draw : line define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : both draw : line define line-offset : 16:4.8;17:9.6;18:19.2;19:38.4 line-offset-sides : right draw : line elsefor : placement=right_of:3 OR left_of:4 draw : line define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : both draw : line define line-offset : 16:4.8;17:9.6;18:19.2;19:38.4 line-offset-sides : left draw : line else define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : both draw : line define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : both draw : line elsefor : lanes=6 for : placement=middle_of:3 define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : both draw : line define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : both draw : line define line-offset : 16:6;17:12;18:24;19:48 line-offset-sides : right draw : line elsefor : placement=middle_of:4 define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : both draw : line define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : both draw : line define line-offset : 16:6;17:12;18:24;19:48 line-offset-sides : left draw : line else draw : line define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : both draw : line define line-offset : 16:4.8;17:9.6;18:19.2;19:38.4 line-offset-sides : both draw : line elsefor : lanes=7 define line-offset : 16:1.2;17:2.4;18:4.8;19:9.6 line-offset-sides : both draw : line define line-offset : 16:3.6;17:7.2;18:14.4;19:28.8 line-offset-sides : both draw : line define line-offset : 16:6;17:12;18:24;19:48 line-offset-sides : both draw : line elsefor : lanes>7 draw : line define line-offset : 16:2.4;17:4.8;18:9.6;19:19.2 line-offset-sides : both draw : line define line-offset : 16:4.8;17:9.6;18:19.2;19:38.4 line-offset-sides : both draw : line define line-offset : 16:7.2;17:14.4;18:28.8;19:57.6 line-offset-sides : both draw : line