I want to make an application in android. In this app user have to register in this app. With the registration the gps location(lat and long) will store in database table with user info. In this app i want to add a functionality that is “Search People who are in Root”. User can input starting point and ending point(like : Mumbai to Delhi). And every peoples between this two point want to be found.
For Example : User-A have newly registered in this app. User-A’s gps location is like lat = 20.234554 and long = 56.21455255. Now he will input two point like mumbai to delhi and click search button. Now i want to query in the database where every peoples information has been already stored. I want to query in database that “Select * from Location(Table) where peoples between mumbai to delhi”
Database table “locations” has four field id, lat, long and cityname. Now i want the above query on the database where i can find the people those are between the two inputted geo points.
Hope i have explained well that you understand what i want to achieve is only that i want to just search which are the nearby locations(lat and long) from the database table with inputted location(lat and long).
I would suggest to limit your location by some conditions which can be indexed. You can do that easily as you probably don’t want to list somebody from the US to somebody in Paris as nearest location.
With just a bit modification on RustamIS query you can eliminate the most of the irrelevant locations.
So you defined a rectangle where you want to look for the nearest people.