Drupal: GMap Integration with Directions

Joined: 04/30/2010

I think it'd be a cool podcast to see how to integrate a map with the ability to get directions using a form right on the page. Just an idea!

Joined: 09/09/2008
Lots of us would like this, BUT

Lots of us would like this BUT I'm not sure it's possible without spending megabucks. I'm pretty sure (I did a lot of searching for a way some time ago) that Google only makes this available to premium subscribers and that places it out of the reach of virtually any church.

You can have your Google maps link to Google to provide directions.

Curt

Joined: 09/09/2008
Update: GMAP with Driving Directions

I'm DELIGHTED to report that I've discovered someone else's solution to this problem and it's relatively easy to implement. The solution was contained in a comment to a post on drupal.org, in a l*o*n*g string of comments, and I've lost the reference.

Here's how it works: We create a view to show a location, or locations, on a map. Included in the fields are the address components (street, city, state, etc.) and/or latitude and longitude. These fields may, or may not, be displayed; nothing too unusual here. Then we add a field where we rewrite the output and in that rewritten output we build a link to maps.google.com.

Here's an example: These are the fields taken from a view on a site I'm developing:

Node: Nid
Location: Name
Location: Street
Location: City
Location: Province
Location: Postal Code
Location: Latitude
Location: Name
Location: Longitude

  • The Latitude and last Name fields are "Excluded from Display." (Name is repeated because the first one is rewritten for another reason and after rewriting wouldn't be suitable to use here.)
  • The Longitude is rewritten like this:
     
    <a href="http://maps.google.com/?daddr=[latitude],[longitude]( [name_1] )&z=11" target="tt-ext" >Get Driving Directions</a>

You could use the more typical address fields for the daddr parmeter and let Google compute it, and this is what I'd typically do. However, for this site I've got a location that gets placed inaccurately so I override the location by specifying latitude and longitude manually. The data between the parentheses, ( [name_1] ) gets added to Google's display.

This isn't a very fancy tutorial, but it should get you going.

I hope this helps. Please feel free to ask questions.

Curt

Joined: 08/05/2010
order locations by date

do you think it would be possible for this view to order the locations by date ?

I am trying to construct a trip planner based on events which have both dates and locations.

Joined: 09/09/2008
Sure

Add a date field to your content type, include the date field in the fields in the view (you can exclude it if you wish), then add it to your sort fields.

Hope this helps,
Curt

Joined: 08/05/2010
thanks will try that

I have little experience with views and I tried to follow the instructions above with no luck. If you can give more details that would be great.