I want to find the nearest node to a given coordinate. I checked this https://gis.stackexchange.com/questions/186783/how-to-get-the-long-lat-information-from-a-nodeid-and-vice-versa But, his answer doesn't work.
My query:
SELECT PID,
min (DISTANCE(Startpoint(geometry), MakePoint(-79.417589, 43.266571)))
FROM test1f
There is no synax error, but no matter what the point is, it always returns the first record in the database and the distance to it.
I also tried this query
SELECT PID,
DISTANCE(Startpoint(geometry), MakePoint(-79.917589, 43.266571))
FROM test1f ORDER BY DISTANCE(Startpoint(geometry), MakePoint(-79.917589, 43.266571))
I got 50000 results, the first one is what I want. How can I only get the first one?