Query nearby stations by coordinate for Berlin

This commit is contained in:
Andreas Schildbach 2013-10-13 10:58:03 +02:00
parent 5c2b555d0d
commit 374403cd78
2 changed files with 16 additions and 1 deletions

View file

@ -182,7 +182,14 @@ public final class BvgProvider extends AbstractHafasProvider
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
{
if (location.type == LocationType.STATION && location.hasId())
if (location.hasLocation())
{
final StringBuilder uri = new StringBuilder(queryEndpoint);
uri.append(jsonNearbyStationsParameters(location, maxDistance, maxStations));
return jsonNearbyStations(uri.toString());
}
else if (location.type == LocationType.STATION && location.hasId())
{
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
uri.append("?near=Anzeigen");

View file

@ -53,6 +53,14 @@ public class BvgProviderLiveTest extends AbstractProviderLiveTest
print(result);
}
@Test
public void nearbyStationsByCoordinate() throws Exception
{
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.ADDRESS, 52486400, 13350744), 0, 0);
print(result);
}
@Test
public void nearbyStationsInvalidStation() throws Exception
{