--- android/TrainInfoService/src/dk/thoerup/traininfoservice/LocateStations.java 2009/09/01 19:17:18 292 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/LocateStations.java 2009/09/07 12:23:35 301 @@ -30,9 +30,10 @@ protected String getStations(Connection conn, double latitude, double longitude) throws SQLException { //inner select is workaround from not being able to use a calculated column directly in where clause final String SQL = "SELECT * FROM ( "+ - " SELECT name,latitude,longitude,address,stationcode, " + + " SELECT name,latitude,longitude,stationcode, " + " earth_distance( ll_to_earth(latitude,longitude), ll_to_earth(?,?))::int AS calcdist " + " FROM trainstations " + + " WHERE latitude IS NOT NULL AND longitude IS NOT NULL " + " ) AS trainstations2 " + "ORDER BY calcdist ASC " + "LIMIT 4 "; @@ -59,10 +60,9 @@ buff.append("").append( res.getString(1) ) .append("\n"); buff.append("").append( res.getDouble(2) ) .append("\n"); - buff.append("").append( res.getDouble(3) ) .append("\n"); - buff.append("
").append( res.getString(4) ) .append("
\n"); - buff.append("").append( res.getString(5) ) .append("\n"); - buff.append("").append( res.getDouble(6) ) .append("\n"); + buff.append("").append( res.getDouble(3) ) .append("\n"); + buff.append("").append( res.getString(4) ) .append("\n"); + buff.append("").append( res.getInt(5) ) .append("\n"); buff.append("\n"); }