Quickly add Google Driving Directions to your rails application
Do you want driving directions on your website but don’t want to mess around with the Google Maps api?
Well, you can easily implement Google driving directions by calling the url: http://maps.google.com/maps?saddr=start_address&daddr=dest_address&hl=en
So, in Rails you could do something like this:
<%= button_to_function "get driving directions", "window.open(\"http: maps.google.com maps?saddr="#{URI.escape(" source_address)}&daddr="#{URI.escape(destination_address)}&hl=en\")"" %>
%=>
Where source_address and destination_address are string variables containing things like:
London -> Manchester
SE5 0LL -> NW6 6RJ
221b Baker St -> 10 Downing Street
This method handles all the geocoding for ya – and is way simpler than messing with the GDirections api object.