3 Stylesheet that mimicks, to a certain extent, potlatch 1.x
4 Andy Allan, November 2009
7 MapCSS demonstration stylesheet
8 Richard Fairhurst, October 2009
12 /* This rule applies to all areas (closed ways). Note that rules are applied in the order
13 they appear in the file, so later rules may replace this one for some ways.
14 This is used as a debugger for finding unstyled areas; it's obviously oversimplistic since
15 it picks up closed-loop highways. */
17 way :area { color: red; width: 1; fill-color: red; fill-opacity: 0.5; }
19 /* A set of fairly standard rules.
20 We use z-index to make sure high-priority roads appear above minor ones.
21 The default z-index is 5. If an object matches multiple rules with the same
22 z-index then the rules are "merged" (but individual properties become one or the other) */
24 way[highway=motorway],way[highway=motorway_link],
25 way[highway=trunk],way[highway=trunk_link],
26 way[highway=primary],way[highway=primary_link],
27 way[highway=secondary],way[highway=secondary_link] { text: name; text-color: black; font-size: 7; text-position: line;}
28 way[highway=motorway],way[highway=motorway_link] { z-index: 9; color: #809BC0; width: 7; casing-color: black; casing-width: 8; }
29 way[highway=trunk],way[highway=trunk_link] { z-index: 9; color: #7FC97F; width: 5; casing-color: black; casing-width: 7; }
30 way[highway=primary],way[highway=primary_link] { z-index: 8; color: #E46D71; width: 5; casing-color: black; casing-width: 7; }
31 way[highway=secondary],way[highway=secondary_link] { z-index: 7; color: #FDBF6F; width: 7; casing-width: 8; }
32 way[highway=tertiary],way[highway=unclassified] { z-index: 6; color: #FEFECB; width: 5; casing-width: 7; }
33 way[highway=residential] { z-index: 5; color: #E8E8E8; width: 5; casing-color: gray; casing-width: 7; }
34 way[highway=service] { color: white; width: 3; casing-width: 5; }
36 /* Pedestrian precincts need to be treated carefully. Only closed-loops with an explicit
37 area=yes tag should be filled. The below doesn't yet work as intended. */
38 way[highway=pedestrian] !:area { color: #ddddee; width: 5; casing-color: #555555; casing-width: 6; }
39 way[highway=pedestrian] :area { color: #555555; width: 1; fill-color: #ddddee; fill-opacity: 0.8; }
41 way[highway=footway] { color: #FF6644; width: 2; dashes: 6, 3 }
42 way[highway=bridleway] { z-index:9; color: #996644; width: 2; dashes: 4, 2, 2, 2; }
43 way[highway=track] { color: #996644; width: 2; dashes: 4, 2; }
44 way[highway=path] { color: lightgreen; width: 2; dashes: 2, 2; }
46 way[waterway=river], way[waterway=canal] { color: blue; width: 2; text:name; text-color:blue; font-size:9; text-position: offset; text-offset: 7;}
48 way[barrier] {color: #000000; width: 1}
50 /* Fills can be solid colour or bitmap images */
53 way[natural] :area { color: #ADD6A5; width: 1; fill-color: #ADD6A5; fill-opacity: 0.2; }
54 way[landuse] :area { color: #444444; width: 2; fill-color: #444444; fill-opacity: 0.3; }
55 way[amenity],way[shop] :area { color: #ADCEB5; width: 1; fill-color: #ADCEB5; fill-opacity: 0.2; }
56 way[leisure],way[sport] :area { color: #8CD6B5; width: 1; fill-color: #8CD6B5; fill-opacity: 0.2; }
57 way[tourism] :area { color: #F7CECE; width: 1; fill-color: #F7CECE; fill-opacity: 0.2; }
58 way[historic],way[ruins] :area { color: #F7F7DE; width: 1; fill-color: #F7F7DE; fill-opacity: 0.2; }
59 way[military] :area { color: #D6D6D6; width: 1; fill-color: #D6D6D6; fill-opacity: 0.2; }
60 way[building] :area { color: #ff6ec7; width: 1; fill-color: #ff6ec7; fill-opacity: 0.2; }
62 way[waterway] :area { color: blue; width: 2; fill-color: blue; fill-opacity: 0.2; }
63 way[landuse=forest],way[natural=wood] :area { color: green; width: 2; fill-color: green; fill-opacity: 0.2; }
64 way[leisure=pitch],way[leisure=park] { color: #44ff44; width: 1; fill-color: #44ff44; fill-opacity: 0.2; }
65 way[amenity=parking] :area { color: gray; width: 1; fill-color: gray; fill-opacity: 0.2; }
66 way[public_transport=pay_scale_area] :area { color: gray; width: 1; fill-color: gray; fill-opacity: 0.1; }
68 /* Addressing. Nodes with addresses *and* match POIs should have a poi icon, so we put addressing first */
70 node[addr:housenumber],
71 node[addr:housename] { icon-image: circle; icon-width: 4; color: #B0E0E6; casing-color:blue; casing-width: 1; }
72 way[addr:interpolation] { color: #B0E0E6; width: 3; dashes: 3,3;}
74 /* POIs, too, can have bitmap icons - they can even be transparent */
76 node[amenity=pub] { icon-image: icons/pub.png; text-offset: 7; font-family: DejaVu; text: name; font-size: 9; }
77 node[place] { icon-image: icons/place.png; text-offset: 17; font-family: DejaVu; text: name; font-size: 9; font-weight: bold; text-decoration: underline; }
78 node[railway=station] { icon-image: icons/station.png; text-offset: 13; font-family: DejaVu; text: name; font-size: 9; font-weight: bold; }
79 node[aeroway=aerodrome] { icon-image: icons/airport.png; text-offset: 13; font-family: DejaVu; text: name; font-size: 10; }
80 node[amenity=atm] { icon-image: icons/atm.png; }
81 node[highway=bus_stop] { icon-image: icons/bus_stop.png; }
82 node[amenity=cafe] { icon-image: icons/cafe.png; }
83 node[shop=convenience] { icon-image: icons/convenience.png; }
84 node[amenity=fast_food] { icon-image: icons/fast_food.png; }
85 node[amenity=fire_station] { icon-image: icons/fire_station.png; }
86 node[amenity=hospital] { icon-image: icons/hospital.png; }
87 node[tourism=hotel] { icon-image: icons/hotel.png; }
88 node[amenity=parking] { icon-image: icons/parking.png; }
89 node[amenity=pharmacy] { icon-image: icons/pharmacy.png; }
90 node[amenity=pharmacy][dispensing=yes] { icon-image: icons/pharmacy_dispensing.png; }
91 node[amenity=police] { icon-image: icons/police.png; }
92 node[amenity=post_box] { icon-image: icons/post_box.png; }
93 node[amenity=recycling] { icon-image: icons/recycling.png; }
94 node[amenity=restaurant] { icon-image: icons/restaurant.png; }
95 node[amenity=school] { icon-image: icons/school.png; }
96 node[amenity=taxi] { icon-image: icons/taxi.png; }
97 node[amenity=telephone] { icon-image: icons/telephone.png; }
98 way node[barrier=gate], way node[highway=gate] { icon-image: icons/gate.png; }
100 /* We can stack styles at different z-index (depth) */
103 { z-index: 3; color: black; width: 5; }
104 { z-index: 4; color: white; width: 3; dashes: 12,12; }
106 { z-index: 3; color: #444444; width: 5; }
107 { z-index: 4; color: white; width: 3; dashes: 8,8; }
109 /* Change the road colour based on dynamically set "highlighted" tag (see earlier) */
111 way .highlighted { color: pink; }
113 /* Interactive editors may choose different behaviour when a user mouses-over or selects
114 an object. Potlatch 2 supports these but the stand-alone Halcyon viewer does not */
116 way :hover { z-index: 2; width: eval('_width+10'); color: #ffff99; }
117 way :selected { z-index: 2; width: eval('_width+10'); color: yellow; opacity: 0.7;}
118 way !:drawn { z-index:10; width: 0.5; color: gray; }
120 node :selectedway { z-index: 9; icon-image: square; icon-width: 7; color: red; }
121 node :hoverway { z-index: 9; icon-image: square; icon-width: 7; color: blue; }
122 node !:drawn :poi { z-index: 2; icon-image: circle; icon-width: 4; color: green; casing-color: black; casing-width: 1; }
123 node :selected { z-index: 1; icon-image: square; icon-width: eval('_width+10'); color: yellow; }
125 /* Descendant selectors provide an easy way to style relations: this example means "any way
126 which is part of a relation whose type=route". */
128 relation[type=route] way { z-index: 1; width: 17; color: blue; opacity: 0.3; }