initial packaging
[routino] / doc / html / configuration.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <HTML>
3
4 <!--
5  Routino documentation - configuration
6
7  Part of the Routino routing software.
8
9  This file Copyright 2008-2010 Andrew M. Bishop
10
11  This program is free software: you can redistribute it and/or modify
12  it under the terms of the GNU Affero General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  GNU Affero General Public License for more details.
20
21  You should have received a copy of the GNU Affero General Public License
22  along with this program.  If not, see http://www.gnu.org/licenses/.
23 -->
24
25 <HEAD>
26 <TITLE>Routino : Configuration</TITLE>
27 <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
28 <LINK href="style.css" type="text/css" rel="stylesheet">
29 </HEAD>
30
31 <BODY>
32
33 <!-- Header Start -->
34
35 <div class="header" align="center">
36
37 <h1>Routino : Configuration</h1>
38
39 <hr>
40 </div>
41
42 <!-- Header End -->
43
44 <!-- Content Start -->
45
46 <div class="content">
47
48 <h2><a name="H_1_1"></a>XML Configuration Files</h2>
49
50 New in version 1.4 of Routino are the use of configuration files to allow more
51 information to be provided to the programs at run-time.  The configuration files
52 that are used are:
53 <ul>
54   <li>Tagging transformation rules for the <em>planetsplitter</em> program.
55   <li>Routing profiles for the <em>router</em> program.
56   <li>Output translations for the <em>router</em> program.
57 </ul>
58
59 In keeping with the nature of the input and output files the configuration files
60 are also XML files.  Each of the files uses a custom defined XML schema and an
61 XSD file is provided for each of them.
62
63 <h3><a name="H_1_1_1" title="Tagging rules"></a>Tag Transformation Rules</h3>
64
65 The default name of the tagging transformation rules XML configuration file
66 is <em>tagging.xml</em> in the same directory as the generated database files.
67 Other filenames can be specified on the command line using
68 the <tt>--tagging</tt> option.  When processing the input it is possible to have
69 a different set of tagging rules for each file; for example different rules for
70 different countries.
71
72 <p>
73
74 The tagging rules allow modifying the highway tags in the source file so that
75 the routing can be performed on a simpler set of tags.  This removes the special
76 case tagging rules from the source code into the configuration file where they
77 can be easily modified.  Part of the provided tagging.xml file showing the rules
78 for motorway_link and motorway highway types.
79
80 <pre class="boxed">
81 &lt;?xml version="1.0" encoding="utf-8"?&gt;
82 &lt;routino-tagging&gt;
83
84   &lt;way&gt;
85
86     &lt;if k="highway" v="motorway_link"&gt;
87       &lt;set v="motorway"/&gt;
88     &lt;/if&gt;
89
90     &lt;if k="highway" v="motorway"&gt;
91       &lt;output k="highway"/&gt;
92
93       &lt;output k="motorbike"  v="yes"/&gt;
94       &lt;output k="motorcar"   v="yes"/&gt;
95       &lt;output k="goods"      v="yes"/&gt;
96       &lt;output k="hgv"        v="yes"/&gt;
97       &lt;output k="psv"        v="yes"/&gt;
98
99       &lt;output k="paved"      v="yes"/&gt;
100       &lt;output k="multilane"  v="yes"/&gt;
101       &lt;output k="oneway"     v="yes"/&gt;
102     &lt;/if&gt;
103 ...
104   &lt;way&gt;
105
106 &lt;/routino-tagging&gt;
107 </pre>
108
109 The rules all have the same format; an <em>if</em> element for matching the
110 input and some <em>set</em> or <em>output</em> elements to either change the
111 input tags or create an output tag.  The <em>k</em> and <em>v</em> attributes
112 have the same meaning as the attributes with the same names in the OSM XML file
113 - the tag key and tag value.
114
115 <p>
116
117 An <em>if</em> rule that has both <em>k</em> and <em>v</em> specified is only
118 applied if a tag exists in the input that matches both.  An <em>if</em> rule
119 that has only the <em>k</em> attribute is applied if a tag with that key exists
120 and an <em>if</em> rule that has only the <em>v</em> attribute is applied to all
121 tags with that value.
122
123 <p>
124
125 For the <em>set</em> and <em>output</em> elements the tag that is created in the
126 input or output tag set uses the <em>k</em> and <em>v</em> attributes specified.
127 If one or both are not specified then the original ones are used.
128
129
130 <h3><a name="H_1_1_2" title="Profiles"></a>Routing Profiles</h3>
131
132 The default name of the routing profiles XML configuration file
133 is <em>profiles.xml</em> in the same directory as the database files.  Other
134 filenames can be specified on the command line using the <tt>--tagging</tt>
135 option.
136
137 <p>
138
139 The purpose of this configuration file is to allow easy modification of the
140 routing parameters so that they do not all need to be specified on the command
141 line.  In versions of Routino before version 1.4 the default routing parameters
142 (preferred highways, preferred speeds etc) were contained in the source code,
143 now they are in a configuration file.  When calculating a route
144 the <tt>--profile</tt> option selects the named profile from the configuration
145 file.
146
147 <p>
148
149 Part of the provided profiles.xml file showing the parameters for transport on
150 foot is shown below:
151
152 <pre class="boxed">
153 &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
154 &lt;routino-profiles&gt;
155
156   &lt;profile name="foot" transport="foot"&gt;
157     &lt;speeds&gt;
158 ...
159       &lt;speed highway="cycleway"      kph="4" /&gt;
160       &lt;speed highway="path"          kph="4" /&gt;
161       &lt;speed highway="steps"         kph="4" /&gt;
162     &lt;/speeds&gt;
163     &lt;preferences&gt;
164 ...
165       &lt;preference highway="cycleway"      percent="95" /&gt;
166       &lt;preference highway="path"          percent="100" /&gt;
167       &lt;preference highway="steps"         percent="80" /&gt;
168     &lt;/preferences&gt;
169     &lt;properties&gt;
170       &lt;property type="paved"      percent="50" /&gt;
171       &lt;property type="multilane"  percent="25" /&gt;
172       &lt;property type="bridge"     percent="50" /&gt;
173       &lt;property type="tunnel"     percent="50" /&gt;
174     &lt;/properties&gt;
175     &lt;restrictions&gt;
176       &lt;oneway obey="0" /&gt; 
177       &lt;weight limit="0.0" /&gt;
178       &lt;height limit="0.0" /&gt;
179       &lt;width  limit="0.0" /&gt;
180       &lt;length limit="0.0" /&gt;
181     &lt;/restrictions&gt;
182   &lt;/profile&gt;
183   &lt;profile name="horse" transport="horse"&gt;
184 ...
185   &lt;/profile&gt;
186 ...
187 &lt;/routino-profiles&gt;
188 </pre>
189
190
191 <h3><a name="H_1_1_3" title="Translations"></a>Output Translations</h3>
192
193 The default name of the output translations XML configuration file
194 is <em>translations.xml</em> in the same directory as the database files.  Other
195 filenames can be specified on the command line using the <tt>--translations</tt>
196 option.
197
198 <p>
199
200 The generated HTML and GPX output files (described in the next section) are
201 created using the fragments of text that are defined in this file.  Additional
202 languages can be added to the file and are selected using
203 the <tt>--language</tt> option to the router.  If no language is specified the
204 first one in the file is used.
205
206 <p>
207
208 Part of the provided translations.xml file showing some of the English language
209 (en) translations is shown below:
210
211 <pre class="boxed">
212 &lt;?xml version="1.0" encoding="utf-8"?&gt;
213 &lt;routino-translations&gt;
214
215   &lt;language lang="en"&gt;
216 ...
217     &lt;turn direction="-4" string="Very sharp left" /&gt;
218     &lt;turn direction="-3" string="Sharp left" /&gt;
219     &lt;turn direction="-2" string="Left" /&gt;
220 ...
221     &lt;heading direction="-4" string="South" /&gt;
222     &lt;heading direction="-3" string="South-West" /&gt;
223     &lt;heading direction="-2" string="West" /&gt;
224 ...
225     &lt;route type="shortest" string="Shortest" /&gt;
226     &lt;route type="quickest" string="Quickest" /&gt;
227     &lt;output-html&gt;
228 ...
229     &lt;/output-html&gt;
230     &lt;output-gpx&gt;
231 ...
232     &lt;/output-gpx&gt;
233   &lt;/language&gt;
234 &lt;/routino-translations&gt;
235 </pre>
236
237 </div>
238
239 <!-- Content End -->
240
241 <!-- Footer Start -->
242
243 <div class="footer" align="center">
244 <hr>
245
246 <address>
247 &copy; Andrew M. Bishop = &lt;amb "at" gedanken.demon.co.uk&gt;
248 </address>
249
250 </div>
251
252 <!-- Footer End -->
253
254 </BODY>
255
256 </HTML>