barefoot
barefoot copied to clipboard
Support modification of speed limit extraction
OSM maps for UK occassionally use integers for speed limits in MPH. Also, some roads have textual limits like "national". To handle these properly, it is useful to be able to simply modify the code that interprets the OSM maxspeed tags. For presentation purposes it can also be useful to allow represention of the speed limit in the database in MPH.
To simplify modification of the map ingest to support such modifications, this patch separates the interpretation of the speed limit string into a separate function extract_speed_limit
.
In addition, the patch:
- supports speed limits with no space between the number and "mph"
- replaces the hard-wired path in one test with a generated path
- adds an
__init__.py
file to allow testing to be run usingpython -m unittest discover
from thetools
directory - cleans up some minor PEP8 style issues
The patch does not actually support the UK-specific cleanups or use of MPH. Those changes need to be added separately (and other national variations may exist).