/[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 847 by torben, Fri Jun 11 20:50:40 2010 UTC revision 848 by torben, Tue Jun 15 05:33:14 2010 UTC
# Line 103  public class StationDAO { Line 103  public class StationDAO {
103                  return result;                  return result;
104          }          }
105    
106          //the "hack" with max 1.5 degrees latitude and 2.5 degrees longitude is only valid since we only service danish trains          //the "hack" with max 1.0 degrees latitude and 2.0 degrees longitude is only valid since we only service danish trains
107          // in denmark 1.5dg latitude ~ 165km, 2.5dg longitude ~ 155km          // in denmark 1.0dg latitude ~ 110km, 2.0dg longitude ~ 120km
108    
109          // 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)
110          // 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 113  public class StationDAO { Line 113  public class StationDAO {
113    
114          public List<StationBean> getByLocationWorker(double latitude, double longitude, boolean geolimit) throws SQLException {          public List<StationBean> getByLocationWorker(double latitude, double longitude, boolean geolimit) throws SQLException {
115                                    
116                  String limitExpression = geolimit == true ? "AND abs(latitude-?)<1.5 AND abs(longitude-?)<2.5 " : "";                  String limitExpression = geolimit == true ? "AND abs(latitude-?)<1.0 AND abs(longitude-?)<2.0 " : "";
117                                    
118                  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, " +
119                          "earth_distance( earth_coord, ll_to_earth(?,?))::int AS calcdist " +                          "earth_distance( earth_coord, ll_to_earth(?,?))::int AS calcdist " +

Legend:
Removed from v.847  
changed lines
  Added in v.848

  ViewVC Help
Powered by ViewVC 1.1.20