Location and Gmap

Category
Drupal Version
Tags

Location and gmap modules provide embedded Google Maps for Drupal websites. 

However, the documentation and readme for configuring both of these modules is sparse, if available. Most documentation on how to utilize these modules as a pairing exist in knowledgebase entries and bug reports, which makes development using these two modules a chore.

Installing and configuring these modules takes a few main steps.

Installation

  1. Download Location and Gmap from Drupal, using the most recent stable releases for Drupal 7.
  2. Add these modules to your sites/all/modules folder.
  3. Log in to the website you wish to add these modules to.
  4. Enable these modules.

Configuration: Google

  1. Using a Google account, access the Google API Console.
  2. Create a new project.
  3. Under APIs & auth -> APIs, enable Geocoding API (for the Geocoding service of Location) and Google Maps Javascript API v3 (for Gmap). 
  4. Create a server key (for Geocoding), making sure to restrict the IPs to your server.
  5. Create a browser key (Gmap), making sure to restrict the referers to your domain(s).

Configuration: Drupal

  1. Log in as an administrator to your website.
  2. First, edit Location at: admin/config/content/location
  3. Under 'Geocoding Options', enable 'Google Maps' for United Statres.
  4. Under 'Configure parameters', enter the server key from above into the 'Google Geocoding API Server Key'. 
  5. Click 'Save Configuration'.
  6. Second, edit Google Maps at: admin/config/services/gmap
  7. Under 'Google Maps API Key', enter the browser key from above.
  8. Click 'Save Configuration'.

Configuration: Field

  1. Create a content type which utilizes a Location field.
  2. On the field options, disable the postal code, as this feature tends to break geolocation in some instances.
  3. Save the field.
  4. Test by creating a new node!