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 http://www.google.com/apis/maps/signup.html 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.

Advertisements

Actions

Information

14 responses

13 07 2009
Diego

Hello, the resul gmap view filter is one map for node, how display all resul in only one map? thanks.

14 07 2009
Prajwala

I did not understand “resul gmap view” can you explain?

23 07 2009
deafbiz

Maybe Diego means showing many nodes on one map. This is what I’m interested in it as well. Is there an example for this tutorial lesson?

24 07 2009
Prajwala

You can do this by creating a view. You create a view normally by adding fields, filters etc, just choose the style of the view as GMap. That’s it all the nodes that your query is returning will appear on the Map. The style will create marker for each node, when you click on the marker the information will appear in the overlay. This information is the fields that you choose in the view.

7 02 2011
Ravi

Thanks!!

14 05 2010
Kathrine

Hi,

Your lesson is very helpful. I thank you a lot. But I have one doubt in this. How to point the address for the location in the map? Can you help me?

Thanks,
Kathrine

15 05 2010
Prajwala

Kathrine, you mean how to point address/location in a map? You can point a location in 2 ways, you can create a GMap Macro by enabling GMap Macro Builder module and you can create a view using the style as GMap. If you are using views, the nodes which are filtered should have location details.

18 05 2010
Kathrine

Thanks for your reply. I need detailed explanation for this “Create a view using the style as GMap. If you are using views, the nodes which are filtered should have location details”. Bcoz iam fresher to this.

Thanks,
Kathrine

18 05 2010
Prajwala

Install advanced_help module and check the tutorial of creating views. I can’t explain every step of creating views.

21 05 2010
Kathrine

Hi

Sorry for disturbing u again, here by i send the text created from GMap Macro Builder module ,how to add address here.

[gmap markers=small red::7.222970961912744,73.828125 + 23.932038010534892,80.39794921875 + 21.7043898443405,80.48583984375 + 20.885501528625586,77.36572265625 + 21.377382529326738,85.18798828125 + 25.210904958854105,75.43212890625 + 26.672986032027723,83.73779296875 + 26.555118882686145,79.07958984375 + 23.89186455052565,75.08056640625 |align=Center |zoom=5 |center=20.591652120829167,78.9697265625 |width=500px |height=400px |control=Large |type=Hybrid]

Thanks and Regards
Kathrine

21 05 2010
Prajwala

Hi Kathrine,

The gmap macro that you pasted is having some marks on the but. As I understand you want to display som information when you click on that marker on the map. If want to do this, check the node locations link that appear in the left navigation. You can build a view using style as GMap, on the fields sections choose the address and node title fields which you want to display when you hover the marker. On the filters section of the view add any conditions like node type. Hope this information is helpful.

Regards,
Prajwala

9 09 2010
andreww

Thank you. Very helpfull post…

9 06 2011
Drupal Views tutorials and resources « ddrupal

[…] Using GMap + Location + Views Drupal Modules from prajwalaa.wordpress.com […]

30 08 2011
Peter Cook

For Drupal 7 the input text formats are found at, /admin/config/content/formats
Thanks for the help working out how to add gmaps.
Peter Cook

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: