[Real life Geometry] Check if a point is inside a circle on a map.
Ok, frist I don't know if this the right sub for this but i don't know where to ask.
Now I have to check if a point is inside or outside of a circle on a map
For example: My point is in (20.66, -103.39) and my circle is described as a center at (25.78,-100.11) and a radius of 2863.5246 meters. I know this points are nowhere near each other (they are at different cities).
Searching around I found this formula
(x-center_x)^2 + (y-center_y)^2 < radius^2
But this always end up as
32.040294860158376 < 8199773.51794705
So it is always says inside the circle, even though the point is not...
I think my problem is that I'm comparing coordinates on a map to meters and that makes no sense, but i don't know what unit should I convert or if this is even the right approach to the problem.
I'm doing this with node, if someone with programming skills knows a hack or two.
Thanks and I'm not a native english speaker so excuse any errors i might have :)
Edit: The points are in latitude and longitude
Posted Jun 22, 2017, 6:33 AM UTC · edited