force direction to specific road only

326 views
Skip to first unread message

qcwebdev

unread,
Mar 13, 2011, 10:13:41 AM3/13/11
to google-map...@googlegroups.com
Hi everybody
Im looking for a hint to show (hard coding) direction form A to B (100 miles)
FORCING googlemap to take a specific road only
At this time the only way iv found is put a LOT of waypoint between,
but googlemap wont go where my road take a little trip (less than a mile) on highway
Yes i need (Avoid highway) otherwise it takes triple waypoint...and i think there is a max of waypoint

So... Can i FORCE googlemap to show a direction on a specific road only

thanks

geoco...@gmail.com

unread,
Mar 13, 2011, 12:21:28 PM3/13/11
to Google Maps JavaScript API v3
On Mar 13, 7:13 am, qcwebdev <dd.web...@videotron.ca> wrote:
> Hi everybody
> Im looking for a hint to show (hard coding) direction form A to B
>(100 miles) FORCING googlemap to take a specific road only
> At this time the only way iv found is put a LOT of waypoint
> between, but googlemap wont go where my road take a little trip
> (less than a mile) on highway

Do you have an example that shows that?

> Yes i need (Avoid highway) otherwise it takes triple waypoint...and
> i think there is a max of waypoint

There is. They don't make it easy to find though:
MAX_WAYPOINTS_EXCEEDED Too many DirectionsWaypoints were provided in
the DirectionsRequest. The total allowed waypoints is 8, plus the
origin and destination.

(I believe you get more if you have a premier license)

>
> So... Can i FORCE googlemap to show a direction on a specific road
> only

If this same route wants to be displayed every time you load the map,
you might be able to capture the polyline and display it without using
the directions service.

-- Larry

>
> thanks

qcwebdev

unread,
Mar 13, 2011, 3:45:26 PM3/13/11
to google-map...@googlegroups.com
Thanks
but, i really need to follow every turn of that road
Polyline seem to me too basic

this is my test
http://www.ma117.info/direct117.html
im safe with 3 other waypoint (to force highway) + my start and end
But im aware of the instability of the path...due to the fact of the update map of google and found another road to draw
and i dont like to see the DOT location of that waypoint

Sur... if i can retreive the path from google, it would be the best
but there's not that much info to do that
Do you have that kind of info
Thanks

geoco...@gmail.com

unread,
Mar 13, 2011, 6:37:52 PM3/13/11
to Google Maps JavaScript API v3
On Mar 13, 12:45 pm, qcwebdev <dd.web...@videotron.ca> wrote:
> Thanks
> but, i really need to follow every turn of that road
> Polyline seem to me too basic
>
> this is my testhttp://www.ma117.info/direct117.html
> im safe with 3 other waypoint (to force highway) + my start and end
> But im aware of the instability of the path...due to the fact of the update
> map of google and found another road to draw
> and i dont like to see the DOT location of that waypoint
>
> Sur... if i can retreive the path from google, it would be the best
> but there's not that much info to do that
> Do you have that kind of info

Not sure this is exactly what you want:
http://www.geocodezip.com/example_geo2.asp?addr1=(45.504465,-73.677448)&addr2=(46.549345,-75.513043)&geocode=1&geocode=2&waypts=yes&waypt=(45.808284,-74.01798)&waypt=(45.814899,-74.032957)&waypt=(46.063118,-74.296492)

The "get polyline xml" puts the directions polyline data in the xml
format I use on this page:
http://www.geocodezip.com/v3_GenericMapBrowser.asp?filename=ma117_info_direct117a.xml

-- Larry


> Thanks

qcwebdev

unread,
Mar 13, 2011, 9:11:25 PM3/13/11
to google-map...@googlegroups.com
wow...quite complicate to draw a line...its a lot of code to retreive it
im not sure to all understand..
yes.... your page http://www.geocodezip.com/v3_GenericMapBrowser.asp?filename=ma117_info_direct117a.xml
is exactly what i want...im gone try
thanks

geoco...@gmail.com

unread,
Mar 13, 2011, 9:32:18 PM3/13/11
to Google Maps JavaScript API v3
On Mar 13, 6:11 pm, qcwebdev <dd.web...@videotron.ca> wrote:
> wow...quite complicate to draw a line...its a lot of code to
> retreive it im not sure to all understand..

It actually isn't that hard. That page grew into what it is as a tool
for me to use (note also that it is uses v2 of the google maps
javascript API, not v3, the topic of this group; haven't translated it
to v3 yet, nor am I sure I will).

This example is a v3 map using draggable directions:
http://www.geocodezip.com/v3_GoogleEx_directions-draggable2Xml.html
it just isn't set up with a "linkto" functionality.

-- Larry

> yes.... your pagehttp://www.geocodezip.com/v3_GenericMapBrowser.asp?filename=ma117_inf...

qcwebdev

unread,
Mar 14, 2011, 11:22:36 AM3/14/11
to google-map...@googlegroups.com
Ok iv take time to understand and follow the example
it works fine with MY xml file

Thanks you

qcwebdev

unread,
Mar 14, 2011, 6:05:29 PM3/14/11
to google-map...@googlegroups.com
ho!!! all the example is for V2 API
3/4 of the code is unusable with V3 API like this post i find

> 6. XML parser (incl. GDownloadUrl, GXml, GXmlHttp)
These functions were added to v2 back when there were very few other
JS libraries available. In truth though they are not at all maps
related and have no place in a Maps API these days when there are many
other libraries that are focused on providing generic cross browser
utility functions. Consequently we're not planning to add them to v3
but instead recommend you consider alternatives such as Closure.

So i try to re-understand i think with json file
or someone have a V3 way

Thanks

geoco...@gmail.com

unread,
Mar 14, 2011, 6:22:00 PM3/14/11
to Google Maps JavaScript API v3
On Mar 14, 3:05 pm, qcwebdev <dd.web...@videotron.ca> wrote:
> ho!!! all the example is for V2 API

Which examples are you asking about?

-- Larry

qcwebdev

unread,
Mar 14, 2011, 6:35:23 PM3/14/11
to google-map...@googlegroups.com
the one you gave me in this post to draw polyline from xml
using: XML parser (incl.  GXml, GXmlHttp)
These functions were added to v2 back when there were very few other
JS libraries available. In truth though they are not at all maps
related and have no place in a Maps API these days when there are many
other libraries that are focused on providing generic cross browser
utility functions. Consequently we're not planning to add them to v3
but instead recommend you consider alternatives such as Closure.
i dont know what they talking about 

geoco...@gmail.com

unread,
Mar 14, 2011, 7:07:26 PM3/14/11
to Google Maps JavaScript API v3
On Mar 14, 3:35 pm, qcwebdev <dd.web...@videotron.ca> wrote:
> the one you gave me in this post to draw polyline from xml
> using: XML parser (incl.  GXml, GXmlHttp)

Sorry if I confused you, but I specifically said that it was a v2
example and posted a v3 example in this post from this thread:
http://groups.google.com/group/google-maps-js-api-v3/msg/b4b0699da8ca9a08

The page I gave the link to that _displays_ the polyline is v3 also.

-- Larry

qcwebdev

unread,
Mar 14, 2011, 7:28:02 PM3/14/11
to google-map...@googlegroups.com
all my excuse...
all my fault...i just jump on the first example and didnt take attention to the mention of the V2-V3 note.
hoping dont bother you with this post again
My english is not perfect (far of perfect)
Thanks again
Reply all
Reply to author
Forward
0 new messages