googleDirections plugin
Written by kksou   
Monday, 11 May 2009

This plugin allows you to include one or more driving or walking directions provided by Google Maps right inside your content item or article.

This is a super light-weight plugin using only about 10K of codes.

If you need to display driving or walking directions to your company, or from one place to another, this is the plugin.

If you want to allow users to find ways to your office or some designated place, use the googleDirections - To Here - plugin

The Google API Key

The plugin makes use of the Google Maps API provided by Google. As such, please make sure you have the Google Maps API. If you don't have the key, you can sign up for free here.


Geocoding your address

The Google Maps require you to input the geographic coordinates (i.e. the latitude and longitude) of the center of the map (if you're using the kml file).

If you do not know the latitude and longitude of an address, you can them find out here: Free Geocoder v2.0 by kksou.

Latest Version

v1.08 (for Joomla 1.0) and v1.58 (for Joomla 1.5)
Released Oct 1, 2009

This is in response to Gasta's post titled "GoogleDir without directions!"

He would like to display the google map with multiple destinations, but hide the text description on the right.

This new version supports this with the addition of the new parameter: hide_direction_text=1

You can see a sample here: Show map directions with maps only (and text description hidden) .

googleMaps Plugin

This plugin is for showing directions using Google Maps API.

If you just need a simple map (without any driving directions), you can use the googleMaps plugin.

Live Demo

Below you can see a live demo of the plugin. Note that you can include more than one map directions within an article.

Demo 1: Driving Directions from Google to Yahoo

MapDirections

Demo 2: Walking Directions from Union Square to Ghirardelli Square, San Francisco

MapDirections

Demo 3: Driving Directions using map from KML file

MapDirections
[googleDir lat=53.91081 long=-2.565308 width=400 height=360 zoom=9 dir_on_right=1 from="Glasgow, UK" to="Manchester, UK" kml=http://www.kksou.com/gmap/test/KML_Samples12.kml]

More Demos

How to use

  1. Very Important!!! Before you can make use of the plugin, please enter the Google Map API Key in the Parameters page in the Plugin Manager.
  2. To insert a Google Map with directions, use the following syntax:
  3. {googleDir from="1600 Amphitheatre Parkway, Mountain View CA 94043" 
    to="701 First Avenue, Sunnyvale, CA 94089"}
    

    Note that:

    • Enclose from and to in double quotes (")
    • Enter the full address in one line. If you're not in US, specify your country too.


  4. To specify the width and height of the map, use the following syntax. Note that for Google Map with directions, you cannot specify the width and height in percentages.
  5. {googleDir width=480 height=360 
    from="1600 Amphitheatre Parkway, Mountain View CA 94043" 
    to="701 First Avenue, Sunnyvale, CA 94089"}
    
  6. Zoom level. Note that the default zoom level of the map is automatically set by Google such that the start point and end point are being displayed optimally on the map.
  7. KML Files: To use kml files, use the following syntax:
  8. {googleDir lat=53.91081 long=-2.565308 width=480 height=360 zoom=9 
    from="Glasgow, UK" to="Manchester, UK" 
    kml=http://econym.googlepages.com/lancashire.kml}
    

    Note that when you use kml files, you have to specify the latitude and longitude of the centre of the map.

  9. Map Control: You can use the various map control as defined in Goolge Maps Controls Overview. For example, to use the large pan/zoom control as now used on Google Maps, use the following syntax:
  10. {googleDir control=GLargeMapControl3D
    from="1600 Amphitheatre Parkway, Mountain View CA 94043" 
    to="701 First Avenue, Sunnyvale, CA 94089"}
    

    You can add multiple controls by delimiting with '|' as follows:

    {googleDir control=GLargeMapControl|GMapTypeControl
    from="1600 Amphitheatre Parkway, Mountain View CA 94043" 
    to="701 First Avenue, Sunnyvale, CA 94089"}
    

    Other common map controls are as follows:

    • GLargeMapControl3D - a large pan/zoom control as now used on Google Maps. Appears in the top left corner of the map by default.
    • GLargeMapControl - a simpler large pan/zoom control. Appears in the top left corner of the map by default.
    • GSmallMapControl - a smaller pan/zoom control. Appears in the top left corner of the map by default.
    • GSmallZoomControl3D - a small zoom control (with no panning controls) as now used on Google Maps.
    • GSmallZoomControl - a small zoom control (no panning controls) used in the small map blowup windows used to display driving directions steps on Google Maps.
    • GScaleControl - a map scale
    • GMapTypeControl - buttons that let the user toggle between map types (such as Map and Satellite)
    • GHierarchicalMapTypeControl - a selection of nested buttons and menu items for placing many map type selectors.
    • GOverviewMapControl - a collapsible overview map in the corner of the screen

    For complete list, please refer to Goolge Maps Controls Overview.

  11. Map Type: You can use the various map type as defined in Common Map Types.
  12. For example, to display a Google Earth satellite image, use the following syntax:

    {googleDir control=GLargeMapControl3D maptype=G_SATELLITE_MAP
    from="1600 Amphitheatre Parkway, Mountain View CA 94043" 
    to="701 First Avenue, Sunnyvale, CA 94089"}
    

    Other common map types are as follows:

    • G_NORMAL_MAP displays the default road map view
    • G_SATELLITE_MAP displays Google Earth satellite images
    • G_HYBRID_MAP displays a mixture of normal and satellite views
    • G_DEFAULT_MAP_TYPES contains an array of the above three types, useful for iterative processing.

    For complete list, please refer to Common Map Types.

  13. Language option. The Google Maps API uses the browser's preferred language setting when displaying textual information such as the names for controls, copyright notices, and driving directions. If you wish to change the Maps API to ignore the browser's language setting and force it to display information in a particular language, you can add an optional lang parameter.
  14. e.g. to display the Goolge Maps control in French, use:

    {googleMaps lat=37.4219720 long=-122.0841430 lang=fr}
    

    To display the Goolge Maps control in Japanese, use:

    {googleMaps lat=37.4219720 long=-122.0841430 lang=ja}
    

    You can look up the entire list of supported languages here.

  15. To insert a Google Map with walking directions (as oppose to driving), use the following syntax:
  16. {googleDir mode=walking
    from="1600 Amphitheatre Parkway, Mountain View CA 94043" 
    to="701 First Avenue, Sunnyvale, CA 94089"}
    

    The default mode is driving.

  17. By default, the map will be shown on the left and the directions on the right. If you want to swap this and have the directions displayed on the left, use the following syntax:
  18. {googleDir map_on_right=1
    from="1600 Amphitheatre Parkway, Mountain View CA 94043" 
    to="701 First Avenue, Sunnyvale, CA 94089"}
    

    The default mode is driving.

  19. If you wish to hide the text description on the right of the map, use the following syntax:
  20. {googleDir hide_direction_text=1
    from="1600 Amphitheatre Parkway, Mountain View CA 94043" 
    to="701 First Avenue, Sunnyvale, CA 94089"}
    

    You can see a sample here: Show map directions with maps only (and text description hidden) .

Multiple Destinations

To have a Google Map Directions with multiple destinations or stopovers, please refer to the following article:

Google Maps directions with multiple destinations

Download

Important: This plugin makes use of the googleMaps plugin to display the map. So please make sure you have installed googleMaps plugin v1.09/1.59 and above for this plugin to work. Very Important: This plugin works only with PHP5 and higher. It does not work with PHP4 because PHP4 does not support OOP multiple inheritance.
Thanks to Chaminda and Marc for sharing and highlighting this.

History

  • v1.0 (for Joomla 1.0) and v1.5 (for Joomla 1.5)
    Released May 11, 2009
  • v1.02 (for Joomla 1.0) and v1.52 (for Joomla 1.5)
    Released May 14, 2009

  • Thanks to Nina and Warren for highlighting that the plugin does not work in IE. A quick google will reveal that this seems to be a prevalent problem especially with IE6.

    Have fixed this in the new version. The googleMaps and googleDirections plugins now work with IE6 and above.

    Note that rendering of the Google Maps in IE6 is relatively slower than that in other browsers. So please be a bit patient. Also it seems that in IE6 the map marker icons (the little red teardrops) were not rendering properly.

  • v1.03 (for Joomla 1.0) and v1.53 (for Joomla 1.5)
    Released May 21, 2009
  • Bug fix: when swapping the map and directions from left to right, the headings are now displayed correctly.

  • v1.04 (for Joomla 1.0) and v1.54 (for Joomla 1.5)
    Released May 25, 2009
    • support for geographical coordinates (i.e. longitude and latitude)
    • support for multilines i.e. you can specify multiple destinations across multiple lines
    • added GOverviewMapControl, GScaleControl, GoogleBar
    • You can now display both the googleMaps and googleDirections in the same article.
  • v1.05 (for Joomla 1.0) and v1.55 (for Joomla 1.5)
    Released May 27, 2009
  • uses googleMaps plugin for map display

  • v1.06 (for Joomla 1.0) and v1.56 (for Joomla 1.5)
    Released May 28, 2009
    • added new parameter header_map - The default heading displayed above the map is the English word "Map". You can now change this to your own language.
    • added new parameter header_dir - The default heading displayed above the directions is the English word "Directions". You can now change this to your own language.
    • added new parameter header_directions. By default, the map is displayed on the left and the directions on the right. To make the map appear on the right, set map_on_right=1

    Important: the googleDirections plugin now makes use of the googleMaps plugin to display the map. So please make sure you have installed the googleMaps plugin for this plugin to work.

  • >v1.07 (for Joomla 1.0) and v1.57 (for Joomla 1.5)
    Released Jun 1, 2009
  • Added support for the plugin googleDirections - To Here - plugin



User reviews   Average user ratings:    4.0   (from 1 user)
  1. chinashwq
    November 04, 2009 8:26pm
    thanks

    good.thanks

Note: You have to be a registered member to leave a comment. Free registration here.

Last Updated ( Wednesday, 13 May 2009 )
 
< Prev   Next >

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2009. kksou.com. All Rights Reserved