Hi,

I would like to know how I may make it such that getdirections gets fed the locations to be traveled via some form fields. A user enters the start and end points, on clicking enter, gets transferred to a page with all the info already populated about distance. Directions would be a plus.

How can this be implemented and which parts would I need to tweak? Thanks a lot for the wonderful module.

Comments

hutch’s picture

Priority: Major » Normal
Status: Needs work » Active

The simplest way would be to use the form supplied by Getdirections which can be found at something like
http://somesite.com/getdirections
If you want to use your own form you will have to do something a bit more complicated:
The form would collect the addresses and send them back to your module where they would have to be geocoded and fed into function getdirections_locations_bylatlon(). See getdirections.api.inc for details on how to use this function.
To geocode serverside you could use a function similar to the function getlocations_geocode() which can be found in the Getlocations module

chiko.mukwenha’s picture

Thanks for the advice. It's the route I'll follow.

I noticed on my website when I go directly to /getdirections its outputs this error:

Error message
Notice: Undefined variable: location in getdirections_direction_form() (line 578 of C:\xampp\htdocs\base\sites\all\modules\getdirections\getdirections.module).

not sure what default value it's looking for. Before I proceed how may I fix this?

Thanks

hutch’s picture

This is a notice, not an error so it can probably be ignored, however as I cannot find a variable location on line 578 in getdirections.module (current development version for Drupal 7) I suspect that you have some other problem. I would suggest that you uninstall getdirections, fetch a fresh copy and reinstall, configure and try again. Tick the box 'Use Googlemaps version 3', save configuration and set it up to your liking.