Hafas: When querying for nearby stations, use urlname.

This commit is contained in:
Andreas Schildbach 2014-12-16 17:18:50 +01:00
parent 540535b7d5
commit 593e032df4

View file

@ -2398,6 +2398,9 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
{ {
final CharSequence page = ParserUtils.scrape(uri, null, jsonNearbyStationsEncoding); final CharSequence page = ParserUtils.scrape(uri, null, jsonNearbyStationsEncoding);
// System.out.println(uri);
// System.out.println(page);
try try
{ {
final JSONObject head = new JSONObject(page.toString()); final JSONObject head = new JSONObject(page.toString());
@ -2412,14 +2415,15 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
{ {
final JSONObject stop = aStops.optJSONObject(i); final JSONObject stop = aStops.optJSONObject(i);
final String id = stop.getString("extId"); final String id = stop.getString("extId");
final String name = ParserUtils.resolveEntities(stop.getString("name")); // final String name = ParserUtils.resolveEntities(stop.getString("name"));
final String urlname = ParserUtils.urlDecode(stop.getString("urlname"), jsonNearbyStationsEncoding);
final int lat = stop.getInt("y"); final int lat = stop.getInt("y");
final int lon = stop.getInt("x"); final int lon = stop.getInt("x");
final int stopWeight = stop.optInt("stopweight", -1); final int stopWeight = stop.optInt("stopweight", -1);
if (stopWeight != 0) if (stopWeight != 0)
{ {
final String[] placeAndName = splitStationName(name); final String[] placeAndName = splitStationName(urlname);
stations.add(new Location(LocationType.STATION, id, lat, lon, placeAndName[0], placeAndName[1])); stations.add(new Location(LocationType.STATION, id, lat, lon, placeAndName[0], placeAndName[1]));
} }
} }