PostGIS: Closest polygon to point
Several ways to do this. One is to find the distance and order ascending.
SELECT geom
FROM polys, points
WHERE points.gid=1 AND ST_DWithin(poly.geom, points.geom, 1000)
ORDER BY ST_Distance(a.geom, b.geom) LIMIT 1;
I added the ST_DWithin call to show how you might limit the number of candidates (it will make use of the index.)
I use ST_ClosestPoint to return the closest point from each polygone, then I calculate the min distance
SELECT foo.* from
(SELECT min(st_distance(a.geom,ST_ClosestPoint(b.geom,a.geom))) from polyg a,point b) foo