/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/StationDAO.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/StationDAO.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 927 by torben, Thu Jun 24 17:17:45 2010 UTC revision 928 by torben, Sun Jun 27 16:55:36 2010 UTC
# Line 106  public class StationDAO { Line 106  public class StationDAO {
106                  return result;                  return result;
107          }          }
108    
109          //the "hack" with max 0.5 degrees latitude and 0.9 degrees longitude is only valid since we only service danish trains,          //the "hack" with max 0.4 degrees latitude and 0.75 degrees longitude is only valid since we only service danish trains,
110          // in denmark 0.5dg latitude ~ 55km, 0.9dg longitude ~ 57km          // in denmark 0.4dg latitude ~ 44km, 0.75dg longitude ~ 47km
111    
112          // the ultra fast method  (and only slightly inaccurate as long as we only cover a limited geographically area)          // the ultra fast method  (and only slightly inaccurate as long as we only cover a limited geographically area)
113          // is using an aproximation of the length of 1 latitude degree and 1 longitude degree and just use pythagoras to          // is using an aproximation of the length of 1 latitude degree and 1 longitude degree and just use pythagoras to
# Line 116  public class StationDAO { Line 116  public class StationDAO {
116    
117          public List<StationBean> getByLocationWorker(double latitude, double longitude, boolean geolimit) throws SQLException {          public List<StationBean> getByLocationWorker(double latitude, double longitude, boolean geolimit) throws SQLException {
118                                    
119                  String limitExpression = geolimit == true ? "AND abs(latitude-?)<0.5 AND abs(longitude-?)<0.9 " : "";                  String limitExpression = geolimit == true ? "AND abs(latitude-?)<0.4 AND abs(longitude-?)<0.75 " : "";
120                                    
121                  String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, stationcode_metro, address, " +                  String SQL = "SELECT id,name,latitude,longitude,stationcode_fjrn,stationcode_stog, stationcode_metro, address, " +
122                          "earth_distance( earth_coord, ll_to_earth(?,?))::int AS calcdist " +                          "earth_distance( earth_coord, ll_to_earth(?,?))::int AS calcdist " +

Legend:
Removed from v.927  
changed lines
  Added in v.928

  ViewVC Help
Powered by ViewVC 1.1.20