David Kates, Alpha consultant and owner of Rune Systems Inc., demonstrates how he uses Alpha Anywhere's tightly integrated mapping and geolocation features to build web and mobile apps for business.Ontario is having one of the coldest winters on record this year and, unfortunately, that’s where I live. Just north of Toronto in a little town called Unionville there’s not a mature tree left standing without major damage due to the storms. This cold got me thinking about how the guys who fix furnaces get around in terms of job priority. I thought that building web apps for small business heating companies would be an interesting challenge for Alpha Anywhere and, as it turns out, Alpha met it well.
Using Geocoding and Mapping I was able to start with some basic data such as street address and get the latitude and longitude using Alpha functions. Alpha has an option to use Google to Geocode and this works very well.
After I’ve got a latitude/longitude location I can calculate a distance to each job from a central location. I can also calculate a distance from job to job. Both interesting pieces of information but possibly not very helpful.
For this project I gave each job an urgency with the first four jobs having an urgency of 1,2,3 and 4. The balance of my 10 jobs I assigned an urgency of 5. My grid sorts on urgency so that the most urgent job will show first. But what about the 6 jobs with the same urgency? Having a distance from a central location isn’t going to help plan the best route from job to job. Also having a distance from job to job isn’t going to help unless we sort those jobs based on the shortest distance between jobs.
In order to do this we take our last location which was Job 4 and have a look at the balance of jobs that need completing. Out of the 6 jobs we have left we calculate the shortest distance to one of those jobs from our last location and set that job as the next Route Priority. We then look at the balance of jobs once again, now 5 jobs, and calculate the shortest distance, and so one until we’ve completed the route.
Thanks to Alpha Anywhere, we can calculate the most efficient route for a given number of waypoints.