I'm new to Spatial Databases and I'm trying to find the nearest point of a point.
In my application there is a google map and the user can click anywhere on it. The click executes a request to the server which should return the nearest point in the database from the point where the user clicked.
My query looks like this:
SELECT point, strength FROM signalstrengths ORDER BY st_distance(st_makepoint(:lng, :lat)::geography, point) DESC LIMIT 1;
This query always returns one of two points, no matter where i click, although I have around 2k records in the database.
What is wrong with my query?