mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 06:08:52 +00:00
nearby stations by coordinate for Denmark
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@613 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
ea0c25243b
commit
0e79a0011c
2 changed files with 32 additions and 10 deletions
|
@ -75,17 +75,31 @@ public class DsbProvider extends AbstractHafasProvider
|
|||
throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(API_BASE);
|
||||
uri.append("stboard.exe/dn");
|
||||
|
||||
if (lat != 0 || lon != 0)
|
||||
{
|
||||
uri.append("query.exe/mny");
|
||||
uri.append("?performLocating=2&tpl=stop2json");
|
||||
uri.append("&look_maxno=").append(maxStations != 0 ? maxStations : 200);
|
||||
uri.append("&look_maxdist=").append(maxDistance != 0 ? maxDistance : 5000);
|
||||
uri.append("&look_stopclass=2047");
|
||||
uri.append("&look_x=").append(lon);
|
||||
uri.append("&look_y=").append(lat);
|
||||
|
||||
return jsonNearbyStations(uri.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
uri.append("stboard.exe/mn");
|
||||
uri.append("?productsFilter=11111111111");
|
||||
uri.append("&boardType=dep");
|
||||
uri.append("&input=").append(ParserUtils.urlEncode(stationId));
|
||||
uri.append("&sTI=1&start=yes&hcount=0");
|
||||
uri.append("&L=vs_java3");
|
||||
|
||||
// &inputTripelId=A%3d1%40O%3dCopenhagen%20Airport%40X%3d12646941%40Y%3d55629753%40U%3d86%40L%3d900000011%40B%3d1
|
||||
|
||||
return xmlNearbyStations(uri.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private static final Pattern P_NORMALIZE_LINE_AND_TYPE = Pattern.compile("([^#]*)#(.*)");
|
||||
|
||||
|
@ -158,7 +172,7 @@ public class DsbProvider extends AbstractHafasProvider
|
|||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder();
|
||||
uri.append(API_BASE).append("stboard.exe/dn");
|
||||
uri.append(API_BASE).append("stboard.exe/mn");
|
||||
uri.append("?productsFilter=11111111111");
|
||||
uri.append("&boardType=dep");
|
||||
uri.append("&maxJourneys=50"); // ignore maxDepartures because result contains other stations
|
||||
|
|
|
@ -50,13 +50,21 @@ public class DsbProviderLiveTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStation() throws Exception
|
||||
public void nearbyStations() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.nearbyStations("8600858", 0, 0, 0, 0);
|
||||
|
||||
System.out.println(result.stations.size() + " " + result.stations);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStationsByCoordinate() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.nearbyStations(null, 55670305, 12554169, 0, 0);
|
||||
|
||||
System.out.println(result.stations.size() + " " + result.stations);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDepartures() throws Exception
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue