TROBDB Webservices
Zurück zu TROBDB.
Inhaltsverzeichnis
Webservices
General information about API
- Current API version is 'v1'.
- Base URL is http://trobdb.hsr.ch/
- The current API only allows GET (read) requests. Modifying request are not implemented and not allowed.
- Usage policy: restricted use!
Common parameters
- format - Values: 'geojson' (optional)
- key - Values: email adress. Used for simple authentication. Please log in with a valid OpenID once on the main page.
- Status
- geoJSON standard. Nothing else to choose atm.
- Status
Get traffic obstructions
- Description: Returns a traffic obstruction (trobs) as an array of way_id's.
- URL: /gettrafficobstruction
- Method: HTTP GET
- Parameters:
- osmid - Value type: long integer (mandatory) - Description: id of OSM way (positive).
- lat - Latitude as decimal number
- lon - Longtitude as decimal number
- radius - Search radius in Meters
- togeojsonio - If defined, the user is directly linked to geojson.io to see all selected Traffic Obstructions
- Returns:
- HTTP 200 OK - Description: Everything is Ok.
- HTTP 401 Unauthorized - Description: Wrong key?
- HTTP 400 Bad Request - Description: Parameter(s) unknown, parameter(s) not existent, or way_id does not exist.
Examples:
- Request:
GET http://trobdb.hsr.ch/getTrafficObstruction?osmid=4769349
- Response (if success, GeoJSON is default):
{ "type": "FeatureCollection", "features": [{"type": "Feature","properties": { "traffic_obstruction_start": "2013-11-18 21:00:00", "issued": "2013-12-03 09:48:31", "isTunnel": "False", "issuer_name": "truckinfo.ch", "roadNarrow": "3.0", "isCarLoad": "False", "category": "1_31", "traffic_obstruction_end": "2013-12-10 05:00:00", "title": "[Schweiz] Veränderte Verkehrsführung Bern - Zürich", "osm_way_id": "4769349", "isPass": "False", "direction": "as_is", "description": "[Schweiz] Veränderte Verkehrsführung|Bern - Zürich|Zwischen Autobahndreieck Verzweigung Härkingen und Autobahndreieck Verzweigung Wiggertal in beiden Richtungen Veränderte Verkehrsführung, vorübergehende Begrenzung der Breite auf 3.0 Meter, Länge des betroffenen Abschnittes: 9.5 km, Höchstgeschwindigkeit: 80 km/h, Baustelle in der Nacht, Dauer: 18.11.2013 21:00 Uhr bis 10.12.2013 05:00 Uhr|jeweils von 21:00 - 05:00 Uhr|Ohne Nächte von Samstag auf Sonntag und Montag|", "emergency": "", "dbId": "156", "traffic_obstruction_string": "18.11.2013 21:00 Uhr bis 10.12.2013 05:00 Uhr", "AsText(point)": "POINT(8.041345 47.338103)", "sysdate": "2013-12-03 09:49:25", "country": "Schweiz", "AsText(geom)": "LINESTRING(8.04139 47.33722, 8.04137 47.337284, 8.041279 47.337592, 8.041217 47.33778, 8.041101 47.338202, 8.041023 47.33849, 8.040979 47.338724, 8.040963 47.338866, 8.040959 47.339037, 8.041001 47.339491, 8.041056 47.339738, 8.04112 47.339954, 8.041158 47.340038, 8.041203 47.340139, 8.04134 47.340399, 8.041513 47.340739)", "truckInfoImagePath": "mapserver2/symbols/icone36.png", "osm_highway": "primary", "depricated": "False", "road": "A1"},"geometry": {"type": "LineString", "coordinates": [[8.04139, 47.33722], [8.04137, 47.337284], [8.041279, 47.337592], [8.041217, 47.33778], [8.041101, 47.338202], [8.041023, 47.33849], [8.040979, 47.338724], [8.040963, 47.338866], [8.040959, 47.339037], [8.041001, 47.339491], [8.041056, 47.339738], [8.04112, 47.339954], [8.041158, 47.340038], [8.041203, 47.340139], [8.04134, 47.340399], [8.041513, 47.340739]]}}
]}
- Request:
GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1
- Response (if success, GeoJSON is default):
{ "type": "FeatureCollection", "features": [{"type": "Feature","properties": { "traffic_obstruction_start": "2013-10-07 08:00:00", "issued": "2013-12-03 09:48:31", "isTunnel": "False", "issuer_name": "truckinfo.ch", "roadNarrow": "7.5", "isCarLoad": "False", "category": "1_27", "traffic_obstruction_end": "2013-12-06 15:30:00", "title": "[Schweiz] Fahrbahn auf zwei Fahrstreifen verengt Zürich - St. Gallen", "osm_way_id": "111719161", "isPass": "False", "direction": "as_is", "description": "[Schweiz] Fahrbahn auf zwei Fahrstreifen verengt|Zürich - St. Gallen|Zwischen Autobahndreieck Verzweigung Brüttisellen und AS Effretikon in beiden Richtungen Fahrbahn auf zwei Fahrstreifen verengt, vorübergehende Begrenzung der Breite auf 7.5 Meter, Baustelle, Länge des betroffenen Abschnittes: 5.7 km, Höchstgeschwindigkeit: 100 km/h, Dauer: 07.10.2013 08:00 Uhr bis 06.12.2013 15:30 Uhr|(Jeweils 08.00 - 15.30 Uhr)|", "emergency": "", "dbId": "150", "traffic_obstruction_string": "07.10.2013 08:00 Uhr bis 06.12.2013 15:30 Uhr", "AsText(point)": "POINT(8.694355 47.44315)", "sysdate": "2013-12-03 09:49:25", "country": "Schweiz", "AsText(geom)": "LINESTRING(8.679411 47.430628, 8.679523 47.43102, 8.679756 47.431906, 8.679864 47.432333, 8.679982 47.432754, 8.680167 47.433362, 8.68029 47.433726, 8.680388 47.433995, 8.680495 47.434263, 8.680617 47.434537, 8.680749 47.434808, 8.680886 47.435067, 8.681033 47.435326, 8.681162 47.435529, 8.681299 47.435731, 8.681473 47.435965, 8.681655 47.436198, 8.681876 47.436457, 8.682104 47.436714, 8.682298 47.436913, 8.682497 47.437109, 8.682806 47.437382, 8.682956 47.437521, 8.683117 47.437654, 8.683412 47.437884, 8.683716 47.438107, 8.684035 47.438324, 8.684358 47.438536, 8.684658 47.438716, 8.684964 47.438894, 8.685314 47.439087, 8.685669 47.439271, 8.686042 47.43946, 8.686421 47.439646, 8.687107 47.439961, 8.687649 47.440209, 8.688187 47.440446, 8.689403 47.440969, 8.690609 47.441504, 8.691256 47.441805, 8.691892 47.442121, 8.692301 47.442342, 8.692613 47.442511, 8.692937 47.442693, 8.693161 47.442827, 8.69338 47.442963, 8.6939 47.443303, 8.694401 47.443681, 8.694854 47.444056, 8.695093 47.444257, 8.695378 47.444522, 8.695647 47.444791, 8.695872 47.445036, 8.696093 47.445282, 8.696278 47.445507, 8.696452 47.445735, 8.696794 47.446189, 8.697361 47.44697, 8.697935 47.447695)", "truckInfoImagePath": "mapserver2/symbols/icone35.png", "osm_highway": "motorway", "depricated": "False", "road": "A1"},"geometry": {"type": "LineString", "coordinates": [[8.679411, 47.430628], [8.679523, 47.43102], [8.679756, 47.431906], [8.679864, 47.432333], [8.679982, 47.432754], [8.680167, 47.433362], [8.68029, 47.433726], [8.680388, 47.433995], [8.680495, 47.434263], [8.680617, 47.434537], [8.680749, 47.434808], [8.680886, 47.435067], [8.681033, 47.435326], [8.681162, 47.435529], [8.681299, 47.435731], [8.681473, 47.435965], [8.681655, 47.436198], [8.681876, 47.436457], [8.682104, 47.436714], [8.682298, 47.436913], [8.682497, 47.437109], [8.682806, 47.437382], [8.682956, 47.437521], [8.683117, 47.437654], [8.683412, 47.437884], [8.683716, 47.438107], [8.684035, 47.438324], [8.684358, 47.438536], [8.684658, 47.438716], [8.684964, 47.438894], [8.685314, 47.439087], [8.685669, 47.439271], [8.686042, 47.43946], [8.686421, 47.439646], [8.687107, 47.439961], [8.687649, 47.440209], [8.688187, 47.440446], [8.689403, 47.440969], [8.690609, 47.441504], [8.691256, 47.441805], [8.691892, 47.442121], [8.692301, 47.442342], [8.692613, 47.442511], [8.692937, 47.442693], [8.693161, 47.442827], [8.69338, 47.442963], [8.6939, 47.443303], [8.694401, 47.443681], [8.694854, 47.444056], [8.695093, 47.444257], [8.695378, 47.444522], [8.695647, 47.444791], [8.695872, 47.445036], [8.696093, 47.445282], [8.696278, 47.445507], [8.696452, 47.445735], [8.696794, 47.446189], [8.697361, 47.44697], [8.697935, 47.447695]]}}
,{"type": "Feature","properties": { "traffic_obstruction_start": "2013-05-30 14:00:00", "issued": "2013-12-03 09:48:31", "isTunnel": "False", "issuer_name": "truckinfo.ch", "roadNarrow": "4.3", "isCarLoad": "False", "category": "1_27", "traffic_obstruction_end": "2014-07-22 14:00:00", "title": "[Schweiz] Veränderte Verkehrsführung Zürich Richtung St. Gallen", "osm_way_id": "111719161", "isPass": "False", "direction": "as_is", "description": "[Schweiz] Veränderte Verkehrsführung|Zürich Richtung St. Gallen|Zwischen AS Wallisellen und AS Effretikon Veränderte Verkehrsführung, vorübergehende Begrenzung der Breite auf 4.3 Meter, Dauerbaustelle, Länge des betroffenen Abschnittes: 1.3 km, Höchstgeschwindigkeit: 60 km/h, Dauer: 30.05.2013 14:00 Uhr bis 22.07.2014 14:00 Uhr|", "emergency": "", "dbId": "152", "traffic_obstruction_string": "30.05.2013 14:00 Uhr bis 22.07.2014 14:00 Uhr", "AsText(point)": "POINT(8.694355 47.44315)", "sysdate": "2013-12-03 09:49:25", "country": "Schweiz", "AsText(geom)": "LINESTRING(8.679411 47.430628, 8.679523 47.43102, 8.679756 47.431906, 8.679864 47.432333, 8.679982 47.432754, 8.680167 47.433362, 8.68029 47.433726, 8.680388 47.433995, 8.680495 47.434263, 8.680617 47.434537, 8.680749 47.434808, 8.680886 47.435067, 8.681033 47.435326, 8.681162 47.435529, 8.681299 47.435731, 8.681473 47.435965, 8.681655 47.436198, 8.681876 47.436457, 8.682104 47.436714, 8.682298 47.436913, 8.682497 47.437109, 8.682806 47.437382, 8.682956 47.437521, 8.683117 47.437654, 8.683412 47.437884, 8.683716 47.438107, 8.684035 47.438324, 8.684358 47.438536, 8.684658 47.438716, 8.684964 47.438894, 8.685314 47.439087, 8.685669 47.439271, 8.686042 47.43946, 8.686421 47.439646, 8.687107 47.439961, 8.687649 47.440209, 8.688187 47.440446, 8.689403 47.440969, 8.690609 47.441504, 8.691256 47.441805, 8.691892 47.442121, 8.692301 47.442342, 8.692613 47.442511, 8.692937 47.442693, 8.693161 47.442827, 8.69338 47.442963, 8.6939 47.443303, 8.694401 47.443681, 8.694854 47.444056, 8.695093 47.444257, 8.695378 47.444522, 8.695647 47.444791, 8.695872 47.445036, 8.696093 47.445282, 8.696278 47.445507, 8.696452 47.445735, 8.696794 47.446189, 8.697361 47.44697, 8.697935 47.447695)", "truckInfoImagePath": "mapserver2/symbols/icone36.png", "osm_highway": "motorway", "depricated": "False", "road": "A1"},"geometry": {"type": "LineString", "coordinates": [[8.679411, 47.430628], [8.679523, 47.43102], [8.679756, 47.431906], [8.679864, 47.432333], [8.679982, 47.432754], [8.680167, 47.433362], [8.68029, 47.433726], [8.680388, 47.433995], [8.680495, 47.434263], [8.680617, 47.434537], [8.680749, 47.434808], [8.680886, 47.435067], [8.681033, 47.435326], [8.681162, 47.435529], [8.681299, 47.435731], [8.681473, 47.435965], [8.681655, 47.436198], [8.681876, 47.436457], [8.682104, 47.436714], [8.682298, 47.436913], [8.682497, 47.437109], [8.682806, 47.437382], [8.682956, 47.437521], [8.683117, 47.437654], [8.683412, 47.437884], [8.683716, 47.438107], [8.684035, 47.438324], [8.684358, 47.438536], [8.684658, 47.438716], [8.684964, 47.438894], [8.685314, 47.439087], [8.685669, 47.439271], [8.686042, 47.43946], [8.686421, 47.439646], [8.687107, 47.439961], [8.687649, 47.440209], [8.688187, 47.440446], [8.689403, 47.440969], [8.690609, 47.441504], [8.691256, 47.441805], [8.691892, 47.442121], [8.692301, 47.442342], [8.692613, 47.442511], [8.692937, 47.442693], [8.693161, 47.442827], [8.69338, 47.442963], [8.6939, 47.443303], [8.694401, 47.443681], [8.694854, 47.444056], [8.695093, 47.444257], [8.695378, 47.444522], [8.695647, 47.444791], [8.695872, 47.445036], [8.696093, 47.445282], [8.696278, 47.445507], [8.696452, 47.445735], [8.696794, 47.446189], [8.697361, 47.44697], [8.697935, 47.447695]]}}
]}
- Request:
GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1&togeojsonio
- Response Forward to geojson.io:
Datenstruktur
"Traffic Obstruction DB":
Tabelle/Record "trobdb_line":
geom: LINESTRING NOT_NULL -- MANDATORY gesperrte Richtung, d.h. Reihenfolge der Stüzpunkte relevant!). id: INTEGER NULL -- OPT. id der Quell-Datenbank (und dort UNIQUE NOT_NULL). title: TEXT*100 NOT_NULL -- MANDATORY description: TEXT NUL_NULL -- MANDATORY traffic_obstruction_start: DATETIME NOT_NULL -- MANDATORY traffic_obstruction_end: DATETIME NOT_NULL -- MANDATORY traffic_obstruction_string: TEXT NULL -- OPT. Intervall-Zeitangabe im 'opening hours'-Format(vgl. Bemerkungen). emergency: BOOLEAN NULL -- OPT. Rettungs-Fz können trotzdem durchfahren. direction: ENUM NOT_NULL -- MANDATORY ENUM(as_is,reverse,both directions) diversion_advice: TEXT NULL -- OPT. (NEU) Umfahrungsempfehlung, insbes. falls sie signalisiert ist. issued: DATETIME NULL -- MANDATORY Datum von demjenigen, von dem die Meldung kam (=> OpenID Email?). country: TEXT(2) NOT_NULL -- MANDATORY country name (mehrheitlich "CH"). category: ENUM NOT_NULL -- MANDATORY (NEU) ENUM(event,construction,unknown). type: ENUM NOT_NULL -- MANDATORY (NEU) ENUM(street,tunnel,car_transport,pass,other).
sysdate: DATETIME NOT_NULL -- MANDATORY Datum der Erfassung dieser Info. issuer_name: TEXT NULL -- MANDATORY Name desjenigen, von dem die Meldung kam. road_ref: TEXT NULL -- OPT. road name reference (e.g. A1). osm_way_id: BIGINTEGER NULL -- OPT. OSM way id vom Matching (nur bei trobdb_line) osm_highway: TEXT NULL -- OPT. Wert des highway-Tags, z.B. motorway, footway (nur bei trobdb_line) is_tunnel: BOOLEAN NOT_NULL -- MANDATORY from truckinfo text (NOTE: change to ENUM OPT.?) is_car_transport: BOOLEAN NOT_NULL -- MANDATORY Evaluated from truckinfo text (NOTE: change to ENUM?) is_pass: BOOLEAN NOT_NULL -- MANDATORY Evaluated from truckinfo text (NOTE: change to ENUM?) truckinfoimagepath: TEXT NULL -- OPT. imagepath on truckinfo Server
Tabelle/Record "trobdb_area":
geometry: MultiPolygon -- gesperrte Fläche, z.B. bei Dorfkern-Sperrungen ... -- ditto wie "trobdb_line" without osm_highway and osm_way_id osm_way_id_list -- all osm_ways matching to st_intersects with the polygondata
Tabelle/Record "trobdb_poi":
geometry: Point -- gesperrter Punkt, z.B. Pässe/Tunnel/Autoverlade ... -- ditto wie "trobdb_line" without osm_highway and osm_way_id
Bemerkungen:
- Intervall-Zeitangaben ("Behinderungszeiten", Öffnungszeiten, Betriebszeiten):
- Definition OSM: http://wiki.openstreetmap.org/wiki/DE:Key:opening_hours
- Demo (inkl. Source Code): http://robin.de.marissa.hostorama.ch/osm/opening_hours.js/demo.html