/[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 740 by torben, Wed May 19 09:53:25 2010 UTC revision 741 by torben, Wed May 19 12:56:10 2010 UTC
# Line 103  public class StationDAO { Line 103  public class StationDAO {
103                    
104          //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.5 degrees latitude and 2.5 degrees longitude is only valid since we only service danish trains
105          // in denmark 1.5dg latitude ~ 165km, 2.5dg longitude ~ 155km          // in denmark 1.5dg latitude ~ 165km, 2.5dg longitude ~ 155km
106            
107            // the ultra fast method  (and only slightly inaccurate as long as we only cover a limited geographically area)
108            // is using an aproximation of the length of 1 latitude degree and 1 longitude degree and just use pythagoras to
109            // calculate the distance:
110        //     sqrt( power(abs(latitude-?)*111320, 2) + power(abs(longitude-?)*63000,2) )::int as calcdist
111            
112          public List<StationBean> getByLocation(double latitude, double longitude) throws SQLException {          public List<StationBean> getByLocation(double latitude, double longitude) throws SQLException {
113                  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," +
114                                           "       earth_distance( earth_coord, ll_to_earth(?,?))::int AS calcdist " +                                           "       earth_distance( earth_coord, ll_to_earth(?,?))::int AS calcdist " +

Legend:
Removed from v.740  
changed lines
  Added in v.741

  ViewVC Help
Powered by ViewVC 1.1.20