It would be a very very useful feature to have the possibility to activate on demand the tracking of the gmap driving directions (with its variables: locale, travelMode, avoidHighway, etc.) on the map for nodes with multiple locations.

a dream? :-)

Comments

d.sibaud’s picture

from the first location inserted to the last, passing trough the intermediates locations.........

Andrew_Mallis@drupal.org’s picture

We need to do just that right now to create a walking tour of San Fransisco. There'd be lots of other applications too, like creating an itinerary for garage sale locations.

d.sibaud’s picture

sound great, if I can give an hand, at your service ;-)

mizerydearia’s picture

I stumbled upon http://googlemapsapi.blogspot.com/2007/05/driving-directions-support-add...
Have GMap directions been implemented in any Drupal module yet?

yesct’s picture

Status: Active » Postponed

wow. I dont think so. I'm going to mark this one postponed.

garbo’s picture

Status: Active » Postponed

Hi all,

I think I have the first half of the solution to creating a driving instructions system.
please have a look at: http://www.archimeer.nl/routes

-Drupal 6
-CCK
-Vieuws
-Gmap
-Location

Here's a website about architecture in a region in the Netherlands. There's a node type called "object" which contains all the information about an architectural object (it's address and location in lat/long degrees and some information about who designed it, what style, pictures etc.).

With the Gmap module and views these are displayed on the map.

Below the you find a small form with which you can select objects in te order that you want tem to appear on your routes. This form is created by writing special templates for views. After clicking the button "bereken route" (eng: calculate the route) a javascript (self written, based on google's example scripts) is executed that queries the google api and returns a new map, in place of the old, with the route printed on.

This all works!

My aim now is that visitors can save their routes into a special nodetype (let's call it "bike_route") so it can be shared with other visitors.
I'm thinking that I should get the Node ID's of the selected objects and paste them in the correct order (as the visitor has chosen) in a simple text field, or an array of textfields of a node of the nodetype bike_route. But I don't know how to achieve that.

If anybody has any suggestions for me, or if anybody has any questions about what I just presented, I would be very interested.

garbo’s picture

Status: Postponed » Active

activating this thread again.

garbo’s picture

Status: Postponed » Active

Hi, I've improved the driving directins feature on www.archimeer.nl/nieuw/fietsroute

Now the driving directions are saved as nodes!

The node-type "fietsroute" has a node-reference field in it that references the nodes that hold the locations along the route (architectural points of interest for this website)

Let me know what you think of this solution. Questions and remarks are more then welcome.

tohia’s picture

tohia’s picture

That's simply brilliant garbo. Does it use location module to store the location data, or a custom content type?

garbo’s picture

@tohia

It uses the location module to store the locations of the architecture object nodes. It uses a node (node-type: "route") to store the chosen objects along a route in a node-reference field.

The route is calculated on page-load by the Google Maps API.

greenskunk’s picture

Awesome job @garbo !

To help you I found some bugs:

  • Breadcrumb link is linking to a page that doesn't exist

    Home » fietsroute » GreenSkunk from America

    fietsroute links to fietsroute instead of nieuw/fietsroute
  • Routed items don't link to their nodes
d.sibaud’s picture

Viva Garbo, kool implementation, will you share this solution?

nemchenk’s picture

I'm trying to do exactly the same thing now - a walking tour of Bristol. garbo, any chance you could explain in more detail how you've done your site? With code examples?? :)

Many thanks in advance!

nemchenk’s picture

I'm very close to getting this working -- I've got the GDirections object loading and can display the directions in a DIV. Can't seem to get the GPolyline to display on my view-generated map however :(

Also, I've got more than 25 waypoints, so will need to figure out how to "batch" the loadFromWaypoints() requests...

Any tips appreciated!

http://explore.englandspastforeveryone.org.uk/taxonomy/items/1027

nemchenk’s picture

Almost working now, thanks to http://drupal.org/node/150939#comment-1285426 . The basic problem is that gmap and gdirections can take a while to initialize, so the trick is to set up callbacks for when they are ready

nemchenk’s picture

Right, all done :D The basic idea is:

1) Get Views to produce a GMap
2) Use the Footer of the view (PHP Code filter) to print out some custom HTML and JS: the DIV to hold directions, the script which will process the GMap after Views is finished with it
3) Make sure you only get started on the map object after it has been initialised by setting an action handler
4) Compile an array of waypoints. You might need to split the array if you have >25 waypoints
5) For each batch of 25, create a new GDirections object and load the waypoints into it
6) Hide the markers afterwards
7) Re-center and re-zoom the map

http://explore.englandspastforeveryone.org.uk/taxonomy/items/1027

Naturalist’s picture

Garbo,
I sent you a email with questions!

summit’s picture

Hi, What about this module: http://drupal.org/project/gdriving
It's on D6, but isn't almost everything that nowadays...
greetings,
Martijn

Naturalist’s picture

Does it do multiple locations?

summit’s picture

I don't know ask the module owner :)

Naturalist’s picture

The topic was in reference to multiple locations. If you don't know why did you mention it?

summit’s picture

Because this module may be does already what you want, sorry, no time to go into it more.
Thought to mention it because of the question about Driving Direction.
greetings, Martijn

nemchenk’s picture

summit’s picture

Dima,

Can You provide the code how you did this please?
Thanks a lot in advance for considering this.

greetings,
Martijn

nemchenk’s picture

Hi Martijn,

Well, the outline of the process is in #17. First you need to set up a working GMap view, and sort the items in the view into the order you want them in your directions.

Next, you use the Footer of this view to spit out some HTML and the Javascript which will use the GMap API to manipulate the GMap generated by the view. My one is set to the PHP Code filter, and spits out:

<?php drupal_add_js('misc/collapse.js'); ?>
<fieldset class="collapsible collapsed"><legend>Directions</legend><div id="directions"></div></fieldset>

<?php drupal_add_js($theme_path.'/js/gmap_trail.js','theme'); ?>

As you can see, it is creating the fieldset and div for the directions, and adding Drupal's own collapse.js to make the fieldset work.

Then it is adding my own gmap_trail.js, which actually does the work of changing the Views-generated GMap into a walking trail. You can download this file from
http://explore.englandspastforeveryone.org.uk//sites/explore.englandspas...

Let me know if this makes more sense, or if you need more help with the explanations of what is happening on that page :)

summit’s picture

Hi Dima,
This is for D5, does it also work on D6 Location? Would be great, because I am on D6 with my site :)
greetings, Martijn

nemchenk’s picture

Martjin, #26 is on D6.17 :]

Naturalist’s picture

You know it doesn't do multiple stops that is why your also inquiring about this. Isn't that right?

nemchenk’s picture

@Naturalist: what doesn't do multiple stops? What are "multiple stops"? My example clearly shows ~45 locations all strung together with walking directions -- isn't that "multiple stops"? Sorry, Naturalist, I'm not following what you are saying, or to whom.

@Martjin: had your email and lost it -- resend?

Naturalist’s picture

#19
Summit - June 21, 2010 - 05:15

Hi, What about this module: http://drupal.org/project/gdriving
It's on D6, but isn't almost everything that nowadays...
greetings,
Martijn

Naturalist - June 21, 2010 - 18:56

Does it do multiple locations?

Summit - June 22, 2010 - 07:05

I don't know ask the module owner :)

hence

You know it doesn't do multiple stops that is why your also inquiring about this. Isn't that right?

The post was directed towards Summit no one else.
I think it improper to suggest something unless you clearly know it will do what a person wants. Since the topic is "Using Gmap Driving Direction with multiple locations" and the person doesn't know if it does multiple locations why did they suggest it? Grrr.

Marjin can send me a email through account anytime. I would appreciate it.

yesct’s picture

I dont think Summit was out of line to suggest another solution, even if that solution is not a perfect fit for a situation. This is a pretty common thing to do. A simple reply of "That wont work for me; I need multiple stops." is an OK response. Lets move on.

nemchenk’s picture

@Naturalist:

"The post was directed towards Summit no one else."

Fair enough, but since it immediately followed my post, I assumed you were asking me. In future, a short "@user" before your post could help prevent such misunderstandings.

summit’s picture

@Naturalist Hi, sorry to suggesting gdriving I wanted to help, now I installed it, and indeed it doesn't do multiple stops, but may be the module maintainer will put it in for you, I don't know about that. Sorry to post this not working solution..but I only wanted to help.

@Dmitri Will send you my email again :)
EDIT: Dmitri got a out of office reply :), will send you a contact pm.

greetings, Martijn

Naturalist’s picture

I was only trying to point out that in some situations a for sure suggestion is more appropriate. That is all. Nothing personal by no means. Have a wonderful weekend!

chaloalvarezj’s picture

Subscribing.. (to check functionality later)

mototribe’s picture

subscribe

ankur’s picture

Status: Active » Closed (won't fix)

From the discussion above, it looks like there's a way to accomplish this without adding new code to this module. Also, I'm going to rule this as being beyond the scope of this module.