Google Maps in Drupal 7 - the simple way
For a client project last week, I needed to display automatically-generated embedded maps or links to external maps (e.g., a link to Google Maps), based on an entered address for a performance venue. In some display modes, I wanted a map on the page (such as when displaying a Venue page by itself), and in other display modes, I wanted a map link (such as when displaying venue information on a Performance page). Although this is, I'm sure, a common need on web sites, an extensive search for existing Drupal modules to didn't get me anywhere. The best solution I came up with for embedding the map involved at least three Drupal modules and several external library downloads, several of which were not yet released for Drupal 7 apart from "development" versions, and it didn't create the link to an external map that I needed.
So I thought to myself... This can't really be as difficult as using all these modules and libraries. When you go to Google Maps and map a location, Google provides code (click the Link icon near the map) for embedding that map in a web page in an iframe, and making a link to the map. I experimented a bit with the iframe and link code, and found that the latitude and longitude values could be omitted -- meaning that all you need is an address that Google maps can recognize.
This revelation allowed for a really simple solution. I used the Drupal 7 Field API to create a "Field Formatter" module that would take a plain text field containing an address that Google Maps could recognize, and instead of just displaying that text (which is what the default Text field formatter does), it would display as an embedded map, a link to Google Maps, or both. It took less than an hour to code, and works just fine for this project's purposes.
Update February 12, 2012: This module is now a full Drupal.org project, which you can download at: http://drupal.org/project/simple_gmap
Note: As with all modules on drupal.org, if you have comments or questions about this module, please search the issue queue to see if your question has already been answered, and if not, file a new issue. I'm closing comments on this post, meanwhile...