PROBLEM - The Director of Network Operations would like to know the average distance a customer in their membership program is away from their nearest store. Whilst the Director understand that using routing would deliver a more real-world answer to the question, they have been called in by the General Manager to answer this question at a meeting in 5 minutes time – straight-line distance will be adequate in this instance.
Here, we will be focusing on one of the in-built tools that ship with MapInfo Pro – Distance Calculator. Put simply, the Distance Calculator tool calculates the distance from a selected object (or group of objects) to the closest or farthest object(s). Whilst it is possible to apply the Distance Calculator to a single table, the typical scenario (as per the examples mentioned above) occurs between two tables. The Distance Calculator operates with points, line or polygons and selection criteria can be applied to control the results (for example, find me the nearest 5 sites from each starting point and ignore values equal to 0).
SOLUTION - Fortunately, the membership data (Customers) is already mapped as are the store points (Sites). Both datasets are opened into a map window in MapInfo Pro as per the sample image above.
The Distance Calculator tool can be accessed in multiple ways. A quick and easy way to locate any of the functionality within MapInfo Pro is to use the Quick Search tool in the top right-hand corner of the program window. By typing "distance calculator" in to the Quick Search panel, there are 2 options immediately presented as ways of accessing the Distance Calculator tool.
I choose to select the second option listed and am then presented with the "Distance Analysis" dialog box. The left hand side of the Distance Calculator dialog has selection tools that allow objects to be selected spatially (if appropriate) from the map window provided as part of the dialog, and there are controls to switch between Map windows. The origin and destination tables used in the calculation are selected on the right hand side of the dialog. Customers1 will be the "origin" and Sites1 the "destination" tables used in this example. The right-hand side also allows for the configuration of criteria impacting on the outcome. In the "Set Criteria for Destination" area below, there is some attribute related selection criteria to filter the destination locations to be used in the calculation of distances if necessary.The problem to be solved in this instance only needs the nearest retail location (no filters) to all customers, so in this instance the dialog will be completed to "Find the closest point" and 1 will be entered against "Enter the number of distances to find". If the answer required the nearest 5 sites then the number entered against the number of distances to find would be 5.
In this example I have also unchecked the "Ignore distance of 0" option as I do not want to exclude any outcomes. Note - this option is particularly useful when using the Distance Calculator on a single table in order to exclude the origin point also being considered as a destination point. To solve this problem and provide the Director with the information they need, we want the distances calculated to be returned in "kilometres" so we choose that as the distance unit to apply from the relevant dropdown box.
Once satisfied that the correct origin, destination and criteria information has been entered, click "Calculate" to perform the calculations as defined. Outcomes generated are placed in the browser part of the dialog in the bottom left-hand corner.
Once the process is complete click on the "Save Results" button to save the outcome. Once saved, open the table in MapInfo Pro and you will see that the Distance Calculator not only delivers the tabular results as shown in the dialog box but also produces a line linking each location with the nearest site.At this point there are a number of methods available to generate the average distance travelled by a customer to a store. A very simple approach is to take advantage of another built-in tool under the Table tab – Calculate Statistics.Click on "Calculate Statistics" and enter the table name calculated by the Distance Calculator and the field that contains the distances. Then click OK and a group of summary statistics are returned which include the minimum, maximum and average (Mean) distance.So, within a matter of just a couple of minutes MapInfo Pro and the Distance Calculator have delivered to the Director the required information for their meeting with the General Manager – making them look good in front of their Boss and highlighting the value of location intelligence to the business. A classic case of Win/Win powered by the capability of MapInfo Pro.
We would love to hear how MapInfo Pro users have applied the Distance Calculator in solving various business problems or just let us know what your favourite MapInfo Pro MBX is.