implementation-get-direction-drupalmap-route-directions

Jul 02,2014/Posted by Bharath Kumar

The Get Directions module provides the ability to get directions to and from places using Google Maps.

Implementing get direction for a Drupal website will help you give a route map to your required area after user enters from and to addresses. Or you can make to address constant.

In-order to implement get-direction functionality following modules are required.

A.Download install and enable the above modules.drupal map route directions

B. Now create a custom content type with address field with field type as geofield and widget type as latitude/longitude.

For ex: get_direction_type

drupal map route directions

C. Create a content for the above content type and note the node id.

For ex: mysite_get_direction

D. Next step will be to create a custom block and paste the following code into block body.

<?php

$n = arg(0);

if ($n == 'node') {

$nid = arg(1);

if (is_numeric ($nid) && $nid > 0) {

echo getdirections_entity_setlocation($n, 'to', 134);

}

}

?>

In the above code, 134 is the node id of the content we created. In this ex: mysite_get_direction

Save the block and enable it to the pages you want to display.

E. Now navigate to admin menu - Configuration > web services > get direction.

drupal map route directions

Most of the settings are simple and self explainatory.

Some settings i would like to highlight is

Other settings tab

  • You can enable to display total distance and duration of the travel.
  • Make the to address constant- Enable from/To switch.
  • Enable traffic information for more accurate results.

drupal map route directions

Your final result will look similar to below image.

Getdirections also supports the following locative modules:

You should only install one of the above.

Subscribe For Our Newsletter And Stay Updated

Recent blogs

DrupalCamp 2018
“Everyone you will ever meet knows something you don’t” - said Bill Nye popularly known as The Science Guy, who (coincidentally)...
expert_talks
Drupal 8 is not just packed with features that alleviate digital experiences for the end user but is also making life easier for...
ecommerce sales
As an e-commerce marketer, you are always looking for new ways in which you can drive traffic to your e-commerce site and boost...

This website uses cookies to offer you an enhanced website experience. We collect information about how you interact with our website to provide personalized services to you. To find out more, see our Privacy Policy

×