nearby stations by coordinate for Saar

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@623 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-05-07 23:38:55 +00:00
parent 834ef0c03f
commit 93c49c5663
2 changed files with 29 additions and 9 deletions

View file

@ -82,7 +82,19 @@ public class VgsProvider extends AbstractHafasProvider
{
final StringBuilder uri = new StringBuilder(API_BASE);
if (location.type == LocationType.STATION && location.hasId())
if (location.hasLocation())
{
uri.append("query.exe/dny");
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=").append(allProductsInt());
uri.append("&look_x=").append(location.lon);
uri.append("&look_y=").append(location.lat);
return jsonNearbyStations(uri.toString());
}
else if (location.type == LocationType.STATION && location.hasId())
{
uri.append("stboard.exe/dn?near=Anzeigen");
uri.append("&distance=").append(maxDistance != 0 ? maxDistance / 1000 : 50);

View file

@ -34,6 +34,22 @@ public class VgsProviderLiveTest
{
private final VgsProvider provider = new VgsProvider();
@Test
public void nearbyStations() throws Exception
{
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.STATION, 8000244), 0, 0);
System.out.println(result.stations.size() + " " + result.stations);
}
@Test
public void nearbyStationsByCoordinate() throws Exception
{
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.ADDRESS, 49234783, 6995687), 0, 0);
System.out.println(result.stations.size() + " " + result.stations);
}
@Test
public void autocomplete() throws Exception
{
@ -50,14 +66,6 @@ public class VgsProviderLiveTest
System.out.println();
}
@Test
public void nearbyStations() throws Exception
{
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.STATION, 8000244), 0, 0);
System.out.println(result.stations.size() + " " + result.stations);
}
@Test
public void queryDepartures() throws Exception
{