Last updated 4 July 2013. Created on 4 July 2013.
Edited by tim.plunkett, quicksketch. Log in to edit this page.

The Google Maps (GMap) module for Drupal integrates Google Maps with a variety of different systems. It provides both an API and integration with Views, as well as a few bundled sub-projects.

The primary user-facing feature of the GMap module is integration with Views. From the project README.txt:

The GMap module includes built-in integration with the Views module. You can use
this to turn any list of nodes, users, or other content into a Google Map that
plots each item on a map.

To make a GMap-based view, create or edit a view under Administer > Structure >
Views. Under the "Format" section, change the format by clicking on the current
format type (usually "Unformatted list"). Then change the format type to either
"GMap" or "Extended GMap".

For each view you create that uses a GMap format, you may either use a custom
configuration or inherit the site-wide defaults. To make an advanced map
configuration, you may type or copy/paste a GMap macro into the "Macro" textarea
at the top of the GMap format configuration settings. See the section on
"Macros" for more information about how to customize the configuration of your
map using these powerful tools. If you don't want a custom configuration for
this view, just leave the default value for the Macro field.

The only other critically important setting when configuring a GMap format in
Views is the "Data Source" field. GMap can accept data from several different
sources, but ultimately it comes down to acquiring a latitude and longitude pair
for each item being displayed in the list. GMap module can acquire the lat/long
pair from any of the following sources:

- Location.module
- Geofield.module
- Geolocation.module
- or a pair of simple text or number fields

If you use the pair of text fields, you must also change your view to use a list
of fields. To do this, under the "Format" section of the view configuration,
click on the current row display style (usually the word "Content") and change
it to "Fields". Then under the "Fields" section of the view configuration, add
the fields you're using to store the latitude and longitude (they must be two
separate fields). It may be a good idea to use the "Exclude from display" option
on each of these fields, so they aren't shown in the actual GMap marker popups.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

wudixiaoyu’s picture

I want to show a map in one of my content type. As a beginner, I tried several modules, through the reviews, comments and documentation, Gmap is the most powerful one. But after I installed them, I know Gmap is also the most difficult one.

It has the most dependent modules, and once you install it, it is really hard for you to disable the related modules, and even if you disabled all of them, removed the related modules successfully, it may report an error later in several days because you lack this module.

I am really recommend the leaflet and geolocation module, it looks simpler and easy to use.