-1

I have sqlite database on static data put in my assets folder from Android project.

I will write query and fetch data from sqlite database and insert addMarker on google map on lat & long between 100 meter distance from gps location lat & long got but not correct record getting query.

This is query I would write on database

SELECT * FROM tblLatLong WHERE (latitude='33.247006' and longitude='-86.576707') < 100;
Cœur
  • 37,241
  • 25
  • 195
  • 267
Najib.Nj
  • 3,706
  • 1
  • 25
  • 39

1 Answers1

1

First you'll get location from your SQLite then find a distance between Two points(SQLite Point and your Current Location Point) using

distanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude, float[] results)

Get Distance:

float[] results = new float[1];
Location.distanceBetween(SQLitePosition.latitude, SQLitePosition.longitude,
            CurrentPosition.latitude, CurrentPosition.longitude, results);

or another method

distanceTo(Location dest)

and check that distance is < 100 then only add that Point into your Google Map as a Marker.

M D
  • 47,665
  • 9
  • 93
  • 114
  • Thanks for reply but can you please explain in detail about SQLitePosition.latitude, SQLitePosition.longitude this lat & long when to find out ?????????? – Najib.Nj Sep 25 '14 at 06:34
  • @najibputhawala SQLite Position it means the point that you fetch from your DB.. – M D Sep 25 '14 at 06:35
  • Can you write again sql query which i need to it ? – Najib.Nj Sep 25 '14 at 06:43
  • @najibputhawala Do you get my Point?? There is no SQL Query for that....You'll check this distance manually.. – M D Sep 25 '14 at 06:44
  • Yes i got your point and its on location based got the distance but i need to distance on sqlite db from table throw fetch record. so give me your suggestion. – Najib.Nj Sep 25 '14 at 06:59
  • @najibputhawala No budy that's not possible.... sorry!!! – M D Sep 25 '14 at 07:02