| 1 |
|
| 2 |
[[FILES]] |
| 3 |
= The structure of a style = |
| 4 |
|
| 5 |
A style consists of a number of files in a single directory. The best way |
| 6 |
is to start out with an existing style that is close to what you want and |
| 7 |
then work from there. |
| 8 |
|
| 9 |
A style can be packed into a single file using the standard zip utilities |
| 10 |
that are available on every operating system, or it can be written as one |
| 11 |
large text file using the single file style format. These alternatives |
| 12 |
are explained in <<style-packaging,making a style package>>. |
| 13 |
|
| 14 |
== Files == |
| 15 |
These files are read in the order that they are listed here. In general, files that are read first take priority over files read later. |
| 16 |
The only one of these files that is actually required is the +version+ |
| 17 |
file, as that is used to recognise the style. |
| 18 |
At least one of the +points+, +lines+ or +polygons+ files must be present |
| 19 |
or else the resulting maps will be empty. |
| 20 |
|
| 21 |
=== Top level folder === |
| 22 |
Choose a short name for your style, it should be one word or a couple of words joined by an underscore or hyphen. This is how people will refer to the style when it is finished. |
| 23 |
Create a directory or folder with that name. Then you must create one or |
| 24 |
more files in this directory as detailed below. Only the +version+ file is required. |
| 25 |
|
| 26 |
== The version file |
| 27 |
This file _must_ exist as it is used to recognise a valid style. |
| 28 |
It contains the version number of the style language itself, (not the |
| 29 |
version number of your style, which you can specify in the +info+ file |
| 30 |
if you so wish). |
| 31 |
The current version number of the style language is 1. |
| 32 |
Make sure that there is a new line after the number, place an empty line afterwards to be sure. |
| 33 |
|
| 34 |
== The info file |
| 35 |
This file contains information about your style. |
| 36 |
It is all optional information, and there is only really any point |
| 37 |
adding this information if you are going to distribute your style, or |
| 38 |
you have more than one style that you maintain. |
| 39 |
|
| 40 |
The file consists of key=value pairs in the same syntax as the |
| 41 |
command line option file. To summarise you can use either an equal sign |
| 42 |
'=' or a colon ':' to separate the key from the value. You can also |
| 43 |
surround the value with curly braces '{ }' and this allows you to |
| 44 |
write the value over several lines. |
| 45 |
|
| 46 |
[horizontal] |
| 47 |
version:: The version number of your style. |
| 48 |
|
| 49 |
summary:: A short description of your style in one line. |
| 50 |
|
| 51 |
description:: A longer description of your style. |
| 52 |
|
| 53 |
base-style:: Do not use anymore. This was used to base a style on |
| 54 |
another one. However, it is bug prone and behaves in a way that is not |
| 55 |
intuitive without a good understanding of how things work. |
| 56 |
The preferred way to do this is to use the include mechanism. |
| 57 |
This command will be removed altogether at some point in the future. |
| 58 |
|
| 59 |
.An example info file |
| 60 |
==== |
| 61 |
Here is an example based on the +info+ file from the default style. |
| 62 |
You can see it uses both equal and colon as separators, normally you |
| 63 |
would just pick one and use it consistently, but it doesn't make any |
| 64 |
difference which one you use. |
| 65 |
The description is written over several lines surrounded in curly |
| 66 |
braces. |
| 67 |
Lines beginning with a hash symbol '#' are comments and are ignored. |
| 68 |
---- |
| 69 |
# |
| 70 |
# This file contains information about the style. |
| 71 |
# |
| 72 |
|
| 73 |
summary: The default style |
| 74 |
|
| 75 |
version=1.0 |
| 76 |
|
| 77 |
description { |
| 78 |
The default style. This is a heavyweight style that is |
| 79 |
designed for use when mapping and especially in lightly covered |
| 80 |
areas. |
| 81 |
} |
| 82 |
---- |
| 83 |
==== |
| 84 |
|
| 85 |
|
| 86 |
== The options file |
| 87 |
This file contains a number of options that should be set for this style |
| 88 |
as if they were set on the command line. |
| 89 |
Only command line options that affect the style will have any effect. |
| 90 |
The current list is +levels+, +overview-levels+, and +extra-used-tags+. |
| 91 |
|
| 92 |
It is advisable to set up the levels that you want, as the default is not |
| 93 |
suitable for all kinds of maps and may change in the future. Ideally, |
| 94 |
you should set the same levels as are used in your style files. For |
| 95 |
example, if your style files use levels 12,16,20,22,23,24 then it's a |
| 96 |
good idea to make sure your options style file declares these levels |
| 97 |
explicitly. |
| 98 |
|
| 99 |
.An example options file |
| 100 |
==== |
| 101 |
levels = 0:24, 1:22, 2:20, 3:18 |
| 102 |
overview-levels = 4:17, 5:16, 6:15, 7:14, 8:12 |
| 103 |
extra-used-tags= |
| 104 |
==== |
| 105 |
|
| 106 |
=== Non command line options |
| 107 |
Most of the options are the same as the command line option of the same |
| 108 |
name and so you should see its description in the option help. |
| 109 |
There are however some options that can only be set in this file |
| 110 |
(just the currently). |
| 111 |
|
| 112 |
extra-used-tags:: A list of tags used by the style. You do not normally |
| 113 |
need to set this, as mkgmap can work out which tags are used by a style |
| 114 |
automatically in most cases. It exists only to work around cases where |
| 115 |
this doesn't work properly. |
| 116 |
|
| 117 |
== The points file |
| 118 |
This files contains a set of rules for converting |
| 119 |
OSM nodes to Garmin POIs (restaurants, bars, ATMs etc). |
| 120 |
It can also contain rules for some kind of OSM nodes that may |
| 121 |
affect routing behavior, for example barriers, traffic_calming, traffic_signals, etc. |
| 122 |
|
| 123 |
If this file is not present or empty then there will be no POI's in the |
| 124 |
final map. |
| 125 |
|
| 126 |
The syntax of the file is described in the <<RULES,style rules section>>. |
| 127 |
Like all other files, a hash symbol '#' introduces a comment. |
| 128 |
|
| 129 |
== The lines file |
| 130 |
This file contains a set of rules for converting OSM ways to Garmin lines (roads, rivers, barriers, etc). |
| 131 |
The syntax of the file is described in the <<RULES,style rules section>>. |
| 132 |
|
| 133 |
== The polygons file |
| 134 |
This file contains a set of rules for converting polygons to Garmin |
| 135 |
areas (fields, buildings, residential areas, etc). |
| 136 |
The syntax of the file is described in the <<RULES,style rules section>>. |
| 137 |
|
| 138 |
== The relations file |
| 139 |
This file contains a set of rules to convert OSM relations. |
| 140 |
Unlike the +points+, +lines+ and +polygons+ files this file does not lead |
| 141 |
directly to a Garmin object. |
| 142 |
Instead it is used to modify the ways or nodes that are contained in the |
| 143 |
relation. |
| 144 |
|
| 145 |
So for example, if the relation represents a route, then you might add one |
| 146 |
or more tags to all the ways that make up the route so that they can be |
| 147 |
processed in the +lines+ file specially. |
| 148 |
|
| 149 |
The syntax of the file is also described in the <<RULES,style rules section>>, |
| 150 |
but the rules can only have an action part, they must not have a type |
| 151 |
description part. |
| 152 |
|
| 153 |
//// |
| 154 |
== The overlays file |
| 155 |
The idea of this file |
| 156 |
Used where you want a single way to be converted to two ways in the output map (for example a road might be rendered as normal but an additional line is created if the road is oneway - this then allows you to use a TYP file to add oneway arrows to the road). An example of use might be: |
| 157 |
|
| 158 |
In the lines file: |
| 159 |
----- |
| 160 |
highway=trunk & oneway=yes [0x123 road_class=3 road_speed=5 resolution 16] |
| 161 |
----- |
| 162 |
|
| 163 |
In the overlays file: |
| 164 |
---- |
| 165 |
0x123: 0x02, 0x23 |
| 166 |
---- |
| 167 |
|
| 168 |
Then set the TYP file contain arrows for code 0x23. |
| 169 |
|
| 170 |
Note that only the first way in the overlays file is routable. |
| 171 |
//// |