--- android/TrainInfoService/src/dk/thoerup/traininfoservice/db/StationDAO.java 2011/06/08 16:11:27 1507 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/db/StationDAO.java 2011/06/08 18:24:24 1511 @@ -127,7 +127,7 @@ String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, stationcode_metro, address, 0.0, " + "levenshtein(lower(name),lower(?) ) as leven " + "FROM trainstations " + - "WHERE (levenshtein(lower(name),lower(?) ) <= 3) AND enabled = true " + + "WHERE (levenshtein(lower(name),lower(?) ) <= 3) " + "AND enabled = true " + "ORDER BY leven " + "LIMIT 1"; @@ -160,7 +160,9 @@ //Latitude (horizonal), longitude(vertical) so // 1 degree latitude is ~ 111320 meters, since the distance between the horizonal lines is always the same // 1 degree longitude is ~111320 meters at equator but gets shorter as we get closer to the poles. - // the "hack" with max 0.4 degrees latitude and 0.75 degrees longitude is only valid since we only service danish trains, + // so 1 degree longitude is 64.5 km at denmarks southern point (gedser=54.55,11.95) + // and is 59.4km at northern point (skagen = 57.75,10.65) + // The "hack" with max 0.4 degrees latitude and 0.75 degrees longitude is only valid since we only service danish trains, // in denmark 0.4dg latitude ~ 44km, 0.75dg longitude ~ 47km // the ultra fast method (and only slightly inaccurate as long as we only cover a limited geographically area)