How Auto-Radius Works
One of the most useful features of the BMLT is the “auto-radius” capability. This is where you simply click somewhere on a map, or enter a location, and you are presented with a result that includes the nearest few meetings to that location.
How far afield the search goes to get these meetings is determined programatically. I’ll cover exactly how this is done in this post. It’s a bit technical, but nothing too bad.
First, there are a set of discrete steps that are defined in the /main_server/server/config/comdef-config.inc.php file. The define is an array called “$comdef_map_radius_ranges”. Here is the default one:
$comdef_map_radius_ranges = array ( 0.0625, 0.125, 0.1875, 0.25, 0.4375, 0.5, 0.5625, 0.75, 0.8125, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.25, 4.5, 4.75, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 17.5, 20.0, 22.5, 25.0, 27.5, 30.0, 35.0, 40.0, 45.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 150, 200 );
These are the steps the calculator uses to determine a suitable radius. These values are different from the ones that appear in the Advanced Search popup menu.
You can override this in auto-config.inc.php. You do that by simply redefining it with your own numbers. The BMLT Root Server will choose the one in auto-config.inc.php over comdef-config.inc.php.
Also, in auto-config.inc.php, there is a setting, called “$number_of_meetings_for_auto”. This defaults to 10. What this says, is “Give me AT LEAST 10 (in this case) meetings nearest the center of the search.” The center of the search is determined by a map click, a coordinate submitted to a semantic search, or an address.
When you do an auto radius, the search starts just at the center, and then goes outward in the steps outlined by the $comdef_map_radius_ranges array. At each step, it looks for the number of returned meetings.
If the number of returned meetings is still less than $number_of_meetings_for_auto, it expands to the next step. This continues outward to the end of the $comdef_map_radius_ranges array.
The actual meeting search radius might be a bit different from the fast one that is used to determine the search (it’s technical), so there might be a slight difference; resulting in fewer meetings than $number_of_meetings_for_auto, but this is rare. It is usually greater than $number_of_meetings_for_auto. Sometimes a lot greater. The radius search chooses the step that gives it $number_of_meetings_for_auto number of meetings OR MORE.
If you have meeting places with large numbers of meetings (like clubhouses), this can result in unusual responses. For example, at 10 Miles, there may be 7 meetings, but at 12 Miles, there might be 50, because a couple of clubhouses were included, and that added a lot more meetings to the search results. The search would stop at the step that finds 50 meetings (12 Miles), even though 7 meetings would probably be more useful than 50.
It is also possible to get extremely wide search radius results. For example, if you have 2 towns that are small, 60 miles apart, and each have 8 meetings within a small area, doing a search on one of the towns will expand to the other town, because neither of the towns has more than 10 meetings.
Let’s look at some examples, using the given simplified default array, in miles:
$comdef_map_radius_ranges = array ( 0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 17.0, 20.0, 22.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 150, 200 );
In the first example, we will set $number_of_meetings_for_auto to 2:
The half-mile step is enough to find 2 meetings, so that’s where the auto-radius stops.
Now, the default ($number_of_meetings_for_auto = 10):
It finds 10 meetings exactly within a 1-mile radius. The red markers indicate places that have more than 1 meeting.
Now, let us set $number_of_meetings_for_auto to 11. Just 1 more than before:
In this case, the next step out is 2 miles, and that returns 24 meetings.