I just read the preceding posts And I not sure what you are looking for:
the nearest point to another point or a point within a polygon?
for the nearest, select points inside a box (quick with SQL) and then
SQL SELECT GLength() AS distance
ORDER BY distance
Do you know how to attach a jpeg to a post? is it possible?
Actually first I was looking at the nearest point. Then only I was looking for a point in the polygon. So based on your suggestion I will then use the Within but I am still not clear then when to use contain?
For points in polygon, the choice is not critical:
(g is for geometry)
Within(g1,g2) tell you if point g1 is inside g2 and return 0 (false) or 1 (true)
Contains(g1,g2) tell you if the polygon g1 contains completely the point g2
I don't see any reason to prefer one or the other;
they probably both refer to the same routine.