mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-20 09:19:57 +00:00
Hafas endpoints
This commit is contained in:
parent
6f2b4515d9
commit
4a7743d094
25 changed files with 130 additions and 171 deletions
|
@ -36,11 +36,10 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
{
|
||||
public static final NetworkId NETWORK_ID = NetworkId.SBB;
|
||||
private static final String API_BASE = "http://fahrplan.sbb.ch/bin/";
|
||||
private static final String API_URI = "http://fahrplan.sbb.ch/bin/extxml.exe"; // xmlfahrplan.sbb.ch
|
||||
|
||||
public SbbProvider(final String accessId)
|
||||
{
|
||||
super(API_URI, 10, accessId);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "extxml.exe", 10, accessId);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
@ -99,11 +98,10 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
|
||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(API_BASE);
|
||||
|
||||
if (location.hasLocation())
|
||||
{
|
||||
uri.append("query.exe/dny");
|
||||
final StringBuilder uri = new StringBuilder(queryEndpoint);
|
||||
uri.append('y');
|
||||
uri.append("?performLocating=2&tpl=stop2json");
|
||||
uri.append("&look_maxno=").append(maxStations != 0 ? maxStations : 200);
|
||||
uri.append("&look_maxdist=").append(maxDistance != 0 ? maxDistance : 5000);
|
||||
|
@ -115,7 +113,7 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
}
|
||||
else if (location.type == LocationType.STATION && location.hasId())
|
||||
{
|
||||
uri.append("stboard.exe/dn");
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append("?productsFilter=").append(allProductsString());
|
||||
uri.append("&boardType=dep");
|
||||
uri.append("&input=").append(location.id);
|
||||
|
@ -132,8 +130,7 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder();
|
||||
uri.append(API_BASE).append("stboard.exe/dn");
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
||||
return xmlQueryDepartures(uri.toString(), stationId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue