Debian Codegraph @

resources/styles/default/lines

raw
1 # -------------------------------------------------------------------
2 # This is the default mkgmap style file for converting OSM ways
3 # into Garmin lines.
4 # Any line prefaced with # is a comment and will not be applied.
5 # Each line is a rule, of the generalised format:
6 # OSM_tag(s)_to_match [Garmin_type_code resolution]
7 # See http://wiki.openstreetmap.org/wiki/Mkgmap/help/style_rules
8 # and http://wiki.openstreetmap.org/wiki/Mkgmap/help/Custom_styles
9 # for more information.
10
11 addr:housenumber=* {set mkgmap:execute_finalize_rules=true}
12
13 abandoned=yes {deletealltags} # old, depreciated, ambiguous, method of handling abandoned
14
15 # do these as lines regardless of being closed unless explicity marked as area. continue in case also a highway
16 aeroway=runway & area!=yes {name '${ref}'} [0x27 resolution 20 continue]
17 (aeroway=taxiway | aeroway=taxilane) & area!=yes {name '${ref}'} [0x27 resolution 24 continue]
18
19 # Assign the street name for house number search
20 highway=* & name=* {set mkgmap:street='${name}'}
21
22 # Mark highways with the toll flag
23 highway=* & (toll=yes | toll=true) {set mkgmap:toll=yes}
24
25 # Hide proposed ways
26 highway=proposed | highway=proposal | highway=planned | highway~'.*proposed.*' {delete highway; delete junction}
27 # Hide removed ways
28 highway=razed | highway=dismantled | highway=disused | highway=demolished {delete highway; delete junction}
29 # Hide abandoned ways. Abandoned highways have some evidence of their former existence but are no longer used. These
30 # abandoned highways could be useful in topographical maps.
31 # https://wiki.openstreetmap.org/wiki/Key:abandoned:
32 (abandoned:highway=* & (highway!=* | highway=yes)) | highway=abandoned {delete highway; delete junction}
33 # Hide other non-existent ways
34 highway=unbuilt | highway=neverbuilt | highway=rejected | highway~'x-.*' {delete highway; delete junction}
35 # Remove highway tag from ways which are not suitable for routing
36 highway=traffic_signals | highway=junction | highway=island | highway=centre_line | highway=traffic_island | highway=stopline |
37 highway=bus_stop | highway=bus_guideway | highway=emergency_access_point | highway=ohm:military:Trench
38 {delete highway}
39 highway=via_ferrata {delete highway} # this shouldn't show as routable on default map: path only for specialists
40 highway=piste | highway=ski {delete highway}
41 highway=no | highway=none {delete highway}
42
43 # Disable dead-end-checks for unaccessible oneways
44 highway=* & oneway=yes & (access=private | access=no) {add mkgmap:dead-end-check=false}
45 # Validation-like checks (uncomment to enable)
46 #highway=motorway_link & oneway!=yes & oneway!=no {echo "motorway_link lacks oneway"}
47 highway=motorway | highway=motorway_link {add oneway=yes; add mkgmap:numbers=false}
48
49 # start of rules for process-exits and process-destination options
50 # which may add info to a part of these highway=*_link roads:
51 # motorway_link, trunk_link, primary_link, secondary_link, tertiary_link
52 # build destination hint
53 mkgmap:dest_hint=* {
54 set tmp:dest_hint='${destination:ref|subst: =>} ${mkgmap:dest_hint|subst:;=> |subst:/=> }' |
55 '${ref|subst: =>} ${mkgmap:dest_hint|subst:;=> |subst:/=> }' |
56 '${mkgmap:dest_hint|subst:;=> |subst:/=> }';
57 }
58 # build exit hint
59 mkgmap:exit_hint=true {
60 set tmp:exit_hint='Exit ${mkgmap:exit_hint_ref} ${mkgmap:exit_hint_name}' |
61 'Exit ${mkgmap:exit_hint_ref} ${mkgmap:exit_hint_exit_to}' |
62 'Exit ${mkgmap:exit_hint_exit_to}' |
63 'Exit ${mkgmap:exit_hint_name}' |
64 'Exit ${mkgmap:exit_hint_ref}';
65 }
66 # use destination hint and/or exit hint to build name
67 mkgmap:exit_hint=true | mkgmap:dest_hint=* {name '${tmp:exit_hint} ${tmp:dest_hint}' | '${tmp:dest_hint}' | '${tmp:exit_hint}'}
68 # end of rules for process-exits and process-destination options
69
70 # Flag paved roads
71 highway=* & (surface=asphalt | surface=paved | surface=sett |
72 surface=concrete | surface=concrete:lanes | surface=concrete:plates |
73 surface=paving_stones | surface=cobblestone |
74 surface=cobblestone:flattened | surface=metal | surface=wood | surface=chipseal)
75 {set mkgmap:unpaved=0}
76 highway=* & tracktype=grade1 & surface!=* {set mkgmap:unpaved=0}
77
78 # Flag unpaved roads.
79 highway=* & mkgmap:unpaved!=0 & (
80 surface=* |
81 mtb:scale=* |
82 tracktype~'grade[2-6]')
83 {add mkgmap:unpaved=1}
84 highway=* & (
85 mtb:scale~'[2-6].' |
86 sac_scale~'.*(mountain|alpine)_hiking' |
87 sport=via_ferrata)
88 {set mkgmap:unpaved=1}
89 (highway=bridleway | highway=path | highway=track) & mkgmap:unpaved!=0 {add mkgmap:unpaved=1}
90 (highway=unsurfaced | highway=via_ferrata) {set mkgmap:unpaved=1}
91
92 highway=* & mkgmap:unpaved!=1 & smoothness~'.*(bad|horrible|impassable)' {add mkgmap:road-speed=-2}
93
94 # Good ways without relation
95 highway=* & mkgmap:fast_road!=* & (int_ref=* | network=e-road | network=AH | network=TAH | network=US:I | network=US:US)
96 {add mkgmap:fast_road=yes}
97 # Not best for car routing
98 highway=* & (access=hov | hov=designated | oneway=reversible)
99 {set mkgmap:road-class=-2; set mkgmap:road-speed=-2; delete mkgmap:fast_road}
100
101 # convert some specific to generic with restrictions (platform is in a bus station)
102 highway=steps | highway=corridor | highway=stepping_stones | highway=elevator | highway=escalator | highway=platform
103 {set highway=footway; add bicycle=no}
104 # virtual seems to be a way across a pedestrian area
105 highway=crossing | highway=virtual
106 {set highway=path} # following logic may change
107
108 # Convert generic path to most specific
109 highway=path & (designation=permissive_bridleway | designation=public_bridleway)
110 {set highway=bridleway; add foot=yes}
111 highway=path & (designation=permissive_footpath | designation=public_footpath)
112 {set highway=footway; add foot=designated}
113 highway=path & snowplowing!=no & (bicycle=designated | bicycle=permissive | bicycle=official | cycleway=lane)
114 {set highway=cycleway; add foot=yes}
115 highway=path & foot=designated
116 {set highway=footway}
117
118 leisure=track & area!=yes {name '${name} (${sport})' | '${sport}'} [0x30 resolution 22]
119 man_made=pier | man_made=piste:halfpipe {add highway=footway; name '${ref} ${name}' | '${ref}' | '${name}'}
120
121 man_made=breakwater & is_closed()=false & mkgmap:mp_created!=true [0x17 resolution 22 default_name 'Breakwater']
122
123 # Roundabouts
124 junction=roundabout & (highway=trunk | highway=trunk_link) [0x0c road_class=4 road_speed=2 resolution 24 continue]
125 junction=roundabout & (highway=trunk | highway=trunk_link) [0x10801 resolution 18]
126
127 junction=roundabout & (highway=primary | highway=primary_link) & mkgmap:fast_road=yes [0x0c road_class=4 road_speed=2 resolution 24 continue]
128 junction=roundabout & (highway=primary | highway=primary_link) & mkgmap:fast_road=yes [0x10802 resolution 19]
129
130 junction=roundabout & (highway=primary | highway=primary_link) [0x0c road_class=3 road_speed=2 resolution 24 continue]
131 junction=roundabout & (highway=primary | highway=primary_link) [0x10802 resolution 19]
132
133 junction=roundabout & (highway=secondary | highway=secondary_link) & mkgmap:fast_road=yes [0x0c road_class=3 road_speed=2 resolution 24 continue]
134 junction=roundabout & (highway=secondary | highway=secondary_link) & mkgmap:fast_road=yes [0x10803 resolution 20]
135
136 junction=roundabout & (highway=secondary | highway=secondary_link) [0x0c road_class=2 road_speed=2 resolution 24 continue]
137 junction=roundabout & (highway=secondary | highway=secondary_link) [0x10803 resolution 20]
138
139 junction=roundabout & (highway=tertiary | highway=tertiary_link) [0x0c road_class=1 road_speed=1 resolution 24 continue]
140 junction=roundabout & (highway=tertiary | highway=tertiary_link) [0x10804 resolution 21]
141
142 junction=roundabout & (highway=unclassified | highway=minor) [0x0c road_class=1 road_speed=1 resolution 21]
143 junction=roundabout & highway=* [0x0c road_class=0 road_speed=1 resolution 22]
144
145 # Ways that may or may not be useable
146
147 # Treat ways under construction almost as highway=path, see also extra rule in inc/access
148 highway=construction {add mkgmap:dead-end-check=false} [0x16 road_class=0 road_speed=0 resolution 23]
149
150 # Lower the road speed of ways under some construction.
151 highway=* & construction=* & maxspeed!=* {add mkgmap:road-speed='-1'}
152 # Lower the road speed of disused ways.
153 highway=* & disused=yes & maxspeed!=* {add mkgmap:road-speed='-2'}
154
155 # Ways sorted roughly by descending order of class
156 highway=motorway & mkgmap:fast_road=yes [0x01 road_class=4 road_speed=7 resolution 14]
157 highway=motorway [0x01 road_class=4 road_speed=7 resolution 15]
158 highway=motorway_link & (mkgmap:exit_hint=true | mkgmap:dest_hint=*) [0x0b road_class=4 road_speed=2 resolution 20]
159 highway=motorway_link [0x09 road_class=4 road_speed=2 resolution 20]
160
161 highway=trunk & mkgmap:fast_road=yes [0x02 road_class=4 road_speed=5 resolution 15]
162 highway=trunk [0x02 road_class=4 road_speed=5 resolution 18]
163 highway=trunk_link & (mkgmap:exit_hint=true | mkgmap:dest_hint=*) [0x0b road_class=4 road_speed=2 resolution 20]
164 highway=trunk_link [0x09 road_class=4 road_speed=2 resolution 20]
165 highway=* & motorroad=yes [0x02 road_class=4 road_speed=4 resolution 18]
166 highway=primary & mkgmap:fast_road=yes [0x03 road_class=4 road_speed=4 resolution 17]
167 highway=primary [0x03 road_class=3 road_speed=4 resolution 19]
168 highway=primary_link & (mkgmap:exit_hint=true | mkgmap:dest_hint=*) & mkgmap:fast_road=yes [0x0b road_class=4 road_speed=1 resolution 21]
169 highway=primary_link & (mkgmap:exit_hint=true | mkgmap:dest_hint=*) [0x0b road_class=3 road_speed=1 resolution 21]
170 highway=primary_link & mkgmap:fast_road=yes [0x08 road_class=4 road_speed=1 resolution 21]
171 highway=primary_link [0x08 road_class=3 road_speed=1 resolution 21]
172 highway=secondary & mkgmap:fast_road=yes [0x04 road_class=3 road_speed=3 resolution 18]
173 highway=secondary [0x04 road_class=2 road_speed=3 resolution 20]
174 highway=secondary_link & mkgmap:fast_road=yes [0x08 road_class=3 road_speed=1 resolution 22]
175 highway=secondary_link [0x08 road_class=2 road_speed=1 resolution 22]
176 highway=tertiary [0x05 road_class=1 road_speed=3 resolution 20]
177 highway=tertiary_link [0x08 road_class=1 road_speed=1 resolution 22]
178 highway=minor [0x06 road_class=1 road_speed=3 resolution 21]
179 highway=unclassified [0x06 road_class=0 road_speed=3 resolution 21]
180
181 highway=yes {set highway=footway} # fix common bad tagging - little bits of path to join other routable ways
182
183 # Some countries allow, others disallow bicycling on pedestrian streets. See inc/access_country
184
185 # highway=pedestrian could be closed polygon to represent a 'square', add route regardless and continue for polygon processing
186 highway=pedestrian {set tmp:stopMopUp=yes} [0x16 road_class=0 road_speed=0 resolution 22 continue with_actions]
187
188 highway=living_street [0x06 road_class=0 road_speed=1 resolution 22]
189 highway=residential [0x06 road_class=0 road_speed=2 resolution 22]
190 highway=bridleway [0x07 road_class=0 road_speed=0 resolution 23]
191 highway=byway [0x16 road_class=0 road_speed=0 resolution 23]
192
193 highway=driveway {set highway=service; add service=driveway} # fix common bad tagging
194 highway=access {set highway=service} # fix common bad tagging
195 highway=access_ramp {set highway=footway} # proposed
196
197 highway=service & service=parking_aisle [0x07 road_class=0 road_speed=1 resolution 24]
198 highway=service & (service=alley | service=driveway) [0x07 road_class=0 road_speed=0 resolution 23]
199 highway=service [0x07 road_class=0 road_speed=2 resolution 22]
200
201 highway=cycleway [0x11 road_class=0 road_speed=1 resolution 23]
202
203 # highway=footway is often an area as well, continue for polygon processing
204 highway=footway {set tmp:stopMopUp=yes} [0x16 road_class=0 road_speed=0 resolution 23 continue with_actions]
205
206 highway=trail {set highway=path; add bicycle=no} # fix common bad tagging
207
208 highway=path [0x16 road_class=0 road_speed=0 resolution 23]
209 highway=track [0x0a road_class=0 road_speed=1 resolution 22]
210 highway=unsurfaced [0x0a road_class=0 road_speed=1 resolution 22]
211 highway=road {add mkgmap:dead-end-check=false} [0x06 road_class=0 road_speed=1 resolution 22]
212
213 # handle some rarer bits of road. Do just in case joining paths or bits of one-way roads
214 highway=turning_loop | highway=turning_circle | highway=layby | highway=escape | highway=emergency_bay
215 [0x07 road_class=0 road_speed=0 resolution 24]
216
217 # These are too specialized to have routing, so shouldn't drop into the mop-up, but, maybe needing TYP, can be shown on the map
218 highway=raceway | highway=gallop {add name='${highway}'} [0x30 resolution 23]
219
220 # Don't have routable for either of these:
221 # most 'rest_area' don't connect to the main road
222 # 'services' is normally a big area that covers the whole complex
223 highway=rest_area | highway=services {set tmp:stopMopUp=yes}
224
225 # Mop up any unrecognised highway types
226 #highway=* & tmp:stopMopUp!=yes {echotags 'mop-up highway'} # mostly actual road names
227 # It is considered best not to process unrecognised highway types
228 #highway=* & area!=yes & tmp:stopMopUp!=yes [0x07 road_class=0 road_speed=0 resolution 23]
229
230 # Showing the coastline adds almost nothing visuals of the map, so it's disabled:
231 #natural=coastline [0x15 resolution 12]
232 power=line [0x29 resolution 21]
233
234 railway=platform & tmp:stopMopUp!=yes [0x16 road_class=0 road_speed=0 resolution 23]
235 # Railway lines, note that many devices display type 0x14 only at resolution 24
236 (railway=rail | railway=tram | railway=disused | railway=subway | railway=narrow_gauge | railway=light_rail | railway=preserved) & !(tunnel=yes)
237 [0x14 resolution 22]
238
239 (man_made=cable | (man_made=* & man_made~'.*pipe.*')) & area!=yes & tunnel!=yes & location!=underground
240 {name '${name} (${operator})' | '${name}' | '${operator}'} [0x28 resolution 23]
241
242 # The following boundary styles are after the highway rules because ways
243 # are frequently tagged with both and we want the highway to take priority.
244 boundary=administrative {name '${mkgmap:boundary_name}'}
245 boundary=administrative & admin_level<3 [0x1e resolution 12]
246 boundary=administrative & admin_level<5 [0x1d resolution 19]
247 boundary=administrative & admin_level<7 [0x1c resolution 21]
248 boundary=administrative & admin_level<9 [0x1c resolution 22]
249 boundary=administrative [0x1c resolution 22]
250 boundary=national [0x1e resolution 17]
251 boundary=political [0x1c resolution 19]
252
253 barrier=wall | barrier=fence | barrier=hedge | barrier=ditch {add name='${barrier|subst:"_=> "}'} [0x17 resolution 24]
254
255 route=ferry & (toll=no | toll=false) {set mkgmap:toll=no}
256 route=ferry {set mkgmap:numbers=false; set mkgmap:ferry=1; add mkgmap:toll=yes}
257 route=ferry & (motorcar=no | motor_vehicle=no) [0x1b road_class=0 road_speed=0 resolution 23]
258 route=ferry [0x1a road_class=3 road_speed=0 resolution 19]
259
260 (waterway=river | waterway=stream | waterway=rapids | waterway=waterfall) {add mkgmap:has-direction=true}
261 (waterway=river | waterway=canal) & intermittent=yes [0x26 resolution 20]
262 (waterway=stream | waterway=drain) & intermittent=yes [0x26 resolution 22]
263
264 waterway=canal [0x1f resolution 21]
265 waterway=river [0x1f resolution 18]
266 waterway=rapids|waterway=waterfall [0x1f resolution 22]
267 waterway=stream | waterway=drain [0x18 resolution 22]
268
269 # mop up any remaining water lines
270 waterway=* & waterway!=no & (area=no | (is_closed()=false & mkgmap:mp_created!=true))
271 {add name='${waterway|subst:"_=> "}'} [0x26 resolution 24]
272
273 include 'inc/contour_lines';
274
275 <finalize>
276 # The finalizer section is executed for each element when a rule with an element type matches
277
278 include 'inc/address';
279 # calculate the road speed based on maxspeed tag
280 include 'inc/roadspeed';
281 # calculate the access rules
282 include 'inc/access';
283
284 #limit artificial cycleways to resolution 24
285 mkgmap:synthesised=yes & mkgmap:bicycle=yes {set mkgmap:highest-resolution-only=true}
286
287 # don't add house numbers to unnamed or artifical bicycle ways
288 mkgmap:bicycle=yes & (mkgmap:foot=no & mkgmap:car=no & mkgmap:street!=* | mkgmap:synthesised=yes) {set mkgmap:numbers=false}
289
290 # Display highway shield for mayor roads if they have a ref and make them searchable by their name
291 (highway=motorway | highway=trunk) & ref=* {name '${ref|highway-symbol:hbox}'; addlabel '${name}'}
292 highway=primary & ref=* {name '${ref|highway-symbol:box}' ; addlabel '${name}'}
293 (highway=secondary | highway=tertiary) & ref=* {name '${ref|highway-symbol:oval}'; addlabel '${name}'}
294
295 name=* {name '${name}'}
296 highway=* & ref=* & highway!=motorway & highway!=trunk & highway!=primary & highway!=secondary & highway!=tertiary
297 {addlabel '${ref}'}
298
299 highway=* & int_ref=* {addlabel '${int_ref}'}
300 highway=* & nat_ref=* {addlabel '${nat_ref}'}
301 highway=* & reg_ref=* {addlabel '${reg_ref}'}