mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 16:40:30 +00:00
Navitia: When querying for nearby locations, let the server choose the limit when maxLocations=0.
This commit is contained in:
parent
16c85476b1
commit
81ce7cdc3d
1 changed files with 11 additions and 14 deletions
|
@ -766,45 +766,42 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider
|
|||
final ResultHeader resultHeader = new ResultHeader(network, SERVER_PRODUCT, SERVER_VERSION, 0, null);
|
||||
|
||||
// Build query uri depending of location type.
|
||||
final String queryUriType;
|
||||
final StringBuilder queryUri = new StringBuilder(uri());
|
||||
if (location.type == LocationType.COORD || location.type == LocationType.ADDRESS || location.type == LocationType.ANY)
|
||||
{
|
||||
if (!location.hasLocation())
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final double lon = location.lon / 1E6;
|
||||
final double lat = location.lat / 1E6;
|
||||
|
||||
queryUriType = "coords/" + lon + ";" + lat + "/";
|
||||
queryUri.append("coords/").append(lon).append(';').append(lat);
|
||||
}
|
||||
else if (location.type == LocationType.STATION)
|
||||
{
|
||||
if (!location.isIdentified())
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
queryUriType = "stop_points/" + location.id + "/";
|
||||
queryUri.append("stop_points/").append(location.id);
|
||||
}
|
||||
else if (location.type == LocationType.POI)
|
||||
{
|
||||
if (!location.isIdentified())
|
||||
{
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
queryUriType = "pois/" + location.id + "/";
|
||||
queryUri.append("pois/").append(location.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("Unhandled location type: " + location.type);
|
||||
}
|
||||
queryUri.append('/');
|
||||
|
||||
if (maxDistance == 0)
|
||||
maxDistance = 50000;
|
||||
|
||||
final String queryUri = uri() + queryUriType + "places_nearby?type[]=stop_point" + "&distance=" + maxDistance + "&count=" + maxLocations
|
||||
+ "&depth=0";
|
||||
final CharSequence page = httpClient.get(queryUri);
|
||||
queryUri.append("places_nearby?type[]=stop_point");
|
||||
queryUri.append("&distance=").append(maxDistance);
|
||||
if (maxLocations > 0)
|
||||
queryUri.append("&count=").append(maxLocations);
|
||||
queryUri.append("&depth=0");
|
||||
final CharSequence page = httpClient.get(queryUri.toString());
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue