source: subversion/rendering/osmarender4/README @ 2486

Last change on this file since 2486 was 2288, checked in by etienne, 13 years ago

Support for frolloized osm files.

File size: 4.6 KB
Line 
1
2            Osmarender - a SVG renderer for OpenStreetMap
3                        ---------------------------------------------
4
5Osmarender is a rule based rendering tool for generating SVG images of OSM
6data.
7
8It takes as its input an OpenStreetMap dataset and a rules file. It outputs
9an SVG image that is marked up in accordance with the styles defined in the
10rule file.
11
12For more information on Osmarender, see the wiki page:
13        http://wiki.openstreetmap.org/index.php/Osmarender
14
15For guidance on getting the best out of Osmarender, picking the options
16to use with it etc, see the following wiki pages:
17        http://wiki.openstreetmap.org/index.php/Osmarender#Tricks.2C_tips_and_hints
18
19
20CALLING OSMARENDER
21------------------
22
23On Linux you can call Osmarender through the osmarender shell wrapper. See
24the comments at the beginning for instruction on how to call this.
25
26
27RULES
28-----
29
30Osmarender rules files contain two kinds of element; rules and instructions.
31Rule elements provide a simple selection mechanism.  Instructions define what
32to do with the elements that match the rules.
33
34See the rules directory for some rule files. For normal maps use
35rules/standard.xml.
36
37Rules are simple filters based on elements, keys and values (the e, k and v
38attributes).  For example:
39
40    <rule e="way" k="highway" v="motorway">...</rule>
41
42will select all ways that have a key of highway with a value of motorway.
43Rules can be nested to provide a logical "and".  For example:
44
45    <rule e="way" k="highway" v="primary">
46        <rule e="way" k="abutters" v="retail">
47        ...
48        </rule>
49    </rule>
50
51would select all ways that are primary roads *and* abutted by retail premises.
52
53Each filter attribute can contain a | separated list of values.  For example
54e="node|way" will match all nodes and all ways.  k="highway|waterway" will
55match all elements with a key of highway or waterway. v="primary|secondary"
56will match all elements that have key values equal to primary or secondary.
57
58    k="*" means all keys.
59    k="~" means no keys.
60    v="*" means all values.
61    v="~" means no value.
62       
63Instructions define what to do with the elements that match the rules.
64Typically, they render the element in some way by generating an svg commandto
65draw a line or circle etc.  In most cases the attributes of the instruction are
66copied to the corresponding svg command.  For example:
67
68    <line stroke-width="10"/>
69
70will generate a corresponding svg command to draw a line with a width of 10px.
71
72The following instructions can be used:
73
74    <line>     - draw a line
75    <area>     - draw an area
76    <circle>   - draw a circle
77    <text>     - write some text
78    <symbol>   - draw an icon or image
79    <layer>    - start a new SVG layer (see below)
80    <addclass> - add SVG classes to child elements
81
82
83SVG Layers
84----------
85
86Osmarender creates a few default layers in your SVG file for the map, border,
87etc. Inkscape for instance shows them in the layers dialog and allows them
88to be switched on and off. You can add your own layers in the rule file by
89adding a <layer/> element like this:
90
91    <rule e="node" k="amenity" v="*">
92        <layer name="Amenities">
93            <rule e="node" k="amenity" v="telephone">
94                ...
95            </rule>
96            ...
97        </layer>
98    </rule>
99
100The name attribute on the layer element is a descriptive name used as the
101label for the layer. You can also use the display and opacity attributes:
102
103    <layer name="..." display="none"/>  Display of this layer is switched
104                                        off by default
105
106    <layer name="..." opacity="0.5"/>   Layer opacity is 50%.
107
108Don't confuse this with OSM layers set by the "layer" key!
109
110
111The <addclass/> element
112-----------------------
113
114You can use the <addclass/> element to add SVG classes to all its child
115elements. This is usefor for things like oneways, so that you can write
116your rules more concisely. Example:
117
118<addclass e="way" k="oneway" v="1|yes|true" class="oneway">
119    <addclass e="way" k="oneway" v="-1" class="otherway">
120
121        <rule e="way" k="highway" v="unclassified">
122            <line class="xyz"/>
123        </rule>
124        ...
125
126    </addclass>
127</addclass>
128
129If there is an unclassified road which is also a oneway, it will get
130classes "xyz" and "oneway".
131
132
133DEVELOPING OSMARENDER
134---------------------
135
136If you want to change the inner workings of Osmarender, change the files
137in the src directory and call 'make' to regenerate the 'osmarender.xsl'
138file from the source files. It uses xmllint to pull all files together.
139As a "side effect" xmllint checks your XML syntax, too. If you don't have
140xmllint, you can use any other XML tool that understands xinclude.
141
142
Note: See TracBrowser for help on using the repository browser.