The Simple Google Maps module for Drupal is a field formatter which displays a map using Google Maps. Using this module, you can display a map without having to install three or more location modules. All you have to do is, create a text field to store the address and configure the Simple Google Maps field formatter in the manage display section.
The geocoding - converting the address to a longitude and latitude coordinate - of the address is handled by Google Maps API when the formatter is rendered. Drupal will not store the geographical coordinates for each address. If you need to store coordinates in the database look at the Geofield module.
In this tutorial, I'll show you how to store an address and display a map in a few easy steps.
First, go download and install the Simple Google Maps module.
Create Address Text Field
The first piece of work we'll have to do is create a text field.
1. Go to Structure -> "Content types" (admin/structure/types) and click on the "manage fields" link for the Article content type.
2. Create a new field called Address, select Text from the "Field type" and select "Text field" as the widget. Click on the Save button to create the field.
3. Go to the manage display section (admin/structure/types/manage/article/display) for the Article content type. Select the "Google Map from one-line address" formatter from the Address drop-down.
4. Click on the cog wheel to configure the map. Using the configuration form, you can change the width/height, zoom level and map type. All we'll do is change the "Width of embedded map" and "Height of embedded map" to 600.
Click on the Update button and save the "Manage display" form.
5. Now go and test the map out, go to Content -> "Add content" -> Articles (node/add/article) and add an address to the field we created for storing addresses.
Once you have saved the content, you should see a map with a marker on the entered location.
As you can see Simple Google Maps module gets straight to the point. This module can be used for most location use cases on a website.
If you have any questions, please leave a comment.
Like what you see?
Join our free email list and receive the following:
- Discover our best tutorials in a 6 part series
- Be notified when free content is published
- Receive our monthly newsletter