Android Question "Near Me" ; how to approach this?


Licensed User
In an app I'm planning I will need a "near me" or "around me" button that will filter results by a max distance...
My question is, how to tackle this?
What is the best approach?
Circle all records and add those within the filter parameter to a new list? Is there a "service" available that does this checking?


Well-Known Member
Licensed User
I would suggest to use a spatialite DB, which is a sqlite with spatial capabilities. there is a lib from Martin:
then you can use spatial queries to select the data from the database like:
FROM table AS a
WHERE ST_DWithin (mylocation, a.LatLong, 10000) -- 10km
ORDER BY ST_Distance (mylocation, a.LatLong)
Upvote 0


Well-Known Member
Licensed User
If you are looking for a simple way, i realised in an 'quick and dirty' manner: I calculated the the difference between the x - values and the difference of the x values, and added them together; you could use a factor for the x or y value, so that distance on x values is the same as the y values. So the smallest value is the nearest and so on.
I have this idea inside a sql query and it is working...
Last edited:
Upvote 0