A while ago, I made OptiMap, a Google Maps mashup that will take a number of locations and give you the best way to visit all of them. By best, I mean fastest. Since then, I have been exposed to various ideas on applications for this tool. One is in the real-estate business, where prospective home buyers want to visit a number of houses for sale.
To make things easier for anyone interested in applying this tool, there is now a way for your website to make search requests automatically. This is done by sending a http GET request to http://gebweb.net/optimap/index.php?loc0=start&loc1=dest1&loc2=dest2. Here,
start should be replaced by the address or (latitude, longitude) pair where your trip starts and ends, and
dest2 each should be replaced by either an address or a (latitude, longitude) pair you want to visit.
Up to 100 locations can be specified in the variables loc0, loc1, …, loc99. You can also add labels to each location by using label0, label1, etc. Remember to http-encode any whitespace etc. in your address strings. This is done automatically if you use the html form element to store your data. Example:
<form NAME="roundtrip" METHOD="get" ACTION="http://gebweb.net/optimap/index.php">
<input NAME="loc0" TYPE="text" />
<input NAME="loc1" TYPE="text" />
<input NAME="loc2" TYPE="text" />
<input NAME="loc3" TYPE="text" />
<input TYPE="submit" VALUE="Submit" />
document.roundtrip.elements["loc0"].value = "2 Bloor St West, Canada";
document.roundtrip.elements["loc1"].value = "(37.4419,-122.1419)";
If you have any comments, bugs or feature requests, please leave a comment on this site 🙂