My table has two floating point columns for latitude and longitude coordinates.
I want to use PostGIS ST_DWithin to find all records that are at a certain distance from a given point.
The signature ST_DWithinexpects the first two parameters to be geometric or geographic data types, so I'm sure the solution is to convert lat / lng coordinates to geopolitics, but I can't get it to work.
Here what does not work:
SELECT *
FROM stops
WHERE ST_DWithin( ST_GeogFromText('SRID=4326;POINT(-77.09 38.89)'),
ST_GeogFromText('SRID=4326;POINT(' || stops.lng || ' ' || stops.lat || ')'), 10000.0)
I get this error:
ERROR: st_geogfromtext function (unknown) does not exist
LINE 1: SELECT * FROM stops WHERE ST_DWithin (ST_GeogFromText ('SRID = ...
What am I doing wrong?