Using GMap + Location + Views Drupal Modules

5 07 2009

Recently I got a chance to work on GMaps using drupal. GMap and Location modules are very good to integrate GMap with drupal. Views module made my life very easy.

Installing GMap + Views

1. Install views and enable views and views UI module

2. Install GMap and locations module and enable GMap, Location, GMap Location, Node Locations, User Locations, Location Add Another modules

3. Go to admin/settings/gmap page and add the gmap api key, which we can get through and adjust other map settings

4. Go to admin/settings/gmap_location page and adjust the gmap macro settings if needed.

5. Go to content type edit page and adjust the location settings.

6. Add the nodes by specifying some locations.

7. Go to map/node page which will show GMap with node locations marked.

Creating GMap View

Creating of view is normal, just select the view style as GMap. The result of the query values will display as markers on GMap.

GMap Macros

A GMap macro is a text-based way of describing arbitrary GMaps. We can build this macro using GMap Macro Builder module.

1. Enable GMap Macro Builder Module

2. Go to map/macro or click on the Build GMap Macro link in the Navigation to build macro.

3. Audgest the GMap settings, at the down in the Macro text box the text representation of map will be updated.Copy this text and use when ever is needed.

Using GMap Macro

We can use this GMap macro on any node. To display GMap on any node (ex: page) just copy the above GMap macro text and place it in the body text and choose the Input format GMap. To get input format GMap just add one input format like this.

1. Go to admin/settings/filters/add page

2. Type the name of the filter as GMap

3. Choose the GMap macro Expander and save.

I hope this will be helpful for others.

Note: I used Drupal 6.12 version.