0

I am building an application that has to show some markers to the user basing on a circle characteristics.

Specifically, a PHP script will be called with two parameters:

  • Circle center (in Lat,Lng format)
  • Circle radius (in Km for now, but I can use jQuery to elaborate if needed)

The script has a LOT (~16000) of coordinates pairs, but it takes no time to him to scan them all.

Instead, sending the whole thing to the client browser and have him elaborate the thing is crazy slow.

So, I would like to know this: Can I, via PHP, scan all the entries and head out to the listening js only those whose coordinates are in the circle?

Thank you, Riccardo

Guerriky
  • 529
  • 1
  • 5
  • 15

1 Answers1

0

If the distance from the point to the center of the circle is less than the radius of the circle, the point is inside the circle.

calculate distance PHP

Community
  • 1
  • 1
geocodezip
  • 158,664
  • 13
  • 220
  • 245