--- android/TrainInfo/src/dk/thoerup/traininfo/provider/XmlStationProvider.java 2010/09/08 08:11:00 1030 +++ android/TrainInfo/src/dk/thoerup/traininfo/provider/XmlStationProvider.java 2010/09/08 08:45:18 1031 @@ -24,10 +24,19 @@ AndroidTimeoutCache> stationCache = new AndroidTimeoutCache>(CACHE_TIMEOUT); + double roundToPlaces(double value, int places) { + double pow = Math.pow(10, places); + double temp = Math.round( value*pow ); + + return temp / pow; + } @Override public List lookupStations(Location location) { - String url = XmlUtil.SERVICE_BASE + "/LocateStations?latitude=" + (float)location.getLatitude() + "&longitude=" + (float)location.getLongitude(); + double lat = roundToPlaces(location.getLatitude(), 4); + double lng = roundToPlaces(location.getLongitude(), 4); + + String url = XmlUtil.SERVICE_BASE + "/LocateStations?latitude=" + lat + "&longitude=" + lng; Log.i("url", url); return lookupStationsWorker(url); }