HomeDrupalCreating a Google Map Link in Views Using an Address Field

Creating a Google Map Link in Views Using an Address Field

There are times when you don’t want to embed a map on your site and you simply want to link an address off to Google maps. Here’s how to do it using address field.

Address field module doesn’t currently have a views formatter to display an address as a link to Google Maps. You could create one. But, for a quick one-off view, this gets the job done.

  1. Add the address field to the view.
  2. Rewrite the output of the field as:

The field name in this case is field_class_location.


<a href="http://maps.google.com/?q=[field_class_location-thoroughfare] [field_class_location-premise][field_class_location-sub_premise] [field_class_location-locality] [field_class_location-dependent_locality] [field_class_location-administrative_area] [field_class_location-sub_administrative_area] [field_class_location-postal_code] [field_class_location-country]">[field_class_location]</a>