i am soliman muttawa
the case is as follows:
i have my database which contains names, address, and 2-d coordinate (x,y)
and what i want is that when the user checks in his coordinates it ll be sent to the database and compared and then it send back the following
a list of the distance between the user and the stores ( lets say the nearest 10 or what ever) in ascending order .
to sum up i want an algorithm that measure distance between 2d coordinates and sort them in ascending order based on distance and if u can send me as a source code or pasudeo code it ll be more than great
thanks alot for your help
and dont worry it is not an assignment or anything like this only for me personal use and knowledge i am political science student and i am graduated 2 years ago :)
i researched :
1 )bird's eye view ( wont work 3d coordinates)
2) haversine ( didnt get it )
what i though of to do normal euclidean or manhathan to get the distance then a kind of sorting .. thank you again
and i though of knn ( k nearestneighbor
Take a look here:
Look at the first DEMO there.
That code is very efficient. It does *NOT* use the haversine formula, but it is accurate to within perhaps 100 meters for distances up to 200 km. If that is good enough for you, then you don't need to use haversine formula.