mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 16:29:51 +00:00
Query nearby stations by coordinate for Belgium
This commit is contained in:
parent
6dddd01b49
commit
c74113709f
1 changed files with 16 additions and 1 deletions
|
@ -40,6 +40,7 @@ public class SncbProvider extends AbstractHafasProvider
|
|||
super(API_BASE + "stboard.exe/nn", API_BASE + "ajax-getstop.exe/nny", API_BASE + "query.exe/nn", 16, null);
|
||||
|
||||
setJsonGetStopsEncoding(UTF_8);
|
||||
setJsonNearbyStationsEncoding(UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
@ -125,7 +126,21 @@ public class SncbProvider 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('y');
|
||||
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_nv=get_stopweight|yes");
|
||||
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())
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append("?near=Zoek");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue