I'm using postgis with gps data, and trying to figure out if one circle with a GPS coordinate and radius (in meters), contains another.
I'm able to do it if I'm not using GPS coordinates, but just points on a graph, but this doesn't work if I substitute with lat and lon points:
-- A circle within a circle
SELECT ST_Contains(bigc,smallc) As bigcontainssmall
FROM (SELECT ST_Buffer(ST_MakePoint(21, 38)::geography, 40) As smallc,
ST_Buffer(ST_MakePoint(21, 39)::geography, 400) AS bigc) foo;
Thoughts?
My approach would be to:
ST_SetSRID(your_geom, 4326)
does this)::geography
does this) to enable setting the buffer radiae in meters,::geometry
does this) for thest_contains
function to workQuery: