I'm using PostGIS 2.0.1 and need to determine whether a circle (center + radius) intersects a county boundary (polygon).
The query I'm using is this:
SELECT DISTINCT(u.id) FROM siteareas_poly sa, userlocations ul,
clienttypes ct INNER JOIN users_clienttypes uct on ct.id = uct.clienttype_id
INNER JOIN users u on uct.user_id = u.id
WHERE sa.id = 'concord' and ct.id = 2
AND ul.geog_lnglat is not null
AND ST_Intersects(st_exteriorring(sa.boundary), ST_BUFFER(ul.geog_lnglat,ul.radius_km * 1000)::geometry)
where the ul.geog_lnglat is a
geography(Point,4326)
and the sa.boundary is
geometry
I've tried a few variations on this and always gotten no results, when I expect to get at least one, as I have a row in userlocations that lies in that county (by zip lookup).
Am I making any glaring errors in my approach?