I've produced the next MySQL table to keep latitude/longitude coordinates together with a reputation for each point:

CREATE TABLE `points` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(128) NOT NULL,
  `location` point NOT NULL,
  PRIMARY KEY (`id`),
  SPATIAL KEY `location` (`location`)

I'm attempting to query:

  • every point inside an n mile radius of the given point
  • the length of every came back point in the given point

All the good examples I've discovered make reference to utilizing a minimum bounding rectangle (MBR) as opposed to a radius. The table consists of roughly a million points, which means this need must be as efficient as you possibly can.

I anticipate your suggestions.

Thank you.

Radius isn't effectively indexable. You need to use the bounding rectangle to rapidly obtain the points you're most likely searching for, after which filter points outdoors from the radius.

Thanks for both your solutions.

I eventually found the answer at http://www.movable-type.co.uk/scripts/latlong-db.html.

Perhaps you have investigated Hilbert curves solutions?