@@ -100,6 +100,36 @@ fn aproximate_speed_limit(s: &str) -> usize {
100
100
}
101
101
}
102
102
103
+ /// get what kind of street it is:
104
+ /* infos from https://wiki.openstreetmap.org/wiki/Key:highway
105
+ 0 = car only
106
+ 1 = car and bicycle
107
+ 2 = bicycle
108
+ 3 = bicycle and pedestrian
109
+ 4 = pedestrian
110
+ 5 = all
111
+ 100 = skip
112
+ */
113
+ fn get_street_kind ( s : & str ) -> usize {
114
+ match s {
115
+ "motorway" | "motorway_link" => return 0 ,
116
+ "trunk" | "trunk_link" => return 0 ,
117
+ "raceway" | "services" | "rest_area" => 0 ,
118
+ "primary" | "primary_link" => return 1 ,
119
+ "secondary" | "secondary_link" => return 1 ,
120
+ "tertiary" | "tertiary_link" => return 1 ,
121
+ "cycleway" => return 2 ,
122
+ "trail" | "track" | "path" => 3 ,
123
+ "elevator" | "platform" | "corridor" => 4 ,
124
+ "bus_stop" | "bridleway" | "steps" | "pedestrian" | "footway" => return 4 ,
125
+ "unclassified" => return 5 ,
126
+ "residential" | "living_street" => return 5 ,
127
+ "service" | "road" => return 5 ,
128
+ "razed" | "abandoned" | "disused" | "construction" | "proposed" => 100 ,
129
+ _ => return 5 ,
130
+ }
131
+ }
132
+
103
133
fn main ( ) {
104
134
let mut ways = Vec :: < Way > :: new ( ) ;
105
135
let mut nodes = Vec :: < Node > :: new ( ) ;
@@ -136,6 +166,10 @@ fn main() {
136
166
for way in groups:: ways ( & group, & block) {
137
167
if way. tags . contains_key ( "highway" ) {
138
168
let highway = way. tags . get ( "highway" ) . unwrap ( ) . trim ( ) ;
169
+ let kind = get_street_kind ( highway) ;
170
+ if kind == 100 {
171
+ continue ;
172
+ }
139
173
let mut max_speed: & str = "" ;
140
174
if way. tags . contains_key ( "maxspeed" ) {
141
175
max_speed = way. tags . get ( "maxspeed" ) . unwrap ( ) . trim ( ) ;
@@ -167,8 +201,7 @@ fn main() {
167
201
target : id,
168
202
speed : speed,
169
203
distance : 0 ,
170
- // TODO add what kind of street it is
171
- kind : 1 ,
204
+ kind : kind,
172
205
} ) ;
173
206
prev_id = id;
174
207
}
0 commit comments