# We know where we're going, just not where we're coming from.December 29, 2011 9:15 AM   Subscribe

We're looking for an app that will help logically determine which store should deliver to a given customer, based on drive-time.

Asking for Mrs. Bastard: She works for a company with some forty retail locations in and around our major US metropolitan area. They deliver product to businesses and private homes via driver employees. The process is: The product is picked up from one or more stores and driven to the customer at a specified time.

We'd like a simple, automated way to plug in a customer's location and quickly determine which of the 40 stores should produce the order based on drive-time. We should also be able to determine second and even third-place store locations in case order volume exceeds the first pick's production capacity. We forsee a time in which this will be occurring regularly.

I expect there is something in Google Maps that can help with this but have no idea how to go about looking or what to even search for.
posted by BigLankyBastard to Computers & Internet (12 answers total) 1 user marked this as a favorite

I suspect you and many academics who've been studying this problem for decades are in the same boat. Is there a Mathematica app you can use? There is a Wolfram Alpha app.
posted by zomg at 9:25 AM on December 29, 2011

You want GIS. I don't know of a simple free program off the top of my head, but here's the leader in the GIS industry (link to their Network Analyst software).
posted by desjardins at 9:27 AM on December 29, 2011

This is not the Traveling Salesman problem. He just wants an app that takes a fixed point (customer), calculates distance to each store and then returns the closest one.
posted by vacapinta at 9:28 AM on December 29, 2011

zomg, that's not the same problem, because he's not asking how to go from customer to customer (A to B to C), but which store should deliver to the customer (X or Y or Z to A)
posted by desjardins at 9:28 AM on December 29, 2011

*facepalm*

posted by zomg at 9:29 AM on December 29, 2011

Anyway, "network optimization" is your keyword. It's way beyond the capability of Google maps, sorry.
posted by desjardins at 9:30 AM on December 29, 2011

Here's another term: "closest facility analysis," and another company that offers GIS software to do this (note: I have never heard of them).
posted by desjardins at 9:37 AM on December 29, 2011

if you are willing to settle for a none automated solution, you could add all of the store locations to a custom map and eyeball the closet one.
posted by phil at 9:53 AM on December 29, 2011

I am sure there are existing apps for this, so forgive the vagueness :)

Since there are *only 40 stores*, a reasonable algorithm is:

* given customer location L (gettable from google maps api, for example)
* use lat-long euclidean distance from each of the 40 stores to the location
* pick the shortest.

A Python / Ruby / Perl / Whatever hacker, and a PostGIS instance can put this together in a day or two, if you are serious about it.

Brute-force is fine, especially since 'close' answers are okay.

Holler if you really want such a thing, and we can discuss a price.
posted by gregglind at 10:01 AM on December 29, 2011

I also found code for a proximity query using the Google App Engine.
posted by desjardins at 10:28 AM on December 29, 2011 [1 favorite]

you could also use a radius search (non-drive-time) if you have GPS coords.

I'd shoot for the Google method, and pay some local developer to code an app up for your company.
posted by zombieApoc at 10:54 AM on December 29, 2011

Microsoft MapPoint will do this and attempt to automatically optimize the route as well. It may be a bit cheaper than ESRI's offerings.

It even has development hooks, so that you could integrate it to local programs + data.
posted by jkaczor at 6:01 PM on December 29, 2011

« Older Which way to go in my continuing education?   |   "Three little sentences will get you through life.... Newer »