mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 16:20:34 +00:00
Navitia: queryNearbyLocations() with distance of 0 now means "unlimited" (50km).
This commit is contained in:
parent
abad1694bc
commit
4f9fb0cab2
3 changed files with 19 additions and 1 deletions
|
@ -760,7 +760,7 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NearbyLocationsResult queryNearbyLocations(final EnumSet<LocationType> types, final Location location, final int maxDistance,
|
public NearbyLocationsResult queryNearbyLocations(final EnumSet<LocationType> types, final Location location, int maxDistance,
|
||||||
final int maxLocations) throws IOException
|
final int maxLocations) throws IOException
|
||||||
{
|
{
|
||||||
final ResultHeader resultHeader = new ResultHeader(network, SERVER_PRODUCT, SERVER_VERSION, 0, null);
|
final ResultHeader resultHeader = new ResultHeader(network, SERVER_PRODUCT, SERVER_VERSION, 0, null);
|
||||||
|
@ -799,6 +799,9 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider
|
||||||
throw new IllegalArgumentException("Unhandled location type: " + location.type);
|
throw new IllegalArgumentException("Unhandled location type: " + location.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxDistance == 0)
|
||||||
|
maxDistance = 50000;
|
||||||
|
|
||||||
final String queryUri = uri() + queryUriType + "places_nearby?type[]=stop_point" + "&distance=" + maxDistance + "&count=" + maxLocations
|
final String queryUri = uri() + queryUriType + "places_nearby?type[]=stop_point" + "&distance=" + maxDistance + "&count=" + maxLocations
|
||||||
+ "&depth=0";
|
+ "&depth=0";
|
||||||
final CharSequence page = httpClient.get(queryUri);
|
final CharSequence page = httpClient.get(queryUri);
|
||||||
|
|
|
@ -79,6 +79,15 @@ public abstract class AbstractNavitiaProviderLiveTest extends AbstractProviderLi
|
||||||
print(result);
|
print(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected final void nearbyStationsStationDistance(final String stationId) throws IOException
|
||||||
|
{
|
||||||
|
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), new Location(LocationType.STATION, stationId), 0,
|
||||||
|
10);
|
||||||
|
assertEquals(NearbyLocationsResult.Status.OK, result.status);
|
||||||
|
assertTrue(result.locations.size() > 1);
|
||||||
|
print(result);
|
||||||
|
}
|
||||||
|
|
||||||
protected final void nearbyStationsInvalidStation(final String stationId) throws IOException
|
protected final void nearbyStationsInvalidStation(final String stationId) throws IOException
|
||||||
{
|
{
|
||||||
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), new Location(LocationType.STATION, stationId),
|
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION), new Location(LocationType.STATION, stationId),
|
||||||
|
|
|
@ -64,6 +64,12 @@ public class ParisProviderLiveTest extends AbstractNavitiaProviderLiveTest
|
||||||
nearbyStationsAny(48877523, 2378353);
|
nearbyStationsAny(48877523, 2378353);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nearbyStationsDistance() throws Exception
|
||||||
|
{
|
||||||
|
nearbyStationsStationDistance("stop_point:OIF:SP:80:137");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void nearbyStationsInvalidStation() throws Exception
|
public void nearbyStationsInvalidStation() throws Exception
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue