Changes between Version 1 and Version 2 of Help/Styles/MapCSSTutorial
- Timestamp:
- 2011-02-10T15:15:25+01:00 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Help/Styles/MapCSSTutorial
v1 v2 2 2 3 3 === Example 1 === 4 {{{ 4 5 {{{#!html 6 <table width="100%"> 7 <tr> 8 <td valign="top"> 9 <pre class="wiki"> 5 10 node[amenity=restaurant] 6 11 { … … 8 13 text: auto; 9 14 } 10 }}} 11 15 </pre> 16 </td> 17 <td align="right" valign="top" width="100%"><img src="/raw-attachment/wiki/Help/MapStyles/MapCSSTutorial/example01.png" /></td> 18 </tr> 19 </table> 20 }}} 12 21 This draws a restaurant icon and a text label for each node that is tagged {{{amenity=restaurant}}}. The image can be specified in one of the following forms: 13 22 * absolute path … … 18 27 19 28 === Example 2 === 20 {{{ 29 {{{#!html 30 <table width="100%"> 31 <tr> 32 <td valign="top"> 33 <pre class="wiki"> 21 34 way[highway=residential] 22 35 { … … 24 37 color: lightgray; 25 38 } 26 }}} 39 </pre> 40 </td> 41 <td align="right" valign="top" width="100%"><img src="/raw-attachment/wiki/Help/MapStyles/MapCSSTutorial/example02.png" /></td> 42 </tr> 43 </table> 44 }}} 27 45 Here we have all residential roads drawn in lightgray and with line width 4 px. Color can be given in one of the followin formats: 28 46 * named color as found in [http://www.w3.org/TR/css3-color/#svg-color this] list … … 31 49 32 50 === Example 3 === 33 {{{ 51 {{{#!html 52 <table width="100%"> 53 <tr> 54 <td valign="top"> 55 <pre class="wiki"> 34 56 way[highway=living_street] 35 57 { … … 45 67 font-color: lightyellow; 46 68 } 69 </pre> 70 </td> 71 <td align="right" valign="top" width="100%"><img src="/raw-attachment/wiki/Help/MapStyles/MapCSSTutorial/example03.png" /></td> 72 </tr> 73 </table> 47 74 }}} 48 75 In the first part of the declarations, we define a dash pattern of gray and green. Leave out the {{{dashes-background-color}}} to display a broken line with no color in between the dashes. … … 51 78 52 79 === Example 4 === 53 54 {{{ 80 {{{#!html 81 <table width="100%"> 82 <tr> 83 <td valign="top"> 84 <pre class="wiki"> 55 85 area[building] 56 86 { 57 87 fill-color: orange; 58 88 } 89 </pre> 90 </td> 91 <td align="right" valign="top" width="100%"><img src="/raw-attachment/wiki/Help/MapStyles/MapCSSTutorial/example04.png" /></td> 92 </tr> 93 </table> 59 94 }}} 60 95 … … 63 98 === Example 5 === 64 99 65 {{{ 100 {{{#!html 101 <table width="100%"> 102 <tr> 103 <td valign="top"> 104 <pre class="wiki"> 66 105 area[landuse=forest], area[natural=wood] 67 106 { 68 107 fill-image: "http://trac.openstreetmap.org/export/25265/applications/rendering/mapnik/symbols/forest.png"; 69 108 fill-opacity: 0.8; 109 110 text: auto; 111 text-position: center; 70 112 } 113 </pre> 114 </td> 115 <td align="right" valign="top" width="100%"><img src="/raw-attachment/wiki/Help/MapStyles/MapCSSTutorial/example05.png" /></td> 116 </tr> 117 </table> 71 118 }}} 72 119 73 This shows, how you can list multiple selectors for one rule. We fill the area with a pattern, if it is tagged {{{landuse=forest}}} or {{{natural=wood}}}. The opacity is set to 0.8, where 1.0 means opaque and 0.0 is fully transparent. You can set opacity, whenever a color or an image is defined. E.g. {{{icon-opacity}}} for {{{icon-image}}} and {{{opacity}}} for {{{color}}}. 120 This shows, how you can list multiple selectors for one rule. We fill the area with a pattern, if it is tagged {{{landuse=forest}}} or {{{natural=wood}}}. The opacity is set to 0.8, where 1.0 means opaque and 0.0 is fully transparent. You can set opacity, whenever a color or an image is defined. E.g. {{{icon-opacity}}} for {{{icon-image}}} and {{{opacity}}} for {{{color}}}. A label for the object is placed in the the center of the area. 74 121 75 122