Changes between Version 9 and Version 13 of Help/Styles/MapCSSTutorial
- Timestamp:
- (multiple changes)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Help/Styles/MapCSSTutorial
v9 v13 11 11 node[amenity=restaurant] 12 12 { 13 icon-image: "food/restaurant. png";13 icon-image: "presets/food/restaurant.svg"; 14 14 text: auto; 15 15 } … … 20 20 </table> 21 21 }}} 22 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:22 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: 23 23 * absolute path 24 24 * URL 25 25 * a path relative to the current *.mapcss file 26 * relative path that revers to a build-in image (see Example 1). The {{{josm-tested.jar}}}file is a simple zip archive; you can extract it and use all files from the{{{images}}}folder.27 The declaration '''{{{text: auto;}}}'''tells JOSM to derive the text for the label automatically. At time of writing, the following tags are searched and the first one that is found will be used: "{{{name:}}}"+''<LANG>'', "{{{name}}}", "{{{int_name}}}", "{{{ref}}}", "{{{operator}}}", "{{{brand}}}" and "{{{addr:housenumber}}}". You can also pick a specific tag e.g. '''{{{text: "cuisine";}}}'''.26 * relative path that revers to a build-in image (see Example 1). The `josm-tested.jar` file is a simple zip archive; you can extract it and use all files from the `images` folder. 27 The declaration **`text: auto;`** tells JOSM to derive the text for the label automatically. At time of writing, the following tags are searched and the first one that is found will be used: "`name:`"+''<LANG>'', "`name`", "`int_name`", "`ref`", "`operator`", "`brand`" and "`addr:housenumber`". You can also pick a specific tag e.g. **`text: "cuisine";`**. 28 28 29 29 === Example 2 === … … 46 46 Here we have all residential roads drawn in lightgray and with line width 4 px. Color can be given in one of the following formats: 47 47 * named color as found in [http://www.w3.org/TR/css3-color/#svg-color this] list 48 * html style: '''{{{#ff0000}}}'''49 * '''{{{rgb(0.0, 1.0 , 0.2)}}}'''- rgb value with arguments from 0.0 to 1.048 * html style: **`#ff0000`** 49 * **`rgb(0.0, 1.0 , 0.2)`** - rgb value with arguments from 0.0 to 1.0 50 50 51 51 === Example 3 === … … 74 74 </table> 75 75 }}} 76 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.76 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. 77 77 78 In the second part, the name of the street ( '''{{{text: "name";}}}''') will be displayed along the line ('''{{{text-position: line;}}}''') with a vertical offset of 9 px. An offset of 0 would render the text on top of the line.78 In the second part, the name of the street (**`text: "name";`**) will be displayed along the line (**`text-position: line;`**) with a vertical offset of 9 px. An offset of 0 would render the text on top of the line. 79 79 80 80 === Example 4 === … … 95 95 }}} 96 96 97 The '''{{{area}}}'''type selector acts on ways and multipolygon relations. The condition'''{{{[building]}}}'''applies to all objects that have the key{{{building}}}set to any value. Note that the outline of the building is painted as well, although we haven't specified any line properties. This is because JOSM will always draw at least one line element for each way. If no line properties are found, a default line element is generated.97 The **`area`** type selector acts on ways and multipolygon relations. The condition **`[building]`** applies to all objects that have the key `building` set to any value. Note that the outline of the building is painted as well, although we haven't specified any line properties. This is because JOSM will always draw at least one line element for each way. If no line properties are found, a default line element is generated. 98 98 99 99 === Example 5 === … … 119 119 }}} 120 120 121 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 center of the area.121 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 center of the area. 122 122 123 ----124 123 125 See also: the [[Help/Styles/MapCSSImplementation|JOSM implementation reference]] lists the supported mapcss features in more detail. 124 == See also == 125 * the [wikitr:/Help/Styles/MapCSSImplementation JOSM implementation reference] lists the supported mapcss features in more detail. 126 * the [wikitr:/Help/Validator/MapCSSTagChecker tagchecker] uses much of these features.
