-1

I am struggling with a semi-efficient way to do the following. Ideally through MySQL.

Each search that is performed for this system includes a geo coordinate and a range for that individual. (So essentially a radius and center point).

I want to be able to do a search for another coordinate, and get back a count of how many of those searches included that area.

What is the best way to store the data to make this possible? And how would I structure a query to get that result?

Example:

DATA
Search 1 [-56.1, 43.2], 100 mile radius
Search 2 [-78.23, 45.1], 250 mile radius
Search 3 [-80.1, 44], 10 mile radius
Search 4 [-81.2, 44.4], 50 mile radius

How many searches covered point [-80.1, 44]
RiddlerDev
  • 7,370
  • 5
  • 46
  • 62

1 Answers1

1

you could take a look at spatial data types .. for mysql and fot these You could use mysql st_contain function but due the reason that mysql have not a circle funtion you could could build a poligon with several point that is similar with a circle and use this aproximate . this is not a exact solution but pratically shoudl give you the a result near as you expected

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107