Those of you who attended DevCon 2011 in San Diego may recall meeting Andries Heylen of BH&A, who cheerfully answered questions in the FileMaker Visionary Bar. Well, from the sow’s ear demo I posted in part 1, Andries has woven a silk purse (google-route-mapping-part-2), which I am sharing with his permission, and which uses Google “waypoints” to produce an optimized travel route.
Notes from Andries:
- The google distance API allows you to just send a start point, an end point and some waypoints (or just waypoints works as well) and returns the path to it in XML.
- In the XML there is a node that has an encrypted path in it that you can send back to the Static Google Maps API, which will return the image. I combined it with putting the markers on it as well, which are just one of the many parameters you can send to the API.
- I use some custom functions from Fabrice Nordmann and Andy Knasinski to parse out the XML, and there is the a custom function I made to convert the “content” created by the webviewer on Windows back into some nice XML
- The webviewer refreshes on datachanges, which makes this demo so interactive.
- The principle of Virtual List is used to show the Directions.
Thank you Andries for generously sharing this with the FileMaker community.
13 thoughts on “Google Route Mapping, part 2”
This is great! Thank you both!
Absolutely amazing – both of them.
Andries’ version is breathtaking and an incredible learning tool for a bunch of techniques.
Kevin/ Mark’s is a triumph of simplicity.
Thank you, All!
Hello to all, very interesting solution, I keep on coming back to this page. But I am not able to implement this solution…what is the method to change the list of directions ? I’d like to use my database address list creating an API for each item, is it possible ? thankss
What do you mean? Did you take a look at the “under the hood” tab. It is all about creating the correct URL, and set the webviewer.
Watch out that you are not allowed to use the google API for “closed” applications. Only application that are freely accessible.
We use openlayer (based on openstreetmaps) for our commercial solutions.
Someone know how to put more than 30 waypoints on the map ?
this is certainly possible. The problem lies probably in the URL length which is limited. If you want to overcome this you can first geocode each point which allows you to send more points (as each point takes less space in the URL) to the API.
Google also provides an API to geocode addresses.
Hello, would it be possible to establish a route based on a list of address and then have the ability to modify the route suggested via an interactive window? I suppose you could then feed the changes through the directions API to recalculate distance and time?
Yes I know the image API only provides images but my problem is that “shortest route” is rarely the best route for what we do. We run a trucking company and road restrictions dictate where we go. I haven’t done java in over 12 years and I’ve never been much of a programmer, I just get by I suppose.
Having an interactive map where you can drag and pull on the suggested path to then run it through the directions API would be a tool that would be out of this world handy for our planning.
Thank you for your reply.
Would it be possible to generate multiple vehicle route scheduling? Like if I had 100 stops and 10 vehicles, I could run a script and have them auto route based on time, distance and a few other rules? Oh, and if you can do this, please contact me, firstname.lastname@example.org. I’m hiring!
Wow that was strange. I just wrote an really long comment but after I clicked submit my comment didn’t show up.
Grrrr… well I’m not writing all that over again.
Anyways, just wanted to say wonderful blog!
Brilliant functionality, I had a simple, single pin map button for individual records and added a route planner using your methodology, both working fine. Recently both stopped working correctly, not sure exactly when, giving a 500 error.
A minor tweak to the map URL allows the pins to show now, but I still have been unable to bring back the route information – any ideas what the problem could be?
First of all thanks a mill for your sample file. What I am looking for is a webviewer to show multiple addresses on Google maps with different color markers, I have a solution to show them all in red but as I am not a coding person I have no clue how to change their colors.
I realized that in your file we are able to change the color based on value of a field. I gave it a try and it works for me to shpo only one address with desired color, Here is the url address I used:
“http://maps.googleapis.com/maps/api/staticmap?size=440×440&path=weight:7 |enc:&markers=&markers=color:”&MainTable::Marker_Color & MainTable::Address & “ID&sensor=false”
My questions are:
– How can we zoom in and zoom out?
– How can we show multiple places on the map with different colors?