Use Google Maps to map Drupal content

Printer-friendly versionPrinter-friendly version

Suppose you have some content in your Web site that is geographical in nature, like photos from a trip, or users, or carpools to an event, or a portfolio of clients.  How do you map that information?  In Drupal, it's pretty easy to set up, and very easy to use once it's set up.  Here are the steps:

Setup tasks
  1. Download and install the Location and GMap modules in your /drupal/sites/all/modules directory.
  2. In your site's admin/build/modules page, enable Location, Gmap, and Gmap Location.
  3. Go to admin/settings/location, Enable the Display of Locations, and check Use a Google Map.
  4. Go to http://code.google.com/apis/maps/signup.html and get an API key for your URL.
  5. Go to admin/settings/gmap, paste in your API key, scroll to the bottom of the form, and save the configuration.  (You must do this before the other configuration options will work.)
  6. On the same page, set your Default Map Settings -- these affect the map you see when setting a location for a node.  If you don't understand a setting, ignore it.
  7. Go to admin/settings/gmap_location and adjust the settings for your user and node maps.  If you're not going to use one or the other, just ignore it.
  8. Go to admin/user/permissions and set the permissions for the gmap_location and location modules.  In particular, "show node map" and/or "show user map" must be enabled for a user to see the maps in question.  "user location" means that when a point on the user map is clicked, info about that user will show up; if you leave this unchecked, only locations will be shown without personal info.
  9. Go to admin/content/types, edit each content type that you want to map, and set the Locative Information settings.
  10. Go to admin/build/menu and edit the Navigation menu items for Node Locations and User Locations.
Mapping your content
  1. Edit a node, or create a new one, of a type that you're mapping.
  2. Under Location, click the map to add a marker to it.  Pick up and drop the marker repeatedly to zoom in so you can place it more precisely.  (This is a lot quicker than zooming and panning.)
  3. Save your changes, and go to map/node to survey your handiwork.