1

This question already has an answer here:

I'm trying to use the ST_Point_Inside_Circle function from PostGIS but I'm not sure about the unit the radius is stored.

Let's say I have a table with the following points:

   Id | Point
    1 | POINT(-60.64855 -32.96482) 
    2 | POINT (-60.65871 -32.93411)

and I want to query them by doing

 st_point_inside_circle(Point,
 -32.93690, -60.64343, radius)

Now, I know that distance from (-32.93690, -60.64343) to P1 is of about 1460 m and from (-32.93690, -60.64343) to P2 is of 3117.5 m. Using a trial-and-error approach I was able to determine that if radius < 0.02839 and radius > 0.02838 I was able to get the 2 points in my query. However, the value for radius doesn't make much sense. Which units is it expressed in? Since the distance between points is too short, I don't think that not using a spheroid would affect the results. Maybe I am doing something wrong. Should I use ST_Buffer instead?

marked as duplicate by Vince, Fran Raga, JGH, Andre Silva, Ian Turton Jun 11 at 8:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    The units are the units of the geometry, which is degrees. Doing anything in Cartesian degrees is a recipe for disaster, so I suggest you test to see if casting your Point column to geography results in proper meters operation (on a spheroid). See also this post on indexes that cover cast geometry – Vince Jun 7 at 3:00