Adding a Google Map to content

Google Maps is a useful tool for describing locations of places, but implementing this manually involves writing some custom JavaScript code, which is not good for non-technical editors. In this recipe, we will be using the Location and GMaps modules to add a Castle content type with a Location field, which outputs its location on a Google Map. The Location field will feature various location attributes and a geocoding service, which will automatically plot the marker on the map, as shown in the following screenshot:

Adding a Google Map to content

Getting ready

You will need to install the most recent releases of the following modules:

Get Drupal 7 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.