Skip to content

Commit ebe44ee

Browse files
committed
Allow km/h as maxspeed unit.
1 parent ef480c8 commit ebe44ee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/TagFix_Maxspeed_AT.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ def way(self, data, tags, nds):
142142
return err
143143

144144
# Error: maxspeed not numeric or 'walk'
145+
if maxspeed.endswith(' km/h'):
146+
maxspeed = maxspeed[:-5]
145147
if not maxspeed.isdigit() and maxspeed != 'walk':
146148
return {'class': 2, 'text': T_('Invalid maxspeed: `{0}`', maxspeed)}
147149

@@ -203,7 +205,7 @@ def test(self):
203205
# No error if valid
204206
assert not plugin.way(None, {'highway': 'primary'}, None)
205207

206-
assert not plugin.way(None, {'highway': 'primary', 'maxspeed': '100'}, None)
208+
assert not plugin.way(None, {'highway': 'primary', 'maxspeed': '100 km/h'}, None)
207209

208210
assert not plugin.way(None, {'highway': 'living_street', 'maxspeed': 'walk'}, None)
209211

@@ -224,6 +226,8 @@ def test(self):
224226
# Error when maxspeed not numeric or walk
225227
self.check_err(plugin.way(None, {'highway': 'tertiary', 'maxspeed': 'fast'}, None))
226228

229+
self.check_err(plugin.way(None, {'highway': 'tertiary', 'maxspeed': '70 mph'}, None))
230+
227231
# Error when maxspeed too low
228232
self.check_err(plugin.way(None, {'highway': 'residential', 'maxspeed': '5'}, None))
229233

0 commit comments

Comments
 (0)