diff --git a/.travis.yml b/.travis.yml index da116e2ac..45029745c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -132,6 +132,7 @@ before_script: - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} -DBUILD_TOOLS=1 script: + - ./scripts/check_taginfo.py taginfo.json profiles/car.lua - make --jobs=2 - make tests --jobs=2 - make benchmarks diff --git a/scripts/check_taginfo.py b/scripts/check_taginfo.py new file mode 100755 index 000000000..04c2b1932 --- /dev/null +++ b/scripts/check_taginfo.py @@ -0,0 +1,51 @@ +#!/usr/bin/python2 + +import json +import sys +import re + +WHITELIST = set(["mph"]) + +if len(sys.argv) < 3: + print "Not enough arguments.\nUsage: " + sys.argv[0] + " taginfo.json profile.lua" + sys.exit(1) + +taginfo_path = sys.argv[1] +profile_path = sys.argv[2] + +taginfo = None +with open(taginfo_path) as f: + taginfo = json.load(f) + +valid_strings = [t["key"] for t in taginfo["tags"]] +valid_strings += [t["value"] for t in taginfo["tags"] if "value" in t] + +string_regxp = re.compile("\"([\d\w\_:]+)\"") + +profile = None +with open(profile_path) as f: + profile = f.readlines() + +n_errors = 0 +for n, line in enumerate(profile): + # ignore comments + if line.strip().startswith("--"): + continue + tokens = set(string_regxp.findall(line)) + errors = [] + for token in tokens: + if token not in WHITELIST and token not in valid_strings: + idx = line.find("\""+token+"\"") + errors.append((idx, token)) + errors = sorted(errors) + n_errors += len(errors) + if len(errors) > 0: + prefix = "%i: " % n + offset = len(prefix) + for idx, token in errors: + sys.stdout.write(prefix + line) + marker = " "*(idx+offset) + "~"*(len(token)+2) + print(marker) + +if n_errors > 0: + sys.exit(1) diff --git a/taginfo.json b/taginfo.json index 17a4f8f24..4ef48de28 100644 --- a/taginfo.json +++ b/taginfo.json @@ -6,13 +6,12 @@ "description": "High-performance routing engine for shortest paths in road networks.", "project_url": "http://project-osrm.org", "icon_url": "http://project-osrm.org/images/osrm_icon.png", - "contact_name": "Dennis Luxen", - "contact_email": "info@project-osrm.org" + "contact_name": "Patrick Niklaus", + "contact_email": "patrick@mapbox.com" }, "tags": [ { "key": "highway", - "description": "Type of road.", "object_types": [ "way" ] }, { @@ -22,6 +21,23 @@ }, { "key": "oneway", + "value": "true", + "object_types": [ "way" ] + }, + { + "key": "oneway", + "value": "1", + "object_types": [ "way" ] + }, + { + "key": "oneway", + "value": "-1", + "object_types": [ "way" ] + }, + { + "key": "oneway", + "value": "reversible", + "description": "is marked as non-routable because of time-dependence", "object_types": [ "way" ] }, { @@ -38,10 +54,127 @@ "key": "status", "description": "This is used by HOT." }, - { - "key": "access", - "object_types": [ "way" ] - }, + {"key": "maxspeed:advisory"}, + {"key": "maxspeed:advisory:forward"}, + {"key": "maxspeed:advisory:backward"}, + {"key": "bridge", "value": "movable", "description": "uses capacity and duration"}, + {"key": "capacity:car", "description": "used for movable bridges"}, + {"key": "side_road", "value": "yes", "description": "gets speed penalty"}, + {"key": "side_road", "value": "rotary", "description": "gets speed penalty"}, + {"key": "route", "object_types": ["way"]}, + {"key": "highway", "value": "traffic_signals", "object_types": ["node"]}, + {"key": "access", "value": "yes"}, + {"key": "access", "value": "motorcar"}, + {"key": "access", "value": "motor_vehicle"}, + {"key": "access", "value": "vehicle"}, + {"key": "access", "value": "permissive"}, + {"key": "access", "value": "designated"}, + {"key": "access", "value": "destination"}, + {"key": "access", "value": "no"}, + {"key": "access", "value": "private"}, + {"key": "access", "value": "agricultural"}, + {"key": "access", "value": "forestry"}, + {"key": "access", "value": "emergency"}, + {"key": "access", "value": "psv"}, + {"key": "access", "value": "delivery"}, + {"key": "maxspeed", "value": "urban"}, + {"key": "maxspeed", "value": "rural"}, + {"key": "maxspeed", "value": "trunk"}, + {"key": "maxspeed", "value": "motorway"}, + {"key": "maxspeed", "value": "ch:rural"}, + {"key": "maxspeed", "value": "ch:trunk"}, + {"key": "maxspeed", "value": "ch:motorway"}, + {"key": "maxspeed", "value": "de:living_street"}, + {"key": "maxspeed", "value": "ru:living_street"}, + {"key": "maxspeed", "value": "ru:urban"}, + {"key": "maxspeed", "value": "ua:urban"}, + {"key": "maxspeed", "value": "at:rural"}, + {"key": "maxspeed", "value": "de:rural"}, + {"key": "maxspeed", "value": "at:trunk"}, + {"key": "maxspeed", "value": "cz:trunk"}, + {"key": "maxspeed", "value": "ro:trunk"}, + {"key": "maxspeed", "value": "cz:motorway"}, + {"key": "maxspeed", "value": "de:motorway"}, + {"key": "maxspeed", "value": "ru:motorway"}, + {"key": "maxspeed", "value": "gb:nsl_single"}, + {"key": "maxspeed", "value": "gb:nsl_dual"}, + {"key": "maxspeed", "value": "gb:motorway"}, + {"key": "maxspeed", "value": "uk:nsl_single"}, + {"key": "maxspeed", "value": "uk:nsl_dual"}, + {"key": "maxspeed", "value": "uk:motorway"}, + {"key": "smoothness", "value": "intermediate"}, + {"key": "smoothness", "value": "bad"}, + {"key": "smoothness", "value": "very_bad"}, + {"key": "smoothness", "value": "horrible"}, + {"key": "smoothness", "value": "very_horrible"}, + {"key": "smoothness", "value": "impassable"}, + {"key": "tracktype", "value": "grade1"}, + {"key": "tracktype", "value": "grade2"}, + {"key": "tracktype", "value": "grade3"}, + {"key": "tracktype", "value": "grade4"}, + {"key": "tracktype", "value": "grade5"}, + {"key": "bollard", "value": "rising"}, + {"key": "bollard", "description": "Non-rising bollards are barriers"}, + {"key": "barrier", "value": "cattle_grid"}, + {"key": "barrier", "value": "border_control"}, + {"key": "barrier", "value": "checkpoint"}, + {"key": "barrier", "value": "toll_booth"}, + {"key": "barrier", "value": "sally_port"}, + {"key": "barrier", "value": "gate"}, + {"key": "barrier", "value": "lift_gate"}, + {"key": "barrier", "value": "no"}, + {"key": "barrier", "value": "entrance"}, + {"key": "highway", "value": "motorway"}, + {"key": "highway", "value": "motorway_link"}, + {"key": "highway", "value": "trunk"}, + {"key": "highway", "value": "trunk_link"}, + {"key": "highway", "value": "primary"}, + {"key": "highway", "value": "primary_link"}, + {"key": "highway", "value": "secondary"}, + {"key": "highway", "value": "secondary_link"}, + {"key": "highway", "value": "tertiary"}, + {"key": "highway", "value": "tertiary_link"}, + {"key": "highway", "value": "unclassified"}, + {"key": "highway", "value": "residential"}, + {"key": "highway", "value": "living_street"}, + {"key": "highway", "value": "service"}, + {"key": "highway", "value": "ferry"}, + {"key": "highway", "value": "movable"}, + {"key": "highway", "value": "shuttle_train"}, + {"key": "highway", "value": "default"}, + {"key": "width", "description": "Penalties for narrow streets"}, + {"key": "lanes", "description": "Penalties for shared single lane streets"}, + {"key": "surface", "value": "asphalt"}, + {"key": "surface", "value": "concrete"}, + {"key": "surface", "value": "concrete:plates"}, + {"key": "surface", "value": "concrete:lanes"}, + {"key": "surface", "value": "paved"}, + {"key": "surface", "value": "cement"}, + {"key": "surface", "value": "compacted"}, + {"key": "surface", "value": "fine_gravel"}, + {"key": "surface", "value": "paving_stones"}, + {"key": "surface", "value": "metal"}, + {"key": "surface", "value": "bricks"}, + {"key": "surface", "value": "grass"}, + {"key": "surface", "value": "wood"}, + {"key": "surface", "value": "sett"}, + {"key": "surface", "value": "grass_paver"}, + {"key": "surface", "value": "gravel"}, + {"key": "surface", "value": "unpaved"}, + {"key": "surface", "value": "ground"}, + {"key": "surface", "value": "dirt"}, + {"key": "surface", "value": "pebblestone"}, + {"key": "surface", "value": "tartan"}, + {"key": "surface", "value": "cobblestone"}, + {"key": "surface", "value": "clay"}, + {"key": "surface", "value": "earth"}, + {"key": "surface", "value": "stone"}, + {"key": "surface", "value": "rocky"}, + {"key": "surface", "value": "sand"}, + {"key": "surface", "value": "mud"}, + {"key": "motorcar"}, + {"key": "motor_vehicle"}, + {"key": "vehicle"}, { "key": "barrier" },