Simple add waypoint to directions

599 views
Skip to first unread message

Dev Web

unread,
Jun 14, 2011, 8:57:40 AM6/14/11
to google-map...@googlegroups.com
I apolgise if this is not the right forum but I am using v3 to display a map on a website.
However I have a very simple form which with the input of the persons home address, the route to the destination is caclulated and displayed.
 
I have looked at the APi v3 directions and am totally lost and it seems over complicated.
Could anyone kindly show me if it is possible to add something to the 'daddr' to create a waypoint (Gulworthy) before the destination address:
Here is the code:
<form id="route" action="http://maps.google.co.uk/maps" method="get" target="_blank">
     <div id="google2" class="centerparagraph">
      <h3>Driving directions?</h3>
      <p>Please enter your postcode and click 'Route Map'</p>
      <p>Enter your postcode
      <input type="text" id="saddr" name="saddr" value="" /></p>
      <input type="hidden" name="daddr" value="50.545194, -4.209657" />
      <input type="submit" value="Route Map" /> </div>
    </form>
 
Thank you.

Rossko

unread,
Jun 14, 2011, 11:57:42 AM6/14/11
to Google Maps JavaScript API v3
> I apolgise if this is not the right forum but I am using v3 to display a map
> on a website.

mm, but your directions form doesn't use v3 API at all. It's just a
hotlink to maps.google.com (in its co.uk disguise)
Forum for maps.google.com
http://www.google.com/support/forum/p/maps?hl=en

There is some info about maps.google.com parameters here
http://mapki.com/wiki/Google_Map_Parameters
see in particular
http://mapki.com/wiki/Google_Map_Parameters#Directions

Dev Web

unread,
Jun 14, 2011, 12:37:29 PM6/14/11
to Google Maps JavaScript API v3
Thank you for your guidance.
I had tried the paramaters with no luck but now you have shown me the
right forum, I have posted in there.

On Jun 14, 4:57 pm, Rossko <ros...@culzean.clara.co.uk> wrote:
> > I apolgise if this is not the right forum but I am using v3 to display a map
> > on a website.
>
> mm, but your directions form doesn't use v3 API at all.  It's just a
> hotlink to maps.google.com (in its co.uk disguise)
> Forum for maps.google.comhttp://www.google.com/support/forum/p/maps?hl=en

Rossko

unread,
Jun 14, 2011, 3:17:11 PM6/14/11
to Google Maps JavaScript API v3
> I had tried the paramaters with no luck but now you have shown me the
> right forum, I have posted in there.

It might be more useful to share the attempt that didn't work, as by
asking "how do I .." you'll just get pointed to the how-to info again,
that you already know apparently

This works
http://maps.google.co.uk/maps?saddr=Rochdale&daddr=Blackpool+to:Manchester
and so does
http://maps.google.co.uk/maps?saddr=Rochdale&daddr=Blackpool+to:50.545194,-4.209657

Dev Web

unread,
Jun 15, 2011, 10:54:02 AM6/15/11
to google-map...@googlegroups.com
Thanks again, especially for trying to help me out with the ones you got to work.
 
I had tried that method but as I was using a form to post to get mapping directions the +to: etc just gave errors.
I found adding another input field as below worked.
 
<input type="text" id="saddr" name="saddr" value="" />
<input type="hidden"  name="daddr" value="Gulworthy,Tavistock" />
<input type="hidden" name="mrad" value="50.545194, -4.209657" />
I just did not understand the APIv3 method of getting directions, especially where it fitted into the <head> in relation to the map code I already had there.
As mentioned I am using v3 to display a map but if you know of an example webpage where a  basic map is shown, then a box exists for a variable(could be anywhere in UK) 'from' destination to a fixed destination, via a waypoint, I would be very interested to see it and try to use the code on my site.
 

Rossko

unread,
Jun 15, 2011, 2:30:32 PM6/15/11
to Google Maps JavaScript API v3
> I had tried that method but as I was using a form to post to get mapping
> directions the +to: etc just gave errors.

You probaly need to URL encode stuff, the + in particular I'd guess

> I just did not understand the APIv3 method of getting directions,

It's completely unrelated to what you are doing with maps.google.com
URL parameters
Reply all
Reply to author
Forward
0 new messages