0

I am calculating distance from latitude and longitude in sqlite in android. First I have to fetch coordinates from web service then I have to converted coordinates from degrees to radians using below code:

 Math.cos(deg2rad(outlet.getLatitude()))
 Math.sin(deg2rad(outlet.getLatitude()))
 public static double deg2rad(double deg) {
     return (deg * Math.PI / 180.0);
 }

then I have inserted it into my Table and then I am using this query to calculate the distance in sqlite. When I run this query:

SELECT "location",
(sin_lat_rad  "sin_lat_rad" + cos_lat_rad  "cos_lat_rad" *
 (sin_lon_rad  "sin_lon_rad" + cos_lon_rad  "cos_lon_rad"))

I am getting 0.99999999 in output error

mixel
  • 25,177
  • 13
  • 126
  • 165
Achin
  • 1,252
  • 4
  • 28
  • 63

0 Answers0