TROBDB Webservices: Unterschied zwischen den Versionen
Stefan (Diskussion | Beiträge) K (→Datenstruktur) |
|||
| (55 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/ | ||
* 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. | |||
=== Getting traffic obstructions from TROBDB (gettrafficobstruction) === | |||
=== | |||
* 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]] | ||
* Request: <code>GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1</code> | |||
** 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> | |||
** 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> | |||
===== 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: [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. | |||
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": | Tabelle/Record "trobdb_area": | ||
geom: MULTIPOLYGON NOT_NULL -- gesperrte Fläche, z.B. bei Dorfkern-Sperrungen. | |||
... | ... -- ditto wie "trobdb_point" | ||
osm_way_id_list | osm_way_id_list BIGINTEGER NOT_NULL -- all osm_ways matching to st_intersects with the polygon data | ||
Tabelle/Record " | 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. | ||
[[Kategorie:Webservice]] | [[Kategorie:Webservice]] | ||
Aktuelle Version vom 30. Juni 2014, 14: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:
- Current API version is 'v1'.
- Base URL is http://trobdb.hsr.ch/
- 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.
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:
- Request:
GET http://trobdb.hsr.ch/getTrafficObstruction?osmid=4769349- Response (if success, GeoJSON is default): Siehe Diskussion:TROBDB_Webservices
- Request:
GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1- Response (if success, GeoJSON is default): Siehe Diskussion:TROBDB_Webservices
- Request:
GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1&togeojsonio- Response Forward to geojson.io: Siehe Diskussion:TROBDB_Webservices
- Request:
GET http://trobdb.hsr.ch/getTrafficObstruction?lon=8.688187&lat=47.440446&radius=0.1&togeojsonio
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:
oder wenn Sie auf eine bestimmte OSM-ID prüfen wollen:
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.