TROBDB Webservices: Unterschied zwischen den Versionen

Aus Geoinformation HSR
Wechseln zu: Navigation, Suche
K (Datenstruktur)
(Zugriff)
 
(65 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 3: Zeile 3:
 
== Webservices ==
 
== Webservices ==
  
=== General information about API ===
+
=== General information about the API ===
 +
Overview:
 +
* There exists a webservice for getting traffic obstructions from TROBDB.
 +
* There exist two webservice for uploading traffic obstructions to TROBDB (HTTP/GeoJSON and the Webeditor).
 +
 
 +
Technical details:
 
* Current API version is 'v1'.
 
* Current API version is 'v1'.
 
* Base URL is http://trobdb.hsr.ch/
 
* 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!
 
* Usage policy: restricted use!
  
Zeile 12: Zeile 16:
 
* format - Values: 'geojson' (optional)
 
* format - Values: 'geojson' (optional)
 
* key - Values: email adress. Used for simple authentication. Please log in with a valid OpenID once on the main page.
 
* 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
+
=== Getting traffic obstructions from TROBDB (gettrafficobstruction) ===
*** geoJSON standard. Nothing else to choose atm.
 
 
 
=== Get traffic obstructions ===
 
 
* Description: Returns a traffic obstruction (trobs) as an array of way_id's.
 
* Description: Returns a traffic obstruction (trobs) as an array of way_id's.
 
* URL: '''/gettrafficobstruction'''
 
* URL: '''/gettrafficobstruction'''
Zeile 34: Zeile 36:
 
Examples:  
 
Examples:  
 
* Request: <code>GET http://trobdb.hsr.ch/getTrafficObstruction?osmid=4769349</code>
 
* Request: <code>GET http://trobdb.hsr.ch/getTrafficObstruction?osmid=4769349</code>
* Response (if success, GeoJSON is default):
+
** Response (if success, GeoJSON is default): Siehe [[Diskussion:TROBDB_Webservices]]
<code>
+
* Request: <code>GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1</code>
{ "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]]}}
+
** Response (if success, GeoJSON is default): Siehe [[Diskussion:TROBDB_Webservices]]
]}
+
* Request: <code>GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1&togeojsonio</code>
</code>
+
** Response Forward to geojson.io: Siehe [[Diskussion:TROBDB_Webservices]]
 +
* Request: <code>GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1&togeojsonio</code>
 +
 
  
* Request: <code>GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1</code>
+
===== Zugriff=====
* Response (if success, GeoJSON is default):
+
Um die Schnittstelle zur TROBDB zu verwenden brauchen sie eine E-Mail Adresse, welche auf der Seite Registriert ist. Am einfachsten sind gmail oder Yahoo Adressen.
<code>
+
 
{ "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]]}}
+
Einfach einmal auf http://trobdb.hsr.ch auf Login klicken und mit einem der Provider anmelden.
]}
+
 
</code>
+
 
 +
Danach können Sie wie folgt auf die Daten zugreifen:
 +
 
 +
 
 +
Beispiel:
 +
 
 +
http://trobdb.hsr.ch/gettrafficobstruction?&key=%3Cregistrierte-email%3E&lat=47.2267&lon=8.8167&radius=10000
  
* Request: <code>GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1&togeojsonio</code>
+
oder wenn Sie auf eine bestimmte OSM-ID prüfen wollen:
* Response Forward to geojson.io:
 
[http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1&togeojsonio]
 
  
http://sqlfiddle.com/#!15/263d5/7
+
http://trobdb.hsr.ch/gettrafficobstruction?&key=%3Cregistrierte-email%3E&osmid=60499718%E2%80%8B%E2%80%8B%E2%80%8B
  
Lalo Rodriguez - Devorame Otra Vez
 
Victor Manuelle - Apiadate de mi
 
  
***
+
Einfach noch "<registrierte-email>" durch die Mail Adresse ersetzen.
  
http://www.limbas.com/images/Limbas/movies/starterguide_de/user_login_einstieg_final.html
 
  
***
+
Rückgabe ist immer noch GeoJSON:
  
BLUgis:
 
  
TROBDB / HSR:
+
im Feld "properties" sind noch weitere Informationen zu finden:
  
AsText(geom)
+
Hier noch eine Liste der möglichen.
AsText(point)
 
category: Sportanlass
 
description: bei Schnee gesperrt wegen Schlittelbetrieb
 
direction: both
 
emergency: yes
 
id: 30028
 
issued: 2014-02-07 21:44:57
 
issuer_name: markus.honegger@gmail.com
 
osm_way_id_list: 37316091;182492677;23984734;41663875;41663854;41663820;41663870;182492676;44062619;41663786;200560496;40295285;
 
title: Schlittelpiste Orn-Wernetshausen
 
traffic_obstruction_end: 2014-03-31 23:59:00
 
traffic_obstruction_start: 2014-02-01 00:00:00
 
  
***
+
http://giswiki.hsr.ch/TROBDB_Webservices#Datenstruktur
  
 +
=== Uploading traffic obstructions to TROBDB (HTTP/GeoJSON and Webeditor) ===
  
ZüriReport: 18:00-18:15, dannn jede Stunde.  
+
For uploading or editing data, you need a verified email adress.
 +
You can register your email address in our application, by logging in on the main page: http://trobdb.hsr.ch
  
 +
For verification, you have to drop us a message, contact information may be found here: http://giswiki.hsr.ch/TROBDB#Kontakt
  
WITH tmp AS (
 
  SELECT (ST_Dump(
 
    ST_Buffer(ST_Buffer(ST_Union(ST_Buffer(way,20000)),20000),-20000))
 
  ).geom geom
 
  FROM osm_point
 
  WHERE tags @> hstore('tourism', 'zoo')
 
)
 
SELECT ST_AsText(geom) geom
 
FROM tmp
 
  
 +
You can find the webeditor here: http://trobdb.hsr.ch/editmap
  
 +
Here you have the possibility to add data with the two drawing tools in the upper-left corner of the map.
  
  
== Datenstruktur ==
+
Otherwise you can upload GeoJSON files on this Link: http://trobdb.hsr.ch/upload
  
"Traffic Obstruction DB":  
+
Examples for the required upload format you may find here: [[TROBDB_Webservices_Upload]]
  
Tabelle/Record "trobdb_line":
+
== Datenstruktur ==
  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:  date/datetime  NOT_NULL -- MANDATORY
 
  traffic_obstruction_end:    date/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(as_is,reverse) NULL --MANDATORY (Default: NULL = "both directions")
 
  (bypass_signalization:      text          NULL    -- OPT.      (NEU)
 
  issued:                    datetime      NULL    -- MANDATORY Datum von demjenigen, von dem die Meldung kam (=> OpenID Email?)
 
  country:                    TEXT          NOT_NULL -- MANDATORY country name (Default = "CH")
 
  
  category:                   text          NULL    -- OPT.     besser ENUM(...?) (urspr. von truckinfo )
+
Hinweise:
  (road_width:               REAL          NULL    -- OPT.     If the road is smaller than normal, see this value in meters
+
* 'trob' ist die Abkürzung von "Traffic Obstruction", d.h. Verkehrsbehinderung.
 +
* Es gibt drei Tabellen mit fast identischer Datenstruktur, trobdb_line, trobdb_area, trobdb_point, die sich v.a. im Geometrie-Typ des Attributs 'geom' unterscheiden.
 +
* Die mit "Exch." (=exchange) gekennzeichneten Attribute, d.h. der erste nachfolgende Teil, umfassen die vom Lieferanten auszutauschenden (maximal 14) Attribute.
 +
* Die ENUM-Aufzählwerte werden als Zeichenketten codiert, wie angegeben.
 +
* Die Werte im Attrbiut 'trob_interval' sind Intervall-Zeitangaben gemäss 'opening hours'-Format wobei dies als Nicht-Öffnungszeiten" interpretiert wird: [http://wiki.openstreetmap.org/wiki/DE:Key:opening_hours Definition OSM], [http://robin.de.marissa.hostorama.ch/osm/opening_hours.js/demo.html Demo (inkl. Source Code)]
 +
* In der Wert Tabelle/Record 'trobdb_area' ist 'direction' immer 'both' (es gibt keine Richtung bei Flächen).
 +
* Es gibt zwei Identifikatoren: 'userid' und 'id'. Beide garantieren nur im Rahmen eines Datenbankzustandes eindeutig zu sein. Sie garantieren ''nicht'', einzigartig bzw. über die Zeit (z.B. nach zwei Lieferungen) stabil zu sein.
 +
* Es werden nur TROBDB-Objekte (aus den drei Tabellen) ausgeliefert, die nicht aktuell sind. Zurzeit werden obsolete Objekt eine Woche in der TROBDB intern behalten.
 +
* Es gibt zurzeit keine automatische Erkennung von mehrfachen Einträgen; dies wird zurzeit organisatorisch gelöst.
 +
* Attributwert "obstructed" bedeuted "Durchfahrt erschwert" und kann u.a. bedeuten: Fahrbahnverschwenkung oder Verkehrsregelung mit Lichtsignalanlage.
  
   sysdate:                   datetime      NOT_NULL -- MANDATORY Datum der Erfassung dieser Info
+
Tabelle/Record "trobdb_point":
   issuer_name:               text          NULL    -- MANDATORY Name desjenigen, von dem die Meldung kam 
+
   geom:               POINT  NOT_NULL -- (Exch.) Gesperrte bzw. verkehrsbehinderte Richtung (Reihenfolge der Stützpunkte relevant).
   road_ref:                   TEXT           NULL     -- OPT.     road name reference (e.g. A1)
+
   userid:             TEXT        NULL    -- (Exch.) Identifikator der Lieferanten/Quell-Datenbank (falls vorhanden).
   osm_way_id:                 biginteger    NULL     -- OPT.     OSM way id vom Matching (nur bei trobdb_line)  
+
   title:             TEXT*100     NOT_NULL -- (Exch.) Titel.
   osm_highway:               string         NULL    -- OPT.     Wert des highway-Tags, z.B. motorway, footway (nur bei trobdb_line)
+
  description:        TEXT        NUL_NULL -- (Exch.) Beschreibung.
   is_tunnel:                 BOOLEAN        NOT_NULL -- MANDATORY from truckinfo text (NO guarantee!!)
+
  trob_start:        DATETIME    NOT_NULL -- (Exch.) Beginn (Zeitpunkt) der Verkehrsbehinderung (kann in der Zukunft aber auch in der Vergangenheit liegen).
   is_car_transport:           BOOLEAN       NOT_NULL -- MANDATORY Evaluated from truckinfo text (NO guarantee!!)
+
   trob_end:           DATETIME     NOT_NULL -- (Exch.) Ende (Zeitpunkt) der Verkehrsbehinderung (muss in der Zukunft liegen und älter sein als trob_start).
   is_pass:                   BOOLEAN       NOT_NULL -- MANDATORY Evaluated from truckinfo text (NO guarantee!!)
+
   trob_interval:     TEXT         NULL    -- (Exch.) Intervall-Zeitangabe der Verkehrsbehinderung ('opening hours'-Format z.B. "Mo-Fr 7:30-12:00, 13:00-18:30; Sa 7:30-16:00", vgl. Bem.).
   truckinfoimagepath:        TEXT          NULL    -- OPT.     imagepath on truckinfo Server
+
  direction:          ENUM        NOT_NULL -- (Exch.) ENUM(as_is,reverse,both); Richtung der Sperrung/Verkehrsbehinderung (Erfassungs-Default: both)
 +
  diversion_advice:  TEXT        NULL    -- (Exch.) Umfahrungsempfehlung, insbes. falls sie signalisiert ist. (NEU)
 +
  country:            TEXT*2      NOT_NULL -- (Exch.) Länderkürzel gemäss ISO 3166-1 ALPHA-2; (Erfassungs-Default: 'CH').
 +
   reason:             ENUM        NOT_NULL -- (Exch.) ENUM(construction, event, other); (Erfassungs-Default: other). (NEU)  
 +
   object_name:        TEXT        NULL    -- (Exch.) Strassenname (falls gegeben); (z.B. 'A1' oder 'Etzelstrasse').
 +
   object_type:        ENUM        NOT_NULL -- (Exch.) ENUM(street, tunnel, car_transport, pass, other); (Erfassungs-Default: street). (NEU)  
 +
   trob_type:         ENUM         NOT_NULL -- (Exch.) ENUM(closed, closed_except_emergency, closed_for_heavy_load, obstructed, other); (Erfassungs-Default: closed). (NEU)
  
 +
  id:                INTEGER      NOT_NULL -- Identifiaktor als Sequence der TROBDB (autoincrement).
 +
  sysdate:            DATETIME    NOT_NULL -- Datum des Eintrags dieses Records.
 +
  issuer_name:        TEXT        NULL    -- Name desjenigen, von dem die Meldung kam (=> OpenID Email?). 
  
 +
  issued:            DATETIME    NULL    -- (Exch.) Datum z.B. der Bewilligung von demjenigen, von dem die Meldung kam. (ENTFERNEN)
 +
  emergency:          BOOLEAN      NULL    -- (Exch.) Rettungs-Fz können trotzdem durchfahren. (ENTFERNEN)
 +
  is_tunnel:          BOOLEAN      NOT_NULL -- from truckinfo text (ENTFERNEN)
 +
  is_car_transport:  BOOLEAN      NOT_NULL -- Evaluated from truckinfo text. (ENTFERNEN)
 +
  is_pass:            BOOLEAN      NOT_NULL -- Evaluated from truckinfo text. (ENTFERNEN)
 +
  deprecated          BOOLEAN      NOT_NULL -- Wird TRUE wenn traffic_obstruction_end erreicht. (Default=FALSE). (ENTFERNEN)
 +
  truckinfoimagepath: TEXT        NULL    -- imagepath von truckinfo-Quelle. (ENTFERNEN)
  
 
Tabelle/Record "trobdb_area":
 
Tabelle/Record "trobdb_area":
   geometry: MultiPolygon                      -- gesperrte Fläche, z.B. bei Dorfkern-Sperrungen
+
   geom:               MULTIPOLYGON NOT_NULL -- gesperrte Fläche, z.B. bei Dorfkern-Sperrungen.
   ...                                         -- ditto wie "trobdb_line" without osm_highway and osm_way_id
+
   ...                                       -- ditto wie "trobdb_point"
   osm_way_id_list                             -- all osm_ways matching to st_intersects with the polygondata
+
   osm_way_id_list     BIGINTEGER  NOT_NULL -- all osm_ways matching to st_intersects with the polygon data
  
Tabelle/Record "trobdb_poi":
+
Tabelle/Record "trobdb_line":
   geometry: Point                              -- gesperrter Punkt, z.B. Pässe/Tunnel/Autoverlade  
+
   geom:               LINE        NOT_NULL -- gesperrter Punkt, z.B. Pässe/Tunnel/Autoverlade  
   ...                                         -- ditto wie "trobdb_line" without osm_highway and osm_way_id
+
   ...                                       -- ditto wie "trobdb_point" jedoch mit osm_highway and osm_way_id
 +
  osm_way_id:        BIGINTEGER  NULL    -- OSM way id vom Matching (nur bei trobdb_line)
 +
  osm_highway:        TEXT        NULL    -- Wert des highway-Tags, z.B. motorway, footway (nur bei trobdb_line)
  
Bemerkungen:
+
Notizen:
* Intervall-Zeitangaben ("Behinderungszeiten", Öffnungszeiten, Betriebszeiten):
+
* LINESTRING Richtung matchen zu OpenStreetMap Ways. Lösung zur Richtung des LINESTRINGS.
** 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
 
  
 
[[Kategorie:Webservice]]
 
[[Kategorie:Webservice]]

Aktuelle Version vom 30. Juni 2014, 16:30 Uhr

Zurück zu TROBDB.

Webservices

General information about the API

Overview:

  • There exists a webservice for getting traffic obstructions from TROBDB.
  • There exist two webservice for uploading traffic obstructions to TROBDB (HTTP/GeoJSON and the Webeditor).

Technical details:

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.

Getting traffic obstructions from TROBDB (gettrafficobstruction)

  • 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:


Zugriff

Um die Schnittstelle zur TROBDB zu verwenden brauchen sie eine E-Mail Adresse, welche auf der Seite Registriert ist. Am einfachsten sind gmail oder Yahoo Adressen.


Einfach einmal auf http://trobdb.hsr.ch auf Login klicken und mit einem der Provider anmelden.


Danach können Sie wie folgt auf die Daten zugreifen:


Beispiel:

http://trobdb.hsr.ch/gettrafficobstruction?&key=%3Cregistrierte-email%3E&lat=47.2267&lon=8.8167&radius=10000

oder wenn Sie auf eine bestimmte OSM-ID prüfen wollen:

http://trobdb.hsr.ch/gettrafficobstruction?&key=%3Cregistrierte-email%3E&osmid=60499718%E2%80%8B%E2%80%8B%E2%80%8B


Einfach noch "<registrierte-email>" durch die Mail Adresse ersetzen.


Rückgabe ist immer noch GeoJSON:


im Feld "properties" sind noch weitere Informationen zu finden:

Hier noch eine Liste der möglichen.

http://giswiki.hsr.ch/TROBDB_Webservices#Datenstruktur

Uploading traffic obstructions to TROBDB (HTTP/GeoJSON and Webeditor)

For uploading or editing data, you need a verified email adress. You can register your email address in our application, by logging in on the main page: http://trobdb.hsr.ch

For verification, you have to drop us a message, contact information may be found here: http://giswiki.hsr.ch/TROBDB#Kontakt


You can find the webeditor here: http://trobdb.hsr.ch/editmap

Here you have the possibility to add data with the two drawing tools in the upper-left corner of the map.


Otherwise you can upload GeoJSON files on this Link: http://trobdb.hsr.ch/upload

Examples for the required upload format you may find here: TROBDB_Webservices_Upload

Datenstruktur

Hinweise:

  • 'trob' ist die Abkürzung von "Traffic Obstruction", d.h. Verkehrsbehinderung.
  • Es gibt drei Tabellen mit fast identischer Datenstruktur, trobdb_line, trobdb_area, trobdb_point, die sich v.a. im Geometrie-Typ des Attributs 'geom' unterscheiden.
  • Die mit "Exch." (=exchange) gekennzeichneten Attribute, d.h. der erste nachfolgende Teil, umfassen die vom Lieferanten auszutauschenden (maximal 14) Attribute.
  • Die ENUM-Aufzählwerte werden als Zeichenketten codiert, wie angegeben.
  • Die Werte im Attrbiut 'trob_interval' sind Intervall-Zeitangaben gemäss 'opening hours'-Format wobei dies als Nicht-Öffnungszeiten" interpretiert wird: Definition OSM, Demo (inkl. Source Code)
  • In der Wert Tabelle/Record 'trobdb_area' ist 'direction' immer 'both' (es gibt keine Richtung bei Flächen).
  • Es gibt zwei Identifikatoren: 'userid' und 'id'. Beide garantieren nur im Rahmen eines Datenbankzustandes eindeutig zu sein. Sie garantieren nicht, einzigartig bzw. über die Zeit (z.B. nach zwei Lieferungen) stabil zu sein.
  • Es werden nur TROBDB-Objekte (aus den drei Tabellen) ausgeliefert, die nicht aktuell sind. Zurzeit werden obsolete Objekt eine Woche in der TROBDB intern behalten.
  • Es gibt zurzeit keine automatische Erkennung von mehrfachen Einträgen; dies wird zurzeit organisatorisch gelöst.
  • Attributwert "obstructed" bedeuted "Durchfahrt erschwert" und kann u.a. bedeuten: Fahrbahnverschwenkung oder Verkehrsregelung mit Lichtsignalanlage.

Tabelle/Record "trobdb_point":

 geom:               POINT   NOT_NULL -- (Exch.) Gesperrte bzw. verkehrsbehinderte Richtung (Reihenfolge der Stützpunkte relevant).
 userid:             TEXT         NULL     -- (Exch.) Identifikator der Lieferanten/Quell-Datenbank (falls vorhanden).
 title:              TEXT*100     NOT_NULL -- (Exch.) Titel.
 description:        TEXT         NUL_NULL -- (Exch.) Beschreibung.
 trob_start:         DATETIME     NOT_NULL -- (Exch.) Beginn (Zeitpunkt) der Verkehrsbehinderung (kann in der Zukunft aber auch in der Vergangenheit liegen).
 trob_end:           DATETIME     NOT_NULL -- (Exch.) Ende (Zeitpunkt) der Verkehrsbehinderung (muss in der Zukunft liegen und älter sein als trob_start).
 trob_interval:      TEXT         NULL     -- (Exch.) Intervall-Zeitangabe der Verkehrsbehinderung ('opening hours'-Format z.B. "Mo-Fr 7:30-12:00, 13:00-18:30; Sa 7:30-16:00", vgl. Bem.).
 direction:          ENUM         NOT_NULL -- (Exch.) ENUM(as_is,reverse,both); Richtung der Sperrung/Verkehrsbehinderung (Erfassungs-Default: both)
 diversion_advice:   TEXT         NULL     -- (Exch.) Umfahrungsempfehlung, insbes. falls sie signalisiert ist. (NEU) 
 country:            TEXT*2       NOT_NULL -- (Exch.) Länderkürzel gemäss ISO 3166-1 ALPHA-2; (Erfassungs-Default: 'CH').
 reason:             ENUM         NOT_NULL -- (Exch.) ENUM(construction, event, other); (Erfassungs-Default: other). (NEU) 
 object_name:        TEXT         NULL     -- (Exch.) Strassenname (falls gegeben); (z.B. 'A1' oder 'Etzelstrasse').
 object_type:        ENUM         NOT_NULL -- (Exch.) ENUM(street, tunnel, car_transport, pass, other); (Erfassungs-Default: street). (NEU) 
 trob_type:          ENUM         NOT_NULL -- (Exch.) ENUM(closed, closed_except_emergency, closed_for_heavy_load, obstructed, other); (Erfassungs-Default: closed). (NEU)
 id:                 INTEGER      NOT_NULL -- Identifiaktor als Sequence der TROBDB (autoincrement).
 sysdate:            DATETIME     NOT_NULL -- Datum des Eintrags dieses Records.
 issuer_name:        TEXT         NULL     -- Name desjenigen, von dem die Meldung kam (=> OpenID Email?).  
 issued:             DATETIME     NULL     -- (Exch.) Datum z.B. der Bewilligung von demjenigen, von dem die Meldung kam. (ENTFERNEN)
 emergency:          BOOLEAN      NULL     -- (Exch.) Rettungs-Fz können trotzdem durchfahren. (ENTFERNEN)
 is_tunnel:          BOOLEAN      NOT_NULL -- from truckinfo text (ENTFERNEN)
 is_car_transport:   BOOLEAN      NOT_NULL -- Evaluated from truckinfo text. (ENTFERNEN)
 is_pass:            BOOLEAN      NOT_NULL -- Evaluated from truckinfo text. (ENTFERNEN)
 deprecated          BOOLEAN      NOT_NULL -- Wird TRUE wenn traffic_obstruction_end erreicht. (Default=FALSE). (ENTFERNEN)
 truckinfoimagepath: TEXT         NULL     -- imagepath von truckinfo-Quelle. (ENTFERNEN)

Tabelle/Record "trobdb_area":

 geom:               MULTIPOLYGON NOT_NULL -- gesperrte Fläche, z.B. bei Dorfkern-Sperrungen.
 ...                                       -- ditto wie "trobdb_point"
 osm_way_id_list     BIGINTEGER   NOT_NULL -- all osm_ways matching to st_intersects with the polygon data

Tabelle/Record "trobdb_line":

 geom:               LINE        NOT_NULL -- gesperrter Punkt, z.B. Pässe/Tunnel/Autoverlade 
 ...                                       -- ditto wie "trobdb_point" jedoch mit osm_highway and osm_way_id
 osm_way_id:         BIGINTEGER   NULL     -- OSM way id vom Matching (nur bei trobdb_line) 
 osm_highway:        TEXT         NULL     -- Wert des highway-Tags, z.B. motorway, footway (nur bei trobdb_line)

Notizen:

  • LINESTRING Richtung matchen zu OpenStreetMap Ways. Lösung zur Richtung des LINESTRINGS.