Hi,

You can simply try to use order by distance and limit statements. 

SELECT * FROM pt_table
ORDER BY ST_Distance(ST_MakePoint(lon,lat, 4326), geom)
LIMIT 4

Of course you clan use ST_Transform to ensure the consistence of your data.

HTH

Hug



Gerry Creager - NOAA Affiliate <[email protected]> a écrit :

I need to query a rather smallish database and return 4 points closest to a
lat/lon (or lon/lat, if you prefer) statement. I've been off-line from
PostGIS and my skills are worse than rusty right now...

Thanks
Gerry
-- 
Gerry Creager
NSSL/CIMMS
405.325.6371
++++++++++++++++++++++
“Big whorls have little whorls,
That feed on their velocity;
And little whorls have lesser whorls,
And so on to viscosity.”
Lewis Fry Richardson (1881-1953)
_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Reply via email to