1

I am new at SQLite (using n Android). my question is i have a table which has multiple latitude and longitude points, corresponding to the path traveled by a person. means first entry of longitude and latitude is when person started moving and last point shows where person stopped.

How can I get the values of lat long from the database and find the distance person traveled.

My table contains the following attributes-

  1. numbering auto increment, by which i want to sort entries and calculate distance.

  2. Latitude

  3. Longitude

  4. Accuracy

Kindly help. Thanks in advance.

Sangeeta
  • 961
  • 2
  • 13
  • 34
  • I am not extracting any data for now. m just inserting lat long values. – Sangeeta Jun 24 '15 at 04:38
  • Can you show your code that inserts the lat lon values? – Daniel Nugent Jun 24 '15 at 04:39
  • public void insertLocationRow(double lat, double lon,float accuracy) { long timestamp = System.currentTimeMillis(); ContentValues cv = new ContentValues(); cv.put(COLUMN_LATITUDE, Double.toString(lat)); cv.put(COLUMN_LONGITUDE, Double.toString(lon)); cv.put(COLUMN_ACCURACY, accuracy); cv.put(COLUMN_UNIX_TIMESTAMP, timestamp); Log.i("Location values inserted in database", "" + lat + "" + lon + "" + accuracy + "" + timestamp); getWritableDatabase().insert(LOCATION_TABLE, null, cv);} – Sangeeta Jun 24 '15 at 04:42
  • MyDbHelper insertLocation = new MyDbHelper(context); insertLocation.insertLocationRow(lat, lon, acc); Log.i("Location", "" + lat + "" + lon + "" + acc); – Sangeeta Jun 24 '15 at 04:44
  • Ignoring the altitude will introduce (very small) errors. – CL. Jun 24 '15 at 08:30

0 Answers0