File: relations

package info (click to toggle)
mkgmap 0.0.0%2Bsvn4905-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 12,032 kB
  • sloc: java: 73,856; xml: 1,695; python: 713; sh: 240; makefile: 149; perl: 31
file content (130 lines) | stat: -rw-r--r-- 4,098 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# -------------------------------------------------------------------
# This is the default mkgmap style file for applying rules on
# OSM relations.  Usually you will set tags on the
# elements that make up the relation, and the tags will be
# processed by the rules defined in the "points" or "lines" files.
#
# Any line prefaced with # is a comment and will not be applied.
# Each line is a rule, of the generalised format:
#  OSM_tag(s)_to_match  [Garmin_type_code resolution]
# See http://wiki.openstreetmap.org/wiki/Mkgmap/help/style_rules
# and http://wiki.openstreetmap.org/wiki/Mkgmap/help/Custom_styles
# for more information.

# Names of administrative boundaries.
# We could want to sort the relations in ascending order of admin_level
# and alphabetically by name first.
# Currently, the matching relations will be processed and the names
# appended to the boundary lines in an arbitrary order.

(type=boundary | type=multipolygon) & boundary=administrative & name=*
{ apply
  {
    set mkgmap:boundary_name='$(mkgmap:boundary_name)/${name}' | '${name}';
  }
}

# Public transportation routes.
# We could want to sort the matching relations by ref first.
type=route
& (route=bus|route=trolleybus|route=ferry|route=subway|route=train|route=tram)
& (ref=* | name=*)
{
  add ref='${name}'; # if ref is missing, use name
  # Append the ref of the route relation to the route_ref attribute of
  # the member nodes recursively (even to members of subrelations).
  # Stops can be grouped within subrelations comprising the vehicle
  # stop node and the passenger wait node.
  apply { # node role ~ '(start_|end_)stop'
		set route_ref='$(route_ref);${ref|not-contained:;:route_ref}' | '$(route_ref)' | '${ref}';
    # In route relations, stops may be defined as relations that group
    # the passenger wait area and the vehicle stop area.  If such
    # subrelations exist, copy the ref to them too.
    set mkgmap:relref='${ref}';

    apply role=passengers {
      set route_ref='$(route_ref),${mkgmap:relref}' | '${mkgmap:relref}';
    }

    delete mkgmap:relref;
  }
  # We could want to copy the route relation name to unnamed route=ferry ways.
  # apply way { add name='${name}' }
}

# European E-Road network
route=road & network=e-road {
	apply {
		add ref='${ref}';
		add int_ref='${int_ref}';
		add network='e-road';
        add mkgmap:fast_road=yes;
	}
}

#USA road network
type=route & route=road & historic!=yes & network=US:I
{
    apply {
        set mkgmap:us_interstate='$(mkgmap:us_interstate);${ref|not-contained:;:mkgmap:us_interstate}' | '$(mkgmap:us_interstate)' | '${ref}';
        add network='US:I';
        add mkgmap:fast_road=yes;
    }
}
type=route & route=road & historic!=yes & network~'US:I:.*'
{
    apply {
        add network='US:I';
        add mkgmap:fast_road=yes;
    }
}
type=route & route=road & historic!=yes & network=US:US
{
    apply {
        set mkgmap:us_usroute='$(mkgmap:us_usroute);${ref|not-contained:;:mkgmap:us_usroute}' | '$(mkgmap:us_usroute)' | '${ref}';
        add network='US:US';
        add mkgmap:fast_road=yes;
    }
}
type=route & route=road & historic!=yes & network~'US:US:.*'
{
    apply {
        add network='US:US';
        add mkgmap:fast_road=yes;
    }
}
type=route & route=road & historic!=yes & network~'US:.*' & !(network=US:I | network=US:US | network~'US:.*:.*')
{
    apply {
        add mkgmap:us_state='$(mkgmap:us_state);${ref|not-contained:;:mkgmap:us_state}' | '$(mkgmap:us_state)' | '${ref}';
        add network='${network}';
    }
}

#Trans African Highway
type=route & route=road & historic!=yes & (network~'TAH.*' | ref~'TAH.*' | network~'Trans.African Highway')
{
    apply {
        add network='TAH';
        add int_ref='${ref}';
        add mkgmap:fast_road=yes;
    }
}

#Asian Highway
type=route & route=road & historic!=yes & (network=AsianHighway | network=AH)
{
    apply {
        add network='AsianHighway';
        add int_ref='${ref}';
        add mkgmap:fast_road=yes;
    }
}

#any highway
type=route & route=road & historic!=yes & ref=*
{
    apply {
        add ref='${ref}';
    }
}