fixed geocoding of POIs even more

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@282 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach 2010-10-11 12:48:09 +00:00
parent bd014ef2df
commit 6a49e57d0e
2 changed files with 19 additions and 4 deletions

View file

@ -953,9 +953,9 @@ public abstract class AbstractEfaProvider implements NetworkProvider
uri.append("&calcNumberOfTrips=4");
}
protected static final void appendLocation(final StringBuilder uri, final Location location, final String paramSuffix)
protected void appendLocation(final StringBuilder uri, final Location location, final String paramSuffix)
{
if (location.type == LocationType.ADDRESS && location.lat != 0 && location.lon != 0)
if ((location.type == LocationType.POI || location.type == LocationType.ADDRESS) && location.lat != 0 && location.lon != 0)
{
uri.append("&nameInfo_").append(paramSuffix).append("=").append(String.format("%2.6f:%2.6f", location.lon / 1E6, location.lat / 1E6))
.append(":WGS84[DD.dddddd]");
@ -976,7 +976,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
if (type == LocationType.ADDRESS)
return "any"; // strange, matches with anyObjFilter
if (type == LocationType.POI)
return "any";
return "poi";
if (type == LocationType.ANY)
return "any";
throw new IllegalArgumentException(type.toString());
@ -984,7 +984,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
protected static final String locationValue(final Location location)
{
if (location.type == LocationType.STATION && location.id != 0)
if ((location.type == LocationType.STATION || location.type == LocationType.POI) && location.id != 0)
return Integer.toString(location.id);
else
return location.name;

View file

@ -21,6 +21,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.LocationType;
import de.schildbach.pte.util.ParserUtils;
/**
@ -111,6 +112,20 @@ public class VvsProvider extends AbstractEfaProvider
return uri.toString();
}
@Override
protected void appendLocation(final StringBuilder uri, final Location location, final String paramSuffix)
{
if (location.type == LocationType.POI && location.id != 0)
{
uri.append("&type_").append(paramSuffix).append("=poiID");
uri.append("&name_").append(paramSuffix).append("=").append(location.id);
}
else
{
super.appendLocation(uri, location, paramSuffix);
}
}
@Override
protected String commandLink(final String sessionId, final String command)
{