I’ve got the following problem:
I have a table with long/lat values and another table with a project-id and long/lat/radius (circle).
Now I need to find out which project matches the long/lat values from the first table.
Is there an easy way to do that?
There are multiple algorithms to calculate distance on sphere, but we use following:
(where 6378.137 – is Earth’s radius)
So now when you can calculate distance between 2 points on Earth you can build query
where @YouRadius – parameterized radius of your circle