cansik / opendata-transport

This is an implementation of the Open Data Transport API in Java.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Open Data Transport Framework Build Status codebeat badge

The Transport API allows interested developers to build their own applications using public timetable data, whether they're on the web, the desktop or mobile devices. The aim of the API is to cover public transport within Switzerland.

This is an implementation of the Open Data Transport API in Java.

For more information go to the official documentation:

Open Data Transport API

Examples

Create a new transport client

OpenTransportClient client = new OpenTransportClient();

Hint: The number of HTTP requests you can send to transport.opendata.ch is limited to 3 requests per second per IP address.

Locations by query

String city = "Basel";
LocationResult result = client.getLocations(city, LocationType.All);

Locations by coordinates

double x = 47.5476;
double y = 7.5897;

LocationResult result = client.getLocations(x, y, TransportationType.ICE_TGV_RJ);

Connections

String city1 = "Basel SBB";
String city2 = "Zurich";

ConnectionResult result = client.getConnections(city1, city2);

Connections enhanced

String city1 = "Basel SBB";
String city2 = "Zurich";

Date connectionDate = new Date(2016 - 1900, 1, 1, 15, 0, 0);

ConnectionParameter params = new ConnectionParameter(city1, city2);
params.setDateTime(connectionDate);

ConnectionResult result = client.getConnections(params);

Stationboard

StationboardParameter param = new StationboardParameter();
param.setStation(station);
param.setLimit(0);

StationboardResult result = client.getStationboard(param);

About

This framework has been developed by cansik for educational purpose.

Frameworks:

About

This is an implementation of the Open Data Transport API in Java.


Languages

Language:Java 100.0%